diff options
author | Hans Wennborg <hans@hanshq.net> | 2017-04-28 23:01:32 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2017-04-28 23:01:32 +0000 |
commit | 0f88d863b477afef36f02fd11a96abd9eb5563a5 (patch) | |
tree | 564f3c06fa76fd25d150342cb55ba3f8785e5421 /llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp | |
parent | e0f9e984fd7e6c02016b16eb355e788a645091ee (diff) | |
download | bcm5719-llvm-0f88d863b477afef36f02fd11a96abd9eb5563a5.tar.gz bcm5719-llvm-0f88d863b477afef36f02fd11a96abd9eb5563a5.zip |
Revert r301697 "[IR] Make add/remove Attributes use AttrBuilder instead of AttributeList"
This broke the Clang build. (Clang-side patch missing?)
Original commit message:
> [IR] Make add/remove Attributes use AttrBuilder instead of
> AttributeList
>
> This change cleans up call sites and avoids creating temporary
> AttributeList objects.
>
> NFC
llvm-svn: 301712
Diffstat (limited to 'llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp')
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp index 9fe6f87d4fb..4e454f0c95b 100644 --- a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp @@ -254,7 +254,7 @@ class DataFlowSanitizer : public ModulePass { MDNode *ColdCallWeights; DFSanABIList ABIList; DenseMap<Value *, Function *> UnwrappedFnMap; - AttrBuilder ReadOnlyNoneAttrs; + AttributeList ReadOnlyNoneAttrs; bool DFSanRuntimeShadowMask; Value *getShadowAddress(Value *Addr, Instruction *Pos); @@ -544,12 +544,16 @@ DataFlowSanitizer::buildWrapperFunction(Function *F, StringRef NewFName, NewF->copyAttributesFrom(F); NewF->removeAttributes( AttributeList::ReturnIndex, - AttributeFuncs::typeIncompatible(NewFT->getReturnType())); + AttributeList::get( + F->getContext(), AttributeList::ReturnIndex, + AttributeFuncs::typeIncompatible(NewFT->getReturnType()))); BasicBlock *BB = BasicBlock::Create(*Ctx, "entry", NewF); if (F->isVarArg()) { - NewF->removeAttributes(AttributeList::FunctionIndex, - AttrBuilder().addAttribute("split-stack")); + NewF->removeAttributes( + AttributeList::FunctionIndex, + AttributeList().addAttribute(*Ctx, AttributeList::FunctionIndex, + "split-stack")); CallInst::Create(DFSanVarargWrapperFn, IRBuilder<>(BB).CreateGlobalStringPtr(F->getName()), "", BB); @@ -694,8 +698,9 @@ bool DataFlowSanitizer::runOnModule(Module &M) { } } - ReadOnlyNoneAttrs.addAttribute(Attribute::ReadOnly) - .addAttribute(Attribute::ReadNone); + AttrBuilder B; + B.addAttribute(Attribute::ReadOnly).addAttribute(Attribute::ReadNone); + ReadOnlyNoneAttrs = AttributeList::get(*Ctx, AttributeList::FunctionIndex, B); // First, change the ABI of every function in the module. ABI-listed // functions keep their original ABI and get a wrapper function. @@ -717,7 +722,9 @@ bool DataFlowSanitizer::runOnModule(Module &M) { NewF->copyAttributesFrom(&F); NewF->removeAttributes( AttributeList::ReturnIndex, - AttributeFuncs::typeIncompatible(NewFT->getReturnType())); + AttributeList::get( + NewF->getContext(), AttributeList::ReturnIndex, + AttributeFuncs::typeIncompatible(NewFT->getReturnType()))); for (Function::arg_iterator FArg = F.arg_begin(), NewFArg = NewF->arg_begin(), FArgEnd = F.arg_end(); |