clang 8.0.0

SanitizerSpecialCaseList.h
Go to the documentation of this file.
1 //===--- SanitizerSpecialCaseList.h - SCL for sanitizers --------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // An extension of SpecialCaseList to allowing querying sections by
11 // SanitizerMask.
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
23 namespace clang {
24
25 class SanitizerSpecialCaseList : public llvm::SpecialCaseList {
26 public:
27 static std::unique_ptr<SanitizerSpecialCaseList>
28 create(const std::vector<std::string> &Paths, std::string &Error);
29
30 static std::unique_ptr<SanitizerSpecialCaseList>
31 createOrDie(const std::vector<std::string> &Paths);
32
33 // Query blacklisted entries if any bit in Mask matches the entry's section.
34 bool inSection(SanitizerMask Mask, StringRef Prefix, StringRef Query,
35 StringRef Category = StringRef()) const;
36
37 protected:
38 // Initialize SanitizerSections.
39 void createSanitizerSections();
40
41 struct SanitizerSection {
42 SanitizerSection(SanitizerMask SM, SectionEntries &E)
43 : Mask(SM), Entries(E){};
44
45 SanitizerMask Mask;
46 SectionEntries &Entries;
47 };
48
49 std::vector<SanitizerSection> SanitizerSections;
50 };
51
52 } // end namespace clang
53
54 #endif
clang::SanitizerSpecialCaseList
Definition: SanitizerSpecialCaseList.h:25
Sanitizers.h
Defines the clang::SanitizerKind enum.
clang::SanitizerSpecialCaseList::SanitizerSections
std::vector< SanitizerSection > SanitizerSections
Definition: SanitizerSpecialCaseList.h:49
Category
int Category
Definition: Format.cpp:1632
LLVM.h
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
clang::SanitizerSpecialCaseList::SanitizerSection
Definition: SanitizerSpecialCaseList.h:41
clang::SanitizerSpecialCaseList::SanitizerSection::Mask
SanitizerMask Mask
Definition: SanitizerSpecialCaseList.h:43
clang::SanitizerSpecialCaseList::inSection
bool inSection(SanitizerMask Mask, StringRef Prefix, StringRef Query, StringRef Category=StringRef()) const
Definition: SanitizerSpecialCaseList.cpp:55
clang::SanitizerSpecialCaseList::SanitizerSection::SanitizerSection
SanitizerSection(SanitizerMask SM, SectionEntries &E)
Definition: SanitizerSpecialCaseList.h:42
clang::DiagnosticLevelMask::Error
SM
const SourceManager & SM
Definition: Format.cpp:1490
clang::SanitizerSpecialCaseList::create
static std::unique_ptr< SanitizerSpecialCaseList > create(const std::vector< std::string > &Paths, std::string &Error)
Definition: SanitizerSpecialCaseList.cpp:19
clang::SanitizerSpecialCaseList::createSanitizerSections
void createSanitizerSections()
Definition: SanitizerSpecialCaseList.cpp:38
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:22
clang::SanitizerMask
uint64_t SanitizerMask
Definition: Sanitizers.h:26
clang::SanitizerSpecialCaseList::SanitizerSection::Entries
SectionEntries & Entries
Definition: SanitizerSpecialCaseList.h:46
clang::SanitizerSpecialCaseList::createOrDie
static std::unique_ptr< SanitizerSpecialCaseList > createOrDie(const std::vector< std::string > &Paths)
Definition: SanitizerSpecialCaseList.cpp:31