Reapply r135457. This needs llvm-gcc change, that I forgot to check-in yesterday.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135504 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel
2011-07-19 19:41:54 +00:00
parent ffa3225e26
commit 23336b449e
4 changed files with 32 additions and 5 deletions

View File

@@ -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.