From: Alexey Samsonov Date: Thu, 16 Oct 2014 17:10:38 +0000 (+0000) Subject: Remove one of SanitizerBlacklist::isIn() overloads. NFC. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=74246aaf89fc596dd018c63365d894d0fc4abe42;p=platform%2Fupstream%2Fllvm.git 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 --- diff --git a/clang/include/clang/Basic/SanitizerBlacklist.h b/clang/include/clang/Basic/SanitizerBlacklist.h index b9a5dcb..7ea778e 100644 --- a/clang/include/clang/Basic/SanitizerBlacklist.h +++ b/clang/include/clang/Basic/SanitizerBlacklist.h @@ -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 diff --git a/clang/lib/Basic/SanitizerBlacklist.cpp b/clang/lib/Basic/SanitizerBlacklist.cpp index 05dec8b5..7627bd0 100644 --- a/clang/lib/Basic/SanitizerBlacklist.cpp +++ b/clang/lib/Basic/SanitizerBlacklist.cpp @@ -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); +}