summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/IRForTarget.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2013-03-23 01:01:16 +0000
committerSean Callanan <scallanan@apple.com>2013-03-23 01:01:16 +0000
commit719a4d5d8385b8565ef5262725df8a1474380ed7 (patch)
treeb041c3c3d8d6391264b07afa01c62e16b8491f57 /lldb/source/Expression/IRForTarget.cpp
parentb9d8890bd900416f562192608bdc72143801845b (diff)
downloadbcm5719-llvm-719a4d5d8385b8565ef5262725df8a1474380ed7.tar.gz
bcm5719-llvm-719a4d5d8385b8565ef5262725df8a1474380ed7.zip
If there are multiple uses of an Objective-C
class symbol in the same expression, handle all of them instead of just the first one. <rdar://problem/13440133> llvm-svn: 177794
Diffstat (limited to 'lldb/source/Expression/IRForTarget.cpp')
-rw-r--r--lldb/source/Expression/IRForTarget.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/lldb/source/Expression/IRForTarget.cpp b/lldb/source/Expression/IRForTarget.cpp
index 279e034d832..b158732c741 100644
--- a/lldb/source/Expression/IRForTarget.cpp
+++ b/lldb/source/Expression/IRForTarget.cpp
@@ -1814,17 +1814,17 @@ IRForTarget::HandleObjCClass(Value *classlist_reference)
if (global_variable->use_begin() == global_variable->use_end())
return false;
- LoadInst *load_instruction = NULL;
-
+ SmallVector<LoadInst *, 2> load_instructions;
+
for (Value::use_iterator i = global_variable->use_begin(), e = global_variable->use_end();
i != e;
++i)
{
- if ((load_instruction = dyn_cast<LoadInst>(*i)))
- break;
+ if (LoadInst *load_instruction = dyn_cast<LoadInst>(*i))
+ load_instructions.push_back(load_instruction);
}
- if (!load_instruction)
+ if (load_instructions.empty())
return false;
IntegerType *intptr_ty = Type::getIntNTy(m_module->getContext(),
@@ -1832,11 +1832,15 @@ IRForTarget::HandleObjCClass(Value *classlist_reference)
== Module::Pointer64) ? 64 : 32);
Constant *class_addr = ConstantInt::get(intptr_ty, (uint64_t)class_ptr);
- Constant *class_bitcast = ConstantExpr::getIntToPtr(class_addr, load_instruction->getType());
- load_instruction->replaceAllUsesWith(class_bitcast);
+ for (LoadInst *load_instruction : load_instructions)
+ {
+ Constant *class_bitcast = ConstantExpr::getIntToPtr(class_addr, load_instruction->getType());
+
+ load_instruction->replaceAllUsesWith(class_bitcast);
- load_instruction->eraseFromParent();
+ load_instruction->eraseFromParent();
+ }
return true;
}
OpenPOWER on IntegriCloud