summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2011-04-26 18:24:39 +0000
committerDevang Patel <dpatel@apple.com>2011-04-26 18:24:39 +0000
commitb5ea255fb4b33ccf9261d097d31698d0a21f65a8 (patch)
treefe8e42b4ce8db05dc9e155385975af610647d175 /llvm
parent6b4e26bee27900eaa3c94e8cef5458a991bb2c1d (diff)
downloadbcm5719-llvm-b5ea255fb4b33ccf9261d097d31698d0a21f65a8.tar.gz
bcm5719-llvm-b5ea255fb4b33ccf9261d097d31698d0a21f65a8.zip
Fix an off by one error while accessing complex address element of a DIVariable.
This worked untill now because stars are aligned (i.e. num of complex address elments are always 0 or 2+ and when it is 2+ at least two elements are access together) llvm-svn: 130225
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/Analysis/DebugInfo.h4
-rw-r--r--llvm/lib/Analysis/DIBuilder.cpp1
2 files changed, 4 insertions, 1 deletions
diff --git a/llvm/include/llvm/Analysis/DebugInfo.h b/llvm/include/llvm/Analysis/DebugInfo.h
index a5252aaab54..c6cc8f7665e 100644
--- a/llvm/include/llvm/Analysis/DebugInfo.h
+++ b/llvm/include/llvm/Analysis/DebugInfo.h
@@ -622,7 +622,9 @@ namespace llvm {
unsigned getNumAddrElements() const;
uint64_t getAddrElement(unsigned Idx) const {
- return getUInt64Field(Idx+6);
+ if (getVersion() <= llvm::LLVMDebugVersion8)
+ return getUInt64Field(Idx+6);
+ return getUInt64Field(Idx+7);
}
/// isBlockByrefVariable - Return true if the variable was declared as
diff --git a/llvm/lib/Analysis/DIBuilder.cpp b/llvm/lib/Analysis/DIBuilder.cpp
index 80d61520620..dc98c9e67a8 100644
--- a/llvm/lib/Analysis/DIBuilder.cpp
+++ b/llvm/lib/Analysis/DIBuilder.cpp
@@ -656,6 +656,7 @@ DIVariable DIBuilder::createComplexVariable(unsigned Tag, DIDescriptor Scope,
Elts.push_back(F);
Elts.push_back(ConstantInt::get(Type::getInt32Ty(VMContext), (LineNo | (ArgNo << 24))));
Elts.push_back(Ty);
+ Elts.push_back(llvm::Constant::getNullValue(Type::getInt32Ty(VMContext)));
Elts.append(Addr.begin(), Addr.end());
return DIVariable(MDNode::get(VMContext, Elts));
OpenPOWER on IntegriCloud