clang  6.0.0svn
SanitizerBlacklist.cpp
Go to the documentation of this file.
1 //===--- SanitizerBlacklist.cpp - Blacklist for sanitizers ----------------===//
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 // User-provided blacklist used to disable/alter instrumentation done in
11 // sanitizers.
12 //
13 //===----------------------------------------------------------------------===//
15 
16 using namespace clang;
17 
19  const std::vector<std::string> &BlacklistPaths, SourceManager &SM)
20  : SSCL(SanitizerSpecialCaseList::createOrDie(BlacklistPaths)), SM(SM) {}
21 
23  StringRef GlobalName,
24  StringRef Category) const {
25  return SSCL->inSection(Mask, "global", GlobalName, Category);
26 }
27 
29  StringRef MangledTypeName,
30  StringRef Category) const {
31  return SSCL->inSection(Mask, "type", MangledTypeName, Category);
32 }
33 
35  StringRef FunctionName) const {
36  return SSCL->inSection(Mask, "fun", FunctionName);
37 }
38 
40  StringRef FileName,
41  StringRef Category) const {
42  return SSCL->inSection(Mask, "src", FileName, Category);
43 }
44 
46  SourceLocation Loc,
47  StringRef Category) const {
48  return Loc.isValid() &&
49  isBlacklistedFile(Mask, SM.getFilename(SM.getFileLoc(Loc)), Category);
50 }
51 
bool isBlacklistedType(SanitizerMask Mask, StringRef MangledTypeName, StringRef Category=StringRef()) const
bool isBlacklistedLocation(SanitizerMask Mask, SourceLocation Loc, StringRef Category=StringRef()) const
int Category
Definition: Format.cpp:1348
bool isBlacklistedFile(SanitizerMask Mask, StringRef FileName, StringRef Category=StringRef()) const
bool isBlacklistedFunction(SanitizerMask Mask, StringRef FunctionName) const
const SourceManager & SM
Definition: Format.cpp:1337
StringRef getFilename(SourceLocation SpellingLoc) const
Return the filename of the file containing a SourceLocation.
Encodes a location in the source.
SourceLocation getFileLoc(SourceLocation Loc) const
Given Loc, if it is a macro location return the expansion location or the spelling location...
Dataflow Directional Tag Classes.
uint64_t SanitizerMask
Definition: Sanitizers.h:24
bool isValid() const
Return true if this is a valid SourceLocation object.
bool isBlacklistedGlobal(SanitizerMask Mask, StringRef GlobalName, StringRef Category=StringRef()) const
SanitizerBlacklist(const std::vector< std::string > &BlacklistPaths, SourceManager &SM)
This class handles loading and caching of source files into memory.