xref: /freebsd/contrib/llvm-project/clang/include/clang/Basic/NoSanitizeList.h (revision fcaf7f8644a9988098ac6be2165bce3ea4786e91)
1 //===--- NoSanitizeList.h - List of ignored entities for sanitizers --*- C++
2 //-*-===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // User-provided list of ignored entities used to disable/alter
11 // instrumentation done in sanitizers.
12 //
13 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_BASIC_NOSANITIZELIST_H
15 #define LLVM_CLANG_BASIC_NOSANITIZELIST_H
16 
17 #include "clang/Basic/LLVM.h"
18 #include "clang/Basic/SourceLocation.h"
19 #include "llvm/ADT/StringRef.h"
20 #include <memory>
21 #include <vector>
22 
23 namespace clang {
24 
25 class SanitizerMask;
26 class SourceManager;
27 class SanitizerSpecialCaseList;
28 
29 class NoSanitizeList {
30   std::unique_ptr<SanitizerSpecialCaseList> SSCL;
31   SourceManager &SM;
32 
33 public:
34   NoSanitizeList(const std::vector<std::string> &NoSanitizeListPaths,
35                  SourceManager &SM);
36   ~NoSanitizeList();
37   bool containsGlobal(SanitizerMask Mask, StringRef GlobalName,
38                       StringRef Category = StringRef()) const;
39   bool containsType(SanitizerMask Mask, StringRef MangledTypeName,
40                     StringRef Category = StringRef()) const;
41   bool containsFunction(SanitizerMask Mask, StringRef FunctionName) const;
42   bool containsFile(SanitizerMask Mask, StringRef FileName,
43                     StringRef Category = StringRef()) const;
44   bool containsMainFile(SanitizerMask Mask, StringRef FileName,
45                         StringRef Category = StringRef()) const;
46   bool containsLocation(SanitizerMask Mask, SourceLocation Loc,
47                         StringRef Category = StringRef()) const;
48 };
49 
50 } // end namespace clang
51 
52 #endif
53