From 8f6c040948bafd7dcfb5d14bd577cd468d1220da Mon Sep 17 00:00:00 2001 From: Will Dietz Date: Fri, 18 Jan 2013 11:29:21 +0000 Subject: [PATCH] Move Blacklist.h to include/ to enable use from clang. llvm-svn: 172806 --- .../llvm/Transforms/Utils}/BlackList.h | 10 +++++----- .../Instrumentation/AddressSanitizer.cpp | 2 +- lib/Transforms/Instrumentation/BlackList.cpp | 19 ++++++++++--------- .../Instrumentation/MemorySanitizer.cpp | 2 +- .../Instrumentation/ThreadSanitizer.cpp | 2 +- 5 files changed, 18 insertions(+), 17 deletions(-) rename {lib/Transforms/Instrumentation => include/llvm/Transforms/Utils}/BlackList.h (91%) diff --git a/lib/Transforms/Instrumentation/BlackList.h b/include/llvm/Transforms/Utils/BlackList.h similarity index 91% rename from lib/Transforms/Instrumentation/BlackList.h rename to include/llvm/Transforms/Utils/BlackList.h index ee18a985674..f19470e19d8 100644 --- a/lib/Transforms/Instrumentation/BlackList.h +++ b/include/llvm/Transforms/Utils/BlackList.h @@ -42,17 +42,17 @@ class BlackList { public: BlackList(const StringRef Path); // Returns whether either this function or it's source file are blacklisted. - bool isIn(const Function &F); + bool isIn(const Function &F) const; // Returns whether either this global or it's source file are blacklisted. - bool isIn(const GlobalVariable &G); + bool isIn(const GlobalVariable &G) const; // Returns whether this module is blacklisted by filename. - bool isIn(const Module &M); + bool isIn(const Module &M) const; // Returns whether a global should be excluded from initialization checking. - bool isInInit(const GlobalVariable &G); + bool isInInit(const GlobalVariable &G) const; private: StringMap Entries; - bool inSection(const StringRef Section, const StringRef Query); + bool inSection(const StringRef Section, const StringRef Query) const; }; } // namespace llvm diff --git a/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/lib/Transforms/Instrumentation/AddressSanitizer.cpp index e733500c976..1aad842bcbc 100644 --- a/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -16,7 +16,7 @@ #define DEBUG_TYPE "asan" #include "llvm/Transforms/Instrumentation.h" -#include "BlackList.h" +#include "llvm/Transforms/Utils/BlackList.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DepthFirstIterator.h" diff --git a/lib/Transforms/Instrumentation/BlackList.cpp b/lib/Transforms/Instrumentation/BlackList.cpp index 4fcbea4117a..d6b29833b61 100644 --- a/lib/Transforms/Instrumentation/BlackList.cpp +++ b/lib/Transforms/Instrumentation/BlackList.cpp @@ -13,7 +13,8 @@ // //===----------------------------------------------------------------------===// -#include "BlackList.h" +#include "llvm/Transforms/Utils/BlackList.h" + #include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringExtras.h" @@ -78,21 +79,21 @@ BlackList::BlackList(const StringRef Path) { } // Iterate through each of the prefixes, and create Regexs for them. - for (StringMap::iterator I = Regexps.begin(), E = Regexps.end(); - I != E; ++I) { + for (StringMap::const_iterator I = Regexps.begin(), + E = Regexps.end(); I != E; ++I) { Entries[I->getKey()] = new Regex(I->getValue()); } } -bool BlackList::isIn(const Function &F) { +bool BlackList::isIn(const Function &F) const { return isIn(*F.getParent()) || inSection("fun", F.getName()); } -bool BlackList::isIn(const GlobalVariable &G) { +bool BlackList::isIn(const GlobalVariable &G) const { return isIn(*G.getParent()) || inSection("global", G.getName()); } -bool BlackList::isIn(const Module &M) { +bool BlackList::isIn(const Module &M) const { return inSection("src", M.getModuleIdentifier()); } @@ -107,14 +108,14 @@ static StringRef GetGVTypeString(const GlobalVariable &G) { return ""; } -bool BlackList::isInInit(const GlobalVariable &G) { +bool BlackList::isInInit(const GlobalVariable &G) const { return (isIn(*G.getParent()) || inSection("global-init", G.getName()) || inSection("global-init-type", GetGVTypeString(G))); } -bool BlackList::inSection(const StringRef Section, const StringRef Query) { - StringMap::iterator I = Entries.find(Section); +bool BlackList::inSection(const StringRef Section, const StringRef Query) const { + StringMap::const_iterator I = Entries.find(Section); if (I == Entries.end()) return false; Regex *FunctionRegex = I->getValue(); diff --git a/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/lib/Transforms/Instrumentation/MemorySanitizer.cpp index db0de4d797e..2d8ca67b104 100644 --- a/lib/Transforms/Instrumentation/MemorySanitizer.cpp +++ b/lib/Transforms/Instrumentation/MemorySanitizer.cpp @@ -71,7 +71,7 @@ #define DEBUG_TYPE "msan" #include "llvm/Transforms/Instrumentation.h" -#include "BlackList.h" +#include "llvm/Transforms/Utils/BlackList.h" #include "llvm/ADT/DepthFirstIterator.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" diff --git a/lib/Transforms/Instrumentation/ThreadSanitizer.cpp b/lib/Transforms/Instrumentation/ThreadSanitizer.cpp index 29d2ece7d78..463ca66ca19 100644 --- a/lib/Transforms/Instrumentation/ThreadSanitizer.cpp +++ b/lib/Transforms/Instrumentation/ThreadSanitizer.cpp @@ -22,7 +22,7 @@ #define DEBUG_TYPE "tsan" #include "llvm/Transforms/Instrumentation.h" -#include "BlackList.h" +#include "llvm/Transforms/Utils/BlackList.h" #include "llvm/ADT/SmallSet.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h"