[llvm] r229740 - IR: Drop the scope in DI template parameters
Duncan P. N. Exon Smith
dexonsmith at apple.com
Wed Feb 18 12:30:45 PST 2015
Author: dexonsmith
Date: Wed Feb 18 14:30:45 2015
New Revision: 229740
URL: http://llvm.org/viewvc/llvm-project?rev=229740&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/IR/DebugInfo.h
llvm/trunk/lib/IR/DIBuilder.cpp
llvm/trunk/lib/IR/DebugInfo.cpp
Modified: llvm/trunk/include/llvm/IR/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfo.h?rev=229740&r1=229739&r2=229740&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/IR/DebugInfo.h Wed Feb 18 14:30:45 2015
@@ -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;
Modified: llvm/trunk/lib/IR/DIBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DIBuilder.cpp?rev=229740&r1=229739&r2=229740&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DIBuilder.cpp (original)
+++ llvm/trunk/lib/IR/DIBuilder.cpp Wed Feb 18 14:30:45 2015
@@ -503,13 +503,14 @@ DIBuilder::createObjCProperty(StringRef
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));
}
Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=229740&r1=229739&r2=229740&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Wed Feb 18 14:30:45 2015
@@ -1117,11 +1117,9 @@ void DebugInfoFinder::processSubprogram(
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));
}
}
More information about the llvm-commits
mailing list