Remove one of SanitizerBlacklist::isIn() overloads. NFC.

The final goal is to get rid of all the rest overloads that
accept LLVM objects (llvm::Function and llvm::GlobalVariable),
and pass in source-level entities instead.

llvm-svn: 219937
This commit is contained in:
Alexey Samsonov 2014-10-16 17:10:38 +00:00
parent 48c0440d97
commit 74246aaf89
2 changed files with 15 additions and 11 deletions

View File

@ -23,7 +23,6 @@
namespace llvm {
class GlobalVariable;
class Function;
class Module;
}
namespace clang {
@ -33,12 +32,13 @@ class SanitizerBlacklist {
public:
SanitizerBlacklist(const std::string &BlacklistPath);
bool isIn(const llvm::Module &M,
StringRef Category = StringRef()) const;
bool isIn(const llvm::Function &F) const;
bool isIn(const llvm::GlobalVariable &G,
StringRef Category = StringRef()) const;
bool isBlacklistedType(StringRef MangledTypeName) const;
bool isBlacklistedFunction(StringRef FunctionName) const;
bool isBlacklistedFile(StringRef FileName,
StringRef Category = StringRef()) const;
};
} // end namespace clang

View File

@ -32,19 +32,14 @@ static StringRef GetGlobalTypeString(const llvm::GlobalValue &G) {
SanitizerBlacklist::SanitizerBlacklist(const std::string &BlacklistPath)
: SCL(llvm::SpecialCaseList::createOrDie(BlacklistPath)) {}
bool SanitizerBlacklist::isIn(const llvm::Module &M,
StringRef Category) const {
return SCL->inSection("src", M.getModuleIdentifier(), Category);
}
bool SanitizerBlacklist::isIn(const llvm::Function &F) const {
return isIn(*F.getParent()) ||
SCL->inSection("fun", F.getName(), "");
return isBlacklistedFile(F.getParent()->getModuleIdentifier()) ||
isBlacklistedFunction(F.getName());
}
bool SanitizerBlacklist::isIn(const llvm::GlobalVariable &G,
StringRef Category) const {
return isIn(*G.getParent(), Category) ||
return isBlacklistedFile(G.getParent()->getModuleIdentifier(), Category) ||
SCL->inSection("global", G.getName(), Category) ||
SCL->inSection("type", GetGlobalTypeString(G), Category);
}
@ -52,3 +47,12 @@ bool SanitizerBlacklist::isIn(const llvm::GlobalVariable &G,
bool SanitizerBlacklist::isBlacklistedType(StringRef MangledTypeName) const {
return SCL->inSection("type", MangledTypeName);
}
bool SanitizerBlacklist::isBlacklistedFunction(StringRef FunctionName) const {
return SCL->inSection("fun", FunctionName);
}
bool SanitizerBlacklist::isBlacklistedFile(StringRef FileName,
StringRef Category) const {
return SCL->inSection("src", FileName, Category);
}