clang  11.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,
36  std::string &Error);
37 
38  static std::unique_ptr<SanitizerSpecialCaseList>
39  createOrDie(const std::vector<std::string> &Paths,
40  llvm::vfs::FileSystem &VFS);
41 
42  // Query blacklisted 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.
48  void createSanitizerSections();
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
Specialize PointerLikeTypeTraits to allow LazyGenerationalUpdatePtr to be placed into a PointerUnion...
Definition: Dominators.h:30
Defines the clang::SanitizerKind enum.
std::vector< SanitizerSection > SanitizerSections
int Category
Definition: Format.cpp:2007
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
llvm::Error Error
SanitizerSection(SanitizerMask SM, SectionEntries &E)
#define SM(sm)
Definition: Cuda.cpp:62
Dataflow Directional Tag Classes.
std::unique_ptr< DiagnosticConsumer > create(StringRef OutputFile, DiagnosticOptions *Diags, bool MergeChildRecords=false)
Returns a DiagnosticConsumer that serializes diagnostics to a bitcode file.