diff options
author | Bill Wendling <isanbard@gmail.com> | 2013-06-04 04:40:03 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2013-06-04 04:40:03 +0000 |
commit | 156dd00656513fb832983f6b3a6e54f5c9b6f0f3 (patch) | |
tree | 905dd196a7d63961219624ef657696c8fc5baf47 | |
parent | c89859f46c385b908f9adfad934862e52a7bb805 (diff) | |
download | llvm-156dd00656513fb832983f6b3a6e54f5c9b6f0f3.zip llvm-156dd00656513fb832983f6b3a6e54f5c9b6f0f3.tar.gz llvm-156dd00656513fb832983f6b3a6e54f5c9b6f0f3.tar.bz2 |
Merging r183153:llvmorg-3.3.0-rc3
------------------------------------------------------------------------
r183153 | dmalea | 2013-06-03 13:45:54 -0700 (Mon, 03 Jun 2013) | 7 lines
Fix crash (in optimized builds) due to invalid metadata operand
- ConstantDataArray is not a valid MDNode operand
- encode function-name strings in metadata by wrapping in an MDString instead
- should resolve reported by http://llvm-jenkins.debian.net/job/llvm-toolchain-quantal-binaries/architecture=amd64,distribution=quantal/173/
------------------------------------------------------------------------
llvm-svn: 183191
-rw-r--r-- | lldb/source/Expression/IRDynamicChecks.cpp | 15 | ||||
-rw-r--r-- | lldb/source/Expression/IRForTarget.cpp | 10 |
2 files changed, 8 insertions, 17 deletions
diff --git a/lldb/source/Expression/IRDynamicChecks.cpp b/lldb/source/Expression/IRDynamicChecks.cpp index c2515c9..4030f14 100644 --- a/lldb/source/Expression/IRDynamicChecks.cpp +++ b/lldb/source/Expression/IRDynamicChecks.cpp @@ -517,23 +517,16 @@ private: return false; } - ConstantDataArray *real_name = dyn_cast<ConstantDataArray>(metadata->getOperand(0)); + MDString *real_name = dyn_cast<MDString>(metadata->getOperand(0)); if (!real_name) { if (log) - log->Printf("Function call metadata is not a ConstantArray for [%p] %s", call_inst, PrintValue(call_inst).c_str()); + log->Printf("Function call metadata is not an MDString for [%p] %s", call_inst, PrintValue(call_inst).c_str()); return false; } - - if (!real_name->isString()) - { - if (log) - log->Printf("Function call metadata is not a string for [%p] %s", call_inst, PrintValue(call_inst).c_str()); - return false; - } - - std::string name_str = real_name->getAsString(); + + std::string name_str = real_name->getString(); const char* name_cstr = name_str.c_str(); if (log) diff --git a/lldb/source/Expression/IRForTarget.cpp b/lldb/source/Expression/IRForTarget.cpp index 778c6c0..65ff324 100644 --- a/lldb/source/Expression/IRForTarget.cpp +++ b/lldb/source/Expression/IRForTarget.cpp @@ -337,12 +337,10 @@ IRForTarget::RegisterFunctionMetadata(LLVMContext &context, if (Instruction *user_inst = dyn_cast<Instruction>(user)) { - Constant *name_array = ConstantDataArray::getString(context, StringRef(name)); - - ArrayRef<Value *> md_values(name_array); - - MDNode *metadata = MDNode::get(context, md_values); - + MDString* md_name = MDString::get(context, StringRef(name)); + + MDNode *metadata = MDNode::get(context, md_name); + user_inst->setMetadata("lldb.call.realName", metadata); } else |