[llvm] r193287 - Debug Info: code clean up.
Manman Ren
manman.ren at gmail.com
Wed Oct 23 16:05:28 PDT 2013
Author: mren
Date: Wed Oct 23 18:05:28 2013
New Revision: 193287
URL: http://llvm.org/viewvc/llvm-project?rev=193287&view=rev
Log:
Debug Info: code clean up.
Since we never insert DIE for DITemplateTypeParameter to a map, there is no need
to call getDIE in getOrCreateTemplateTypeParameterDIE. It is also renamed to
constructTemplateTypeParameterDIE to match with other construct functions
in CompileUnit.
Same applies to getOrCreateTemplateValueParameterDIE.
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=193287&r1=193286&r2=193287&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Wed Oct 23 18:05:28 2013
@@ -796,11 +796,11 @@ void CompileUnit::addTemplateParams(DIE
for (unsigned i = 0, e = TParams.getNumElements(); i != e; ++i) {
DIDescriptor Element = TParams.getElement(i);
if (Element.isTemplateTypeParameter())
- getOrCreateTemplateTypeParameterDIE(Buffer,
- DITemplateTypeParameter(Element));
+ constructTemplateTypeParameterDIE(Buffer,
+ DITemplateTypeParameter(Element));
else if (Element.isTemplateValueParameter())
- getOrCreateTemplateValueParameterDIE(Buffer,
- DITemplateValueParameter(Element));
+ constructTemplateValueParameterDIE(Buffer,
+ DITemplateValueParameter(Element));
}
}
@@ -1267,16 +1267,12 @@ void CompileUnit::constructTypeDIE(DIE &
DD->addTypeUnitType(&Buffer);
}
-/// getOrCreateTemplateTypeParameterDIE - Find existing DIE or create new DIE
-/// for the given DITemplateTypeParameter.
+/// constructTemplateTypeParameterDIE - Construct new DIE for the given
+/// DITemplateTypeParameter.
void
-CompileUnit::getOrCreateTemplateTypeParameterDIE(DIE &Buffer,
- DITemplateTypeParameter TP) {
- DIE *ParamDIE = getDIE(TP);
- if (ParamDIE)
- return;
-
- ParamDIE = new DIE(dwarf::DW_TAG_template_type_parameter);
+CompileUnit::constructTemplateTypeParameterDIE(DIE &Buffer,
+ DITemplateTypeParameter TP) {
+ DIE *ParamDIE = new DIE(dwarf::DW_TAG_template_type_parameter);
Buffer.addChild(ParamDIE);
// Add the type if it exists, it could be void and therefore no type.
if (TP.getType())
@@ -1285,16 +1281,12 @@ CompileUnit::getOrCreateTemplateTypePara
addString(ParamDIE, dwarf::DW_AT_name, TP.getName());
}
-/// getOrCreateTemplateValueParameterDIE - Find existing DIE or create new DIE
-/// for the given DITemplateValueParameter.
+/// constructTemplateValueParameterDIE - Construct new DIE for the given
+/// DITemplateValueParameter.
void
-CompileUnit::getOrCreateTemplateValueParameterDIE(DIE &Buffer,
- DITemplateValueParameter VP) {
- DIE *ParamDIE = getDIE(VP);
- if (ParamDIE)
- return;
-
- ParamDIE = new DIE(VP.getTag());
+CompileUnit::constructTemplateValueParameterDIE(DIE &Buffer,
+ DITemplateValueParameter VP) {
+ DIE *ParamDIE = new DIE(VP.getTag());
Buffer.addChild(ParamDIE);
// Add the type if there is one, template template and template parameter
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h?rev=193287&r1=193286&r2=193287&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h Wed Oct 23 18:05:28 2013
@@ -333,15 +333,15 @@ private:
/// constructMemberDIE - Construct member DIE from DIDerivedType.
void constructMemberDIE(DIE &Buffer, DIDerivedType DT);
- /// getOrCreateTemplateTypeParameterDIE - Find existing DIE or create new DIE
- /// for the given DITemplateTypeParameter.
- void getOrCreateTemplateTypeParameterDIE(DIE &Buffer,
- DITemplateTypeParameter TP);
+ /// constructTemplateTypeParameterDIE - Construct new DIE for the given
+ /// DITemplateTypeParameter.
+ void constructTemplateTypeParameterDIE(DIE &Buffer,
+ DITemplateTypeParameter TP);
- /// getOrCreateTemplateValueParameterDIE - Find existing DIE or create
- /// new DIE for the given DITemplateValueParameter.
- void getOrCreateTemplateValueParameterDIE(DIE &Buffer,
- DITemplateValueParameter TVP);
+ /// constructTemplateValueParameterDIE - Construct new DIE for the given
+ /// DITemplateValueParameter.
+ void constructTemplateValueParameterDIE(DIE &Buffer,
+ DITemplateValueParameter TVP);
/// getOrCreateStaticMemberDIE - Create new static data member DIE.
DIE *getOrCreateStaticMemberDIE(DIDerivedType DT);
More information about the llvm-commits
mailing list