mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
Add utility routine to create subprogram definition entry from subprogram declaration entry.
llvm-svn: 90282
This commit is contained in:
parent
190698f233
commit
122acaf238
@ -567,6 +567,10 @@ namespace llvm {
|
||||
DIType Type, bool isLocalToUnit,
|
||||
bool isDefinition);
|
||||
|
||||
/// CreateSubprogramDefinition - Create new subprogram descriptor for the
|
||||
/// given declaration.
|
||||
DISubprogram CreateSubprogramDefinition(DISubprogram &SPDeclaration);
|
||||
|
||||
/// CreateGlobalVariable - Create a new descriptor for the specified global.
|
||||
DIGlobalVariable
|
||||
CreateGlobalVariable(DIDescriptor Context, StringRef Name,
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user