diff --git a/llvm/include/llvm/Transforms/Utils/SpecialCaseList.h b/llvm/include/llvm/Transforms/Utils/SpecialCaseList.h index 42d9735c5a76..30e3e46ef5f9 100644 --- a/llvm/include/llvm/Transforms/Utils/SpecialCaseList.h +++ b/llvm/include/llvm/Transforms/Utils/SpecialCaseList.h @@ -35,6 +35,7 @@ namespace llvm { class Function; class GlobalVariable; +class MemoryBuffer; class Module; class Regex; class StringRef; @@ -42,6 +43,8 @@ class StringRef; class SpecialCaseList { public: SpecialCaseList(const StringRef Path); + SpecialCaseList(const MemoryBuffer *MB); + // 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. @@ -53,6 +56,7 @@ class SpecialCaseList { private: StringMap Entries; + void init(const MemoryBuffer *MB); bool inSection(const StringRef Section, const StringRef Query) const; }; diff --git a/llvm/lib/Transforms/Utils/SpecialCaseList.cpp b/llvm/lib/Transforms/Utils/SpecialCaseList.cpp index a1083e361166..8f6802ba0231 100644 --- a/llvm/lib/Transforms/Utils/SpecialCaseList.cpp +++ b/llvm/lib/Transforms/Utils/SpecialCaseList.cpp @@ -39,9 +39,17 @@ SpecialCaseList::SpecialCaseList(const StringRef Path) { EC.message()); } + init(File.get()); +} + +SpecialCaseList::SpecialCaseList(const MemoryBuffer *MB) { + init(MB); +} + +void SpecialCaseList::init(const MemoryBuffer *MB) { // Iterate through each line in the blacklist file. SmallVector Lines; - SplitString(File.take()->getBuffer(), Lines, "\n\r"); + SplitString(MB->getBuffer(), Lines, "\n\r"); StringMap Regexps; for (SmallVectorImpl::iterator I = Lines.begin(), E = Lines.end(); I != E; ++I) {