diff --git a/llvm/include/llvm/Transforms/Utils/BlackList.h b/llvm/include/llvm/Transforms/Utils/SpecialCaseList.h similarity index 94% rename from llvm/include/llvm/Transforms/Utils/BlackList.h rename to llvm/include/llvm/Transforms/Utils/SpecialCaseList.h index 316b364845caf753ba0759cb9239843bbc829f41..42d9735c5a76448c350ed445a52b22a491aeb645 100644 --- a/llvm/include/llvm/Transforms/Utils/BlackList.h +++ b/llvm/include/llvm/Transforms/Utils/SpecialCaseList.h @@ -1,4 +1,4 @@ -//===-- BlackList.h - blacklist for sanitizers ------------------*- C++ -*-===// +//===-- SpecialCaseList.h - blacklist for sanitizers ------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -39,9 +39,9 @@ class Module; class Regex; class StringRef; -class BlackList { +class SpecialCaseList { public: - BlackList(const StringRef Path); + SpecialCaseList(const StringRef Path); // Returns whether either this function or it's source file are blacklisted. bool isIn(const Function &F) const; // Returns whether either this global or it's source file are blacklisted. diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp index 417fd76dc10bf3f26f5ea9f28c3c94b48c1d10f5..28c5622863bd9c2e4256cc8f6894ba417ad1c889 100644 --- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -43,10 +43,10 @@ #include "llvm/Support/raw_ostream.h" #include "llvm/Support/system_error.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" -#include "llvm/Transforms/Utils/BlackList.h" #include "llvm/Transforms/Utils/Cloning.h" #include "llvm/Transforms/Utils/Local.h" #include "llvm/Transforms/Utils/ModuleUtils.h" +#include "llvm/Transforms/Utils/SpecialCaseList.h" #include #include @@ -318,7 +318,7 @@ struct AddressSanitizer : public FunctionPass { Function *AsanCtorFunction; Function *AsanInitFunction; Function *AsanHandleNoReturnFunc; - OwningPtr BL; + OwningPtr BL; // This array is indexed by AccessIsWrite and log2(AccessSize). Function *AsanErrorCallback[2][kNumberOfAccessSizes]; // This array is indexed by AccessIsWrite. @@ -358,7 +358,7 @@ class AddressSanitizerModule : public ModulePass { SmallString<64> BlacklistFile; bool ZeroBaseShadow; - OwningPtr BL; + OwningPtr BL; SetOfDynamicallyInitializedGlobals DynamicallyInitializedGlobals; Type *IntptrTy; LLVMContext *C; @@ -880,7 +880,7 @@ bool AddressSanitizerModule::runOnModule(Module &M) { TD = getAnalysisIfAvailable(); if (!TD) return false; - BL.reset(new BlackList(BlacklistFile)); + BL.reset(new SpecialCaseList(BlacklistFile)); if (BL->isIn(M)) return false; C = &(M.getContext()); int LongSize = TD->getPointerSizeInBits(); @@ -1070,7 +1070,7 @@ bool AddressSanitizer::doInitialization(Module &M) { if (!TD) return false; - BL.reset(new BlackList(BlacklistFile)); + BL.reset(new SpecialCaseList(BlacklistFile)); DynamicallyInitializedGlobals.Init(M); C = &(M.getContext()); diff --git a/llvm/lib/Transforms/Instrumentation/CMakeLists.txt b/llvm/lib/Transforms/Instrumentation/CMakeLists.txt index aa265a49ed195589ee8426e0b1eb57656631a3f1..5e348633ca35c54b3ec8f296a36492170b4d8136 100644 --- a/llvm/lib/Transforms/Instrumentation/CMakeLists.txt +++ b/llvm/lib/Transforms/Instrumentation/CMakeLists.txt @@ -1,6 +1,5 @@ add_llvm_library(LLVMInstrumentation AddressSanitizer.cpp - BlackList.cpp BoundsChecking.cpp DebugIR.cpp EdgeProfiling.cpp diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp index 8e2baefd61230b214a0d7516b8a540c4505e4a43..0251f16af4eadc47b0bb923f70215b2114cd12f7 100644 --- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp @@ -91,9 +91,9 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" -#include "llvm/Transforms/Utils/BlackList.h" #include "llvm/Transforms/Utils/Local.h" #include "llvm/Transforms/Utils/ModuleUtils.h" +#include "llvm/Transforms/Utils/SpecialCaseList.h" using namespace llvm; @@ -232,7 +232,7 @@ class MemorySanitizer : public FunctionPass { /// \brief Path to blacklist file. SmallString<64> BlacklistFile; /// \brief The blacklist. - OwningPtr BL; + OwningPtr BL; /// \brief An empty volatile inline asm that prevents callback merge. InlineAsm *EmptyAsm; @@ -338,7 +338,7 @@ bool MemorySanitizer::doInitialization(Module &M) { TD = getAnalysisIfAvailable(); if (!TD) return false; - BL.reset(new BlackList(BlacklistFile)); + BL.reset(new SpecialCaseList(BlacklistFile)); C = &(M.getContext()); unsigned PtrSize = TD->getPointerSizeInBits(/* AddressSpace */0); switch (PtrSize) { diff --git a/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp index 318fa3fde364c8278c376aaed43d17262a1a1ccc..cc971a38b20dd1746b45b68891b79eee3b31351b 100644 --- a/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp @@ -41,8 +41,8 @@ #include "llvm/Support/MathExtras.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" -#include "llvm/Transforms/Utils/BlackList.h" #include "llvm/Transforms/Utils/ModuleUtils.h" +#include "llvm/Transforms/Utils/SpecialCaseList.h" using namespace llvm; @@ -99,7 +99,7 @@ struct ThreadSanitizer : public FunctionPass { DataLayout *TD; Type *IntptrTy; SmallString<64> BlacklistFile; - OwningPtr BL; + OwningPtr BL; IntegerType *OrdTy; // Callbacks to run-time library are computed in doInitialization. Function *TsanFuncEntry; @@ -227,7 +227,7 @@ bool ThreadSanitizer::doInitialization(Module &M) { TD = getAnalysisIfAvailable(); if (!TD) return false; - BL.reset(new BlackList(BlacklistFile)); + BL.reset(new SpecialCaseList(BlacklistFile)); // Always insert a call to __tsan_init into the module's CTORs. IRBuilder<> IRB(M.getContext()); diff --git a/llvm/lib/Transforms/Utils/CMakeLists.txt b/llvm/lib/Transforms/Utils/CMakeLists.txt index b71628bcb28ea26ac6a5c6704491fd4d6720b5eb..470cf343115cab4a580466feb29d18a88c2c1331 100644 --- a/llvm/lib/Transforms/Utils/CMakeLists.txt +++ b/llvm/lib/Transforms/Utils/CMakeLists.txt @@ -28,6 +28,7 @@ add_llvm_library(LLVMTransformUtils SimplifyIndVar.cpp SimplifyInstructions.cpp SimplifyLibCalls.cpp + SpecialCaseList.cpp UnifyFunctionExitNodes.cpp Utils.cpp ValueMapper.cpp diff --git a/llvm/lib/Transforms/Instrumentation/BlackList.cpp b/llvm/lib/Transforms/Utils/SpecialCaseList.cpp similarity index 88% rename from llvm/lib/Transforms/Instrumentation/BlackList.cpp rename to llvm/lib/Transforms/Utils/SpecialCaseList.cpp index ce3acbc98008f2ecc3f5b84e18ae577b03a147fc..a1083e361166e4b014708b14c3989019e809b632 100644 --- a/llvm/lib/Transforms/Instrumentation/BlackList.cpp +++ b/llvm/lib/Transforms/Utils/SpecialCaseList.cpp @@ -1,4 +1,4 @@ -//===-- BlackList.cpp - blacklist for sanitizers --------------------------===// +//===-- SpecialCaseList.cpp - blacklist for sanitizers --------------------===// // // The LLVM Compiler Infrastructure // @@ -13,7 +13,7 @@ // //===----------------------------------------------------------------------===// -#include "llvm/Transforms/Utils/BlackList.h" +#include "llvm/Transforms/Utils/SpecialCaseList.h" #include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringExtras.h" @@ -30,7 +30,7 @@ namespace llvm { -BlackList::BlackList(const StringRef Path) { +SpecialCaseList::SpecialCaseList(const StringRef Path) { // Validate and open blacklist file. if (Path.empty()) return; OwningPtr File; @@ -84,15 +84,15 @@ BlackList::BlackList(const StringRef Path) { } } -bool BlackList::isIn(const Function &F) const { +bool SpecialCaseList::isIn(const Function &F) const { return isIn(*F.getParent()) || inSection("fun", F.getName()); } -bool BlackList::isIn(const GlobalVariable &G) const { +bool SpecialCaseList::isIn(const GlobalVariable &G) const { return isIn(*G.getParent()) || inSection("global", G.getName()); } -bool BlackList::isIn(const Module &M) const { +bool SpecialCaseList::isIn(const Module &M) const { return inSection("src", M.getModuleIdentifier()); } @@ -107,15 +107,15 @@ static StringRef GetGVTypeString(const GlobalVariable &G) { return ""; } -bool BlackList::isInInit(const GlobalVariable &G) const { +bool SpecialCaseList::isInInit(const GlobalVariable &G) const { return (isIn(*G.getParent()) || inSection("global-init", G.getName()) || inSection("global-init-type", GetGVTypeString(G)) || inSection("global-init-src", G.getParent()->getModuleIdentifier())); } -bool BlackList::inSection(const StringRef Section, - const StringRef Query) const { +bool SpecialCaseList::inSection(const StringRef Section, + const StringRef Query) const { StringMap::const_iterator I = Entries.find(Section); if (I == Entries.end()) return false;