clang 19.0.0git
NoSanitizeList.cpp
Go to the documentation of this file.
1//===--- NoSanitizeList.cpp - Ignored list for sanitizers ----------------===//
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// User-provided ignore-list used to disable/alter instrumentation done in
10// sanitizers.
11//
12//===----------------------------------------------------------------------===//
13
19
20using namespace clang;
21
22NoSanitizeList::NoSanitizeList(const std::vector<std::string> &NoSanitizePaths,
24 : SSCL(SanitizerSpecialCaseList::createOrDie(
25 NoSanitizePaths, SM.getFileManager().getVirtualFileSystem())),
26 SM(SM) {}
27
29
30bool NoSanitizeList::containsGlobal(SanitizerMask Mask, StringRef GlobalName,
31 StringRef Category) const {
32 return SSCL->inSection(Mask, "global", GlobalName, Category);
33}
34
35bool NoSanitizeList::containsType(SanitizerMask Mask, StringRef MangledTypeName,
36 StringRef Category) const {
37 return SSCL->inSection(Mask, "type", MangledTypeName, Category);
38}
39
41 StringRef FunctionName) const {
42 return SSCL->inSection(Mask, "fun", FunctionName);
43}
44
46 StringRef Category) const {
47 return SSCL->inSection(Mask, "src", FileName, Category);
48}
49
51 StringRef Category) const {
52 return SSCL->inSection(Mask, "mainfile", FileName, Category);
53}
54
56 StringRef Category) const {
57 return Loc.isValid() &&
58 containsFile(Mask, SM.getFilename(SM.getFileLoc(Loc)), Category);
59}
#define SM(sm)
Definition: Cuda.cpp:82
Defines the clang::FileManager interface and associated types.
int Category
Definition: Format.cpp:2972
Defines the clang::SanitizerKind enum.
Defines the SourceManager interface.
NoSanitizeList(const std::vector< std::string > &NoSanitizeListPaths, SourceManager &SM)
bool containsType(SanitizerMask Mask, StringRef MangledTypeName, StringRef Category=StringRef()) const
bool containsGlobal(SanitizerMask Mask, StringRef GlobalName, StringRef Category=StringRef()) const
bool containsFile(SanitizerMask Mask, StringRef FileName, StringRef Category=StringRef()) const
bool containsLocation(SanitizerMask Mask, SourceLocation Loc, StringRef Category=StringRef()) const
bool containsMainFile(SanitizerMask Mask, StringRef FileName, StringRef Category=StringRef()) const
bool containsFunction(SanitizerMask Mask, StringRef FunctionName) const
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
This class handles loading and caching of source files into memory.
SourceLocation getFileLoc(SourceLocation Loc) const
Given Loc, if it is a macro location return the expansion location or the spelling location,...
StringRef getFilename(SourceLocation SpellingLoc) const
Return the filename of the file containing a SourceLocation.
The JSON file list parser is used to communicate input to InstallAPI.