summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1f85736)
raw | patch | inline | side by side (parent: 1f85736)
author | Alexey Samsonov <samsonov@google.com> | |
Mon, 12 Aug 2013 11:46:09 +0000 (11:46 +0000) | ||
committer | Alexey Samsonov <samsonov@google.com> | |
Mon, 12 Aug 2013 11:46:09 +0000 (11:46 +0000) |
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188169 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/llvm/Transforms/Utils/SpecialCaseList.h b/include/llvm/Transforms/Utils/SpecialCaseList.h
index 36ee604a1a61693fb3019235347b0581bf6523b2..34396fd34b4aa4002bc93ff189a41509fb0707c3 100644 (file)
/// Parses the special case list from a memory buffer. On failure, returns
/// 0 and writes an error message to string.
static SpecialCaseList *create(const MemoryBuffer *MB, std::string &Error);
+ /// Parses the special case list from a file. On failure, reports a fatal
+ /// error.
+ static SpecialCaseList *createOrDie(const StringRef Path);
~SpecialCaseList();
diff --git a/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index 755652201775c471c4126d22bf1d0454fe5923d5..2ee3e010373e877d0b93232ee61b420bb4ab7b33 100644 (file)
TD = getAnalysisIfAvailable<DataLayout>();
if (!TD)
return false;
- BL.reset(new SpecialCaseList(BlacklistFile));
+ BL.reset(SpecialCaseList::createOrDie(BlacklistFile));
if (BL->isIn(M)) return false;
C = &(M.getContext());
int LongSize = TD->getPointerSizeInBits();
if (!TD)
return false;
- BL.reset(new SpecialCaseList(BlacklistFile));
+ BL.reset(SpecialCaseList::createOrDie(BlacklistFile));
DynamicallyInitializedGlobals.Init(M);
C = &(M.getContext());
diff --git a/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp b/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
index 0bbbfefe9aed93a1654202ee373cd3812aefce51..f5531e00676ccd43fd304b3993eb5d7a062979fe 100644 (file)
Constant *DFSanUnionFn;
Constant *DFSanUnionLoadFn;
MDNode *ColdCallWeights;
- SpecialCaseList Greylist;
+ OwningPtr<SpecialCaseList> Greylist;
DenseMap<Value *, Function *> UnwrappedFnMap;
Value *getShadowAddress(Value *Addr, Instruction *Pos);
DataFlowSanitizer::DataFlowSanitizer(void *(*getArgTLS)(),
void *(*getRetValTLS)())
: ModulePass(ID), GetArgTLSPtr(getArgTLS), GetRetvalTLSPtr(getRetValTLS),
- Greylist(ClGreylistFile) {}
+ Greylist(SpecialCaseList::createOrDie(ClGreylistFile)) {}
FunctionType *DataFlowSanitizer::getInstrumentedFunctionType(FunctionType *T) {
llvm::SmallVector<Type *, 4> ArgTypes;
DataFlowSanitizer::InstrumentedABI
DataFlowSanitizer::getInstrumentedABI(Function *F) {
- if (Greylist.isIn(*F))
+ if (Greylist->isIn(*F))
return IA_MemOnly;
else
return getDefaultInstrumentedABI();
diff --git a/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/lib/Transforms/Instrumentation/MemorySanitizer.cpp
index 0251f16af4eadc47b0bb923f70215b2114cd12f7..a78213de7b3bf5198c4a2cc571ac6e4f3dc880b6 100644 (file)
TD = getAnalysisIfAvailable<DataLayout>();
if (!TD)
return false;
- BL.reset(new SpecialCaseList(BlacklistFile));
+ BL.reset(SpecialCaseList::createOrDie(BlacklistFile));
C = &(M.getContext());
unsigned PtrSize = TD->getPointerSizeInBits(/* AddressSpace */0);
switch (PtrSize) {
diff --git a/lib/Transforms/Instrumentation/ThreadSanitizer.cpp b/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
index cc971a38b20dd1746b45b68891b79eee3b31351b..e19ceba4d1669963e9af84fd53204e3be7d1e624 100644 (file)
TD = getAnalysisIfAvailable<DataLayout>();
if (!TD)
return false;
- BL.reset(new SpecialCaseList(BlacklistFile));
+ BL.reset(SpecialCaseList::createOrDie(BlacklistFile));
// Always insert a call to __tsan_init into the module's CTORs.
IRBuilder<> IRB(M.getContext());
index 5a3b192bf6ad3f5c3b3943bfccd9dcc541be6788..5ddaabafc23dd36a99cd0b0a52ace2f67a384096 100644 (file)
return SCL.take();
}
+SpecialCaseList *SpecialCaseList::createOrDie(const StringRef Path) {
+ std::string Error;
+ if (SpecialCaseList *SCL = create(Path, Error))
+ return SCL;
+ report_fatal_error(Error);
+}
+
bool SpecialCaseList::parse(const MemoryBuffer *MB, std::string &Error) {
// Iterate through each line in the blacklist file.
SmallVector<StringRef, 16> Lines;