clang  19.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 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
#define SM(sm)
Definition: Cuda.cpp:83
int Category
Definition: Format.cpp:2979
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::SanitizerKind enum.
static std::unique_ptr< SanitizerSpecialCaseList > create(const std::vector< std::string > &Paths, llvm::vfs::FileSystem &VFS, std::string &Error)
bool inSection(SanitizerMask Mask, StringRef Prefix, StringRef Query, StringRef Category=StringRef()) const
static std::unique_ptr< SanitizerSpecialCaseList > createOrDie(const std::vector< std::string > &Paths, llvm::vfs::FileSystem &VFS)
std::vector< SanitizerSection > SanitizerSections
The JSON file list parser is used to communicate input to InstallAPI.
Diagnostic wrappers for TextAPI types for error reporting.
Definition: Dominators.h:30
SanitizerSection(SanitizerMask SM, SectionEntries &E)