clang 10.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 #ifndef LLVM_CLANG_BASIC_SANITIZERSPECIALCASELIST_H
14 #define LLVM_CLANG_BASIC_SANITIZERSPECIALCASELIST_H
15
16 #include "clang/Basic/LLVM.h"
17 #include "clang/Basic/Sanitizers.h"
18 #include "llvm/ADT/StringRef.h"
19 #include "llvm/Support/SpecialCaseList.h"
20 #include "llvm/Support/VirtualFileSystem.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, llvm::vfs::FileSystem &VFS,
29 std::string &Error);
30
31 static std::unique_ptr<SanitizerSpecialCaseList>
32 createOrDie(const std::vector<std::string> &Paths,
33 llvm::vfs::FileSystem &VFS);
34
35 // Query blacklisted entries if any bit in Mask matches the entry's section.
36 bool inSection(SanitizerMask Mask, StringRef Prefix, StringRef Query,
37 StringRef Category = StringRef()) const;
38
39 protected:
40 // Initialize SanitizerSections.
41 void createSanitizerSections();
42
43 struct SanitizerSection {
44 SanitizerSection(SanitizerMask SM, SectionEntries &E)
45 : Mask(SM), Entries(E){};
46
47 SanitizerMask Mask;
48 SectionEntries &Entries;
49 };
50
51 std::vector<SanitizerSection> SanitizerSections;
52 };
53
54 } // end namespace clang
55
56 #endif
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
Definition: SanitizerSpecialCaseList.h:25
Sanitizers.h
Defines the clang::SanitizerKind enum.
clang::SanitizerSpecialCaseList::SanitizerSections
std::vector< SanitizerSection > SanitizerSections
Definition: SanitizerSpecialCaseList.h:51
Category
int Category
Definition: Format.cpp:1828
LLVM.h
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
clang::SanitizerSpecialCaseList::SanitizerSection
Definition: SanitizerSpecialCaseList.h:43
clang::SanitizerSpecialCaseList::SanitizerSection::Mask
SanitizerMask Mask
Definition: SanitizerSpecialCaseList.h:45
clang::SanitizerSpecialCaseList::inSection
bool inSection(SanitizerMask Mask, StringRef Prefix, StringRef Query, StringRef Category=StringRef()) const
Definition: SanitizerSpecialCaseList.cpp:56
clang::SanitizerSpecialCaseList::SanitizerSection::SanitizerSection
SanitizerSection(SanitizerMask SM, SectionEntries &E)
Definition: SanitizerSpecialCaseList.h:44
clang::DiagnosticLevelMask::Error
SM
const SourceManager & SM
Definition: Format.cpp:1685
clang::SanitizerSpecialCaseList::createSanitizerSections
void createSanitizerSections()
Definition: SanitizerSpecialCaseList.cpp:39
clang::SanitizerMask
Definition: Sanitizers.h:29
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:21
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::SanitizerSection::Entries
SectionEntries & Entries
Definition: SanitizerSpecialCaseList.h:48