Remove one of SanitizerBlacklist::isIn() overloads. NFC.
authorAlexey Samsonov <vonosmas@gmail.com>
Thu, 16 Oct 2014 17:10:38 +0000 (17:10 +0000)
committerAlexey Samsonov <vonosmas@gmail.com>
Thu, 16 Oct 2014 17:10:38 +0000 (17:10 +0000)
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

clang/include/clang/Basic/SanitizerBlacklist.h
clang/lib/Basic/SanitizerBlacklist.cpp

index b9a5dcb..7ea778e 100644 (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
index 05dec8b..7627bd0 100644 (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);
+}