diff options
author | Stefanus Du Toit <stefanus.du.toit@intel.com> | 2013-07-23 21:34:03 +0000 |
---|---|---|
committer | Stefanus Du Toit <stefanus.du.toit@intel.com> | 2013-07-23 21:34:03 +0000 |
commit | fc6b7a0e8a42370525852e47089b920ebd59cc32 (patch) | |
tree | 7345275aa5a4f67cc42da6fbf4f813f34223467a /lldb/source/Expression/IRForTarget.cpp | |
parent | 942c36bda2b3200e06651f661df9dbb61ef79d47 (diff) | |
download | bcm5719-llvm-fc6b7a0e8a42370525852e47089b920ebd59cc32.tar.gz bcm5719-llvm-fc6b7a0e8a42370525852e47089b920ebd59cc32.zip |
Remove builtin attribute from calls whose targets we replace
If we are replacing a function with the nobuiltin attribute, it may be called
with the builtin attribute on call sites. Remove any such attributes since it's
illegal to have a builtin call to something other than a nobuiltin function.
This fixes the current buildbot breakage (where LLDB crashes on
"expression new foo(42)").
llvm-svn: 186990
Diffstat (limited to 'lldb/source/Expression/IRForTarget.cpp')
-rw-r--r-- | lldb/source/Expression/IRForTarget.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lldb/source/Expression/IRForTarget.cpp b/lldb/source/Expression/IRForTarget.cpp index dc27b65548e..cac3fdf60df 100644 --- a/lldb/source/Expression/IRForTarget.cpp +++ b/lldb/source/Expression/IRForTarget.cpp @@ -356,6 +356,20 @@ IRForTarget::ResolveFunctionPointers(llvm::Module &llvm_module) if (value_ptr) *value_ptr = value; + + // If we are replacing a function with the nobuiltin attribute, it may + // be called with the builtin attribute on call sites. Remove any such + // attributes since it's illegal to have a builtin call to something + // other than a nobuiltin function. + if (fun->hasFnAttribute(Attribute::NoBuiltin)) { + Attribute builtin = Attribute::get(fun->getContext(), Attribute::Builtin); + + for (auto u = fun->use_begin(), e = fun->use_end(); u != e; ++u) { + if (auto call = dyn_cast<CallInst>(*u)) { + call->removeAttribute(AttributeSet::FunctionIndex, builtin); + } + } + } fun->replaceAllUsesWith(value); } |