clang  14.0.0git
SanitizerSpecialCaseList.h
Go to the documentation of this file.
1 //===--- SanitizerSpecialCaseList.h - SCL for sanitizers --------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // An extension of SpecialCaseList to allowing querying sections by
10 // SanitizerMask.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_BASIC_SANITIZERSPECIALCASELIST_H
15 #define LLVM_CLANG_BASIC_SANITIZERSPECIALCASELIST_H
16 
17 #include "clang/Basic/LLVM.h"
18 #include "clang/Basic/Sanitizers.h"
19 #include "llvm/ADT/StringRef.h"
20 #include "llvm/Support/SpecialCaseList.h"
21 #include <memory>
22 #include <vector>
23 
24 namespace llvm {
25 namespace vfs {
26 class FileSystem;
27 }
28 } // namespace llvm
29 
30 namespace clang {
31 
32 class SanitizerSpecialCaseList : public llvm::SpecialCaseList {
33 public:
34  static std::unique_ptr<SanitizerSpecialCaseList>
35  create(const std::vector<std::string> &Paths, llvm::vfs::FileSystem &VFS,
37 
38  static std::unique_ptr<SanitizerSpecialCaseList>
39  createOrDie(const std::vector<std::string> &Paths,
40  llvm::vfs::FileSystem &VFS);
41 
42  // Query ignorelisted entries if any bit in Mask matches the entry's section.
43  bool inSection(SanitizerMask Mask, StringRef Prefix, StringRef Query,
44  StringRef Category = StringRef()) const;
45 
46 protected:
47  // Initialize SanitizerSections.
49 
51  SanitizerSection(SanitizerMask SM, SectionEntries &E)
52  : Mask(SM), Entries(E){};
53 
55  SectionEntries &Entries;
56  };
57 
58  std::vector<SanitizerSection> SanitizerSections;
59 };
60 
61 } // end namespace clang
62 
63 #endif
clang::SanitizerSpecialCaseList::SanitizerSection::Entries
SectionEntries & Entries
Definition: SanitizerSpecialCaseList.h:55
clang::SanitizerSpecialCaseList::SanitizerSection::SanitizerSection
SanitizerSection(SanitizerMask SM, SectionEntries &E)
Definition: SanitizerSpecialCaseList.h:51
llvm
Definition: Dominators.h:30
Error
llvm::Error Error
Definition: ByteCodeEmitter.cpp:20
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::SanitizerSpecialCaseList::createOrDie
static std::unique_ptr< SanitizerSpecialCaseList > createOrDie(const std::vector< std::string > &Paths, llvm::vfs::FileSystem &VFS)
Definition: SanitizerSpecialCaseList.cpp:31
clang::SanitizerSpecialCaseList::SanitizerSection
Definition: SanitizerSpecialCaseList.h:50
Category
int Category
Definition: Format.cpp:2336
clang::SanitizerSpecialCaseList::create
static std::unique_ptr< SanitizerSpecialCaseList > create(const std::vector< std::string > &Paths, llvm::vfs::FileSystem &VFS, std::string &Error)
Definition: SanitizerSpecialCaseList.cpp:18
clang::SanitizerSpecialCaseList::createSanitizerSections
void createSanitizerSections()
Definition: SanitizerSpecialCaseList.cpp:39
clang::SanitizerSpecialCaseList::SanitizerSections
std::vector< SanitizerSection > SanitizerSections
Definition: SanitizerSpecialCaseList.h:58
LLVM.h
Sanitizers.h
clang
Definition: CalledOnceCheck.h:17
clang::SanitizerSpecialCaseList
Definition: SanitizerSpecialCaseList.h:32
clang::SanitizerSpecialCaseList::SanitizerSection::Mask
SanitizerMask Mask
Definition: SanitizerSpecialCaseList.h:52
SM
#define SM(sm)
Definition: Cuda.cpp:78
clang::SanitizerMask
Definition: Sanitizers.h:30
clang::SanitizerSpecialCaseList::inSection
bool inSection(SanitizerMask Mask, StringRef Prefix, StringRef Query, StringRef Category=StringRef()) const
Definition: SanitizerSpecialCaseList.cpp:56