1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

Add support for DW_TAG_unspecified_parameters.

llvm-svn: 115833
This commit is contained in:
Devang Patel 2010-10-06 20:50:40 +00:00
parent 54490de165
commit eeb0b64560
3 changed files with 34 additions and 7 deletions

View File

@ -119,6 +119,7 @@ namespace llvm {
bool isEnumerator() const; bool isEnumerator() const;
bool isType() const; bool isType() const;
bool isGlobal() const; bool isGlobal() const;
bool isUnspecifiedParameter() const;
}; };
/// DISubrange - This is used to represent ranges, for array bounds. /// DISubrange - This is used to represent ranges, for array bounds.
@ -626,6 +627,10 @@ namespace llvm {
/// implicitly uniques the values returned. /// implicitly uniques the values returned.
DISubrange GetOrCreateSubrange(int64_t Lo, int64_t Hi); DISubrange GetOrCreateSubrange(int64_t Lo, int64_t Hi);
/// CreateUnspecifiedParameter - Create unspeicified type descriptor
/// for a subroutine type.
DIDescriptor CreateUnspecifiedParameter();
/// CreateCompileUnit - Create a new descriptor for the specified compile /// CreateCompileUnit - Create a new descriptor for the specified compile
/// unit. /// unit.
DICompileUnit CreateCompileUnit(unsigned LangID, DICompileUnit CreateCompileUnit(unsigned LangID,

View File

@ -199,6 +199,12 @@ bool DIDescriptor::isGlobal() const {
return isGlobalVariable(); return isGlobalVariable();
} }
/// isUnspecifiedParmeter - Return true if the specified tab is
/// DW_TAG_unspecified_parameters.
bool DIDescriptor::isUnspecifiedParameter() const {
return DbgNode && getTag() == dwarf::DW_TAG_unspecified_parameters;
}
/// isScope - Return true if the specified tag is one of the scope /// isScope - Return true if the specified tag is one of the scope
/// related tag. /// related tag.
bool DIDescriptor::isScope() const { bool DIDescriptor::isScope() const {
@ -724,7 +730,14 @@ DISubrange DIFactory::GetOrCreateSubrange(int64_t Lo, int64_t Hi) {
return DISubrange(MDNode::get(VMContext, &Elts[0], 3)); return DISubrange(MDNode::get(VMContext, &Elts[0], 3));
} }
/// CreateUnspecifiedParameter - Create unspeicified type descriptor
/// for the subroutine type.
DIDescriptor DIFactory::CreateUnspecifiedParameter() {
Value *Elts[] = {
GetTagConstant(dwarf::DW_TAG_unspecified_parameters)
};
return DIDescriptor(MDNode::get(VMContext, &Elts[0], 1));
}
/// CreateCompileUnit - Create a new descriptor for the specified compile /// CreateCompileUnit - Create a new descriptor for the specified compile
/// unit. Note that this does not unique compile units within the module. /// unit. Note that this does not unique compile units within the module.

View File

@ -1042,16 +1042,25 @@ void DwarfDebug::constructTypeDIE(DIE &Buffer, DICompositeType CTy) {
DIDescriptor RTy = Elements.getElement(0); DIDescriptor RTy = Elements.getElement(0);
addType(&Buffer, DIType(RTy)); addType(&Buffer, DIType(RTy));
// Add prototype flag. bool isPrototyped = true;
addUInt(&Buffer, dwarf::DW_AT_prototyped, dwarf::DW_FORM_flag, 1);
// Add arguments. // Add arguments.
for (unsigned i = 1, N = Elements.getNumElements(); i < N; ++i) { for (unsigned i = 1, N = Elements.getNumElements(); i < N; ++i) {
DIE *Arg = new DIE(dwarf::DW_TAG_formal_parameter);
DIDescriptor Ty = Elements.getElement(i); DIDescriptor Ty = Elements.getElement(i);
if (Ty.isUnspecifiedParameter()) {
DIE *Arg = new DIE(dwarf::DW_TAG_unspecified_parameters);
Buffer.addChild(Arg);
isPrototyped = false;
} else {
DIE *Arg = new DIE(dwarf::DW_TAG_formal_parameter);
addType(Arg, DIType(Ty)); addType(Arg, DIType(Ty));
Buffer.addChild(Arg); Buffer.addChild(Arg);
} }
}
// Add prototype flag.
if (isPrototyped)
addUInt(&Buffer, dwarf::DW_AT_prototyped, dwarf::DW_FORM_flag, 1);
} }
break; break;
case dwarf::DW_TAG_structure_type: case dwarf::DW_TAG_structure_type: