1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

IR: Drop the scope in DI template parameters

The scope/context is always the compile unit, which we replace with
`nullptr` anyway (via `getNonCompileUnitScope()`).  Drop it explicitly.

I noticed this field was always null while writing testcase upgrade
scripts to transition to the new hierarchy.  Seems wasteful to
transition it over if it's already out-of-use.

llvm-svn: 229740
This commit is contained in:
Duncan P. N. Exon Smith 2015-02-18 20:30:45 +00:00
parent 9c1b4f50b4
commit 4d3e316522
3 changed files with 6 additions and 8 deletions

View File

@ -732,7 +732,6 @@ public:
StringRef getName() const { return getHeaderField(1); }
DIScopeRef getContext() const { return getFieldAs<DIScopeRef>(1); }
DITypeRef getType() const { return getFieldAs<DITypeRef>(2); }
bool Verify() const;
};
@ -745,7 +744,6 @@ public:
StringRef getName() const { return getHeaderField(1); }
DIScopeRef getContext() const { return getFieldAs<DIScopeRef>(1); }
DITypeRef getType() const { return getFieldAs<DITypeRef>(2); }
Metadata *getValue() const;
bool Verify() const;

View File

@ -503,13 +503,14 @@ DIBuilder::createObjCProperty(StringRef Name, DIFile File, unsigned LineNumber,
DITemplateTypeParameter
DIBuilder::createTemplateTypeParameter(DIDescriptor Context, StringRef Name,
DIType Ty) {
assert(!DIScope(getNonCompileUnitScope(Context)).getRef() &&
"Expected compile unit");
Metadata *Elts[] = {HeaderBuilder::get(dwarf::DW_TAG_template_type_parameter)
.concat(Name)
.concat(0)
.concat(0)
.get(VMContext),
DIScope(getNonCompileUnitScope(Context)).getRef(),
Ty.getRef(), nullptr};
nullptr, Ty.getRef(), nullptr};
return DITemplateTypeParameter(MDNode::get(VMContext, Elts));
}
@ -517,10 +518,11 @@ static DITemplateValueParameter
createTemplateValueParameterHelper(LLVMContext &VMContext, unsigned Tag,
DIDescriptor Context, StringRef Name,
DIType Ty, Metadata *MD) {
assert(!DIScope(getNonCompileUnitScope(Context)).getRef() &&
"Expected compile unit");
Metadata *Elts[] = {
HeaderBuilder::get(Tag).concat(Name).concat(0).concat(0).get(VMContext),
DIScope(getNonCompileUnitScope(Context)).getRef(), Ty.getRef(), MD,
nullptr};
nullptr, Ty.getRef(), MD, nullptr};
return DITemplateValueParameter(MDNode::get(VMContext, Elts));
}

View File

@ -1117,11 +1117,9 @@ void DebugInfoFinder::processSubprogram(DISubprogram SP) {
DIDescriptor Element = TParams.getElement(I);
if (Element.isTemplateTypeParameter()) {
DITemplateTypeParameter TType(Element);
processScope(TType.getContext().resolve(TypeIdentifierMap));
processType(TType.getType().resolve(TypeIdentifierMap));
} else if (Element.isTemplateValueParameter()) {
DITemplateValueParameter TVal(Element);
processScope(TVal.getContext().resolve(TypeIdentifierMap));
processType(TVal.getType().resolve(TypeIdentifierMap));
}
}