[Lldb-commits] [lldb] r186990 - Remove builtin attribute from calls whose targets we replace
Stefanus Du Toit
stefanus.du.toit at intel.com
Tue Jul 23 14:34:04 PDT 2013
Author: sdt
Date: Tue Jul 23 16:34:03 2013
New Revision: 186990
URL: http://llvm.org/viewvc/llvm-project?rev=186990&view=rev
Log:
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)").
Modified:
lldb/trunk/source/Expression/IRForTarget.cpp
Modified: lldb/trunk/source/Expression/IRForTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRForTarget.cpp?rev=186990&r1=186989&r2=186990&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRForTarget.cpp (original)
+++ lldb/trunk/source/Expression/IRForTarget.cpp Tue Jul 23 16:34:03 2013
@@ -356,6 +356,20 @@ IRForTarget::ResolveFunctionPointers(llv
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);
}
More information about the lldb-commits
mailing list