aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/DebugInfo.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2011-07-19 19:41:54 +0000
committerDevang Patel <dpatel@apple.com>2011-07-19 19:41:54 +0000
commitcfa82a378df9a989330d06ca3daba44751962dd0 (patch)
tree1b9a499c085c579b16bbbe703ac95690f5681bf1 /llvm/lib/Analysis/DebugInfo.cpp
parent8a4fc74728147ee4b1e9a2a6bc24af0f28002d1a (diff)
downloadllvm-cfa82a378df9a989330d06ca3daba44751962dd0.zip
llvm-cfa82a378df9a989330d06ca3daba44751962dd0.tar.gz
llvm-cfa82a378df9a989330d06ca3daba44751962dd0.tar.bz2
Reapply r135457. This needs llvm-gcc change, that I forgot to check-in yesterday.
llvm-svn: 135504
Diffstat (limited to 'llvm/lib/Analysis/DebugInfo.cpp')
-rw-r--r--llvm/lib/Analysis/DebugInfo.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/DebugInfo.cpp b/llvm/lib/Analysis/DebugInfo.cpp
index b42e946..8fac3fb 100644
--- a/llvm/lib/Analysis/DebugInfo.cpp
+++ b/llvm/lib/Analysis/DebugInfo.cpp
@@ -111,7 +111,9 @@ Function *DIDescriptor::getFunctionField(unsigned Elt) const {
unsigned DIVariable::getNumAddrElements() const {
if (getVersion() <= llvm::LLVMDebugVersion8)
return DbgNode->getNumOperands()-6;
- return DbgNode->getNumOperands()-7;
+ if (getVersion() == llvm::LLVMDebugVersion9)
+ return DbgNode->getNumOperands()-7;
+ return DbgNode->getNumOperands()-8;
}
@@ -760,6 +762,19 @@ NamedMDNode *llvm::getOrInsertFnSpecificMDNode(Module &M, StringRef FuncName) {
return M.getOrInsertNamedMetadata(Name.str());
}
+/// createInlinedVariable - Create a new inlined variable based on current
+/// variable.
+/// @param DV Current Variable.
+/// @param InlinedScope Location at current variable is inlined.
+DIVariable llvm::createInlinedVariable(MDNode *DV, MDNode *InlinedScope,
+ LLVMContext &VMContext) {
+ SmallVector<Value *, 16> Elts;
+ // Insert inlined scope as 7th element.
+ for (unsigned i = 0, e = DV->getNumOperands(); i != e; ++i)
+ i == 7 ? Elts.push_back(InlinedScope) :
+ Elts.push_back(DV->getOperand(i));
+ return DIVariable(MDNode::get(VMContext, Elts));
+}
//===----------------------------------------------------------------------===//
// DebugInfoFinder implementations.