aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefanus Du Toit <stefanus.du.toit@intel.com>2013-07-23 21:34:03 +0000
committerStefanus Du Toit <stefanus.du.toit@intel.com>2013-07-23 21:34:03 +0000
commiteebd175a054e833c928462a91d7cb07c65b5e09d (patch)
tree1aeb0bb53c41ee28db78e522c55ee51f569c30ac
parent4514d505ac2ca9c2a05136fa3b586a867412b8ad (diff)
downloadlldb-eebd175a054e833c928462a91d7cb07c65b5e09d.tar.gz
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)"). git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@186990 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--source/Expression/IRForTarget.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/source/Expression/IRForTarget.cpp b/source/Expression/IRForTarget.cpp
index dc27b6554..cac3fdf60 100644
--- a/source/Expression/IRForTarget.cpp
+++ b/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);
}