diff options
author | Devang Patel <dpatel@apple.com> | 2009-12-01 23:09:02 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-12-01 23:09:02 +0000 |
commit | e3a18de4f66a90040fb67495578652e36a886af5 (patch) | |
tree | 4fc414a248fc470da1020c386c397d3309614595 /lib/Analysis/DebugInfo.cpp | |
parent | 7d0750a10fac5c00f00b465d8633d00fe76d9a2c (diff) |
Add utility routine to create subprogram definition entry from subprogram declaration entry.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90282 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DebugInfo.cpp')
-rw-r--r-- | lib/Analysis/DebugInfo.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp index 41d803c699..b1eff9efe1 100644 --- a/lib/Analysis/DebugInfo.cpp +++ b/lib/Analysis/DebugInfo.cpp @@ -884,6 +884,29 @@ DISubprogram DIFactory::CreateSubprogram(DIDescriptor Context, return DISubprogram(MDNode::get(VMContext, &Elts[0], 11)); } +/// CreateSubprogramDefinition - Create new subprogram descriptor for the +/// given declaration. +DISubprogram DIFactory::CreateSubprogramDefinition(DISubprogram &SPDeclaration) { + if (SPDeclaration.isDefinition()) + return DISubprogram(SPDeclaration.getNode()); + + MDNode *DeclNode = SPDeclaration.getNode(); + Value *Elts[] = { + GetTagConstant(dwarf::DW_TAG_subprogram), + llvm::Constant::getNullValue(Type::getInt32Ty(VMContext)), + DeclNode->getElement(2), // Context + DeclNode->getElement(3), // Name + DeclNode->getElement(4), // DisplayName + DeclNode->getElement(5), // LinkageName + DeclNode->getElement(6), // CompileUnit + DeclNode->getElement(7), // LineNo + DeclNode->getElement(8), // Type + DeclNode->getElement(9), // isLocalToUnit + ConstantInt::get(Type::getInt1Ty(VMContext), true) + }; + return DISubprogram(MDNode::get(VMContext, &Elts[0], 11)); +} + /// CreateGlobalVariable - Create a new descriptor for the specified global. DIGlobalVariable DIFactory::CreateGlobalVariable(DIDescriptor Context, StringRef Name, |