diff options
author | Devang Patel <dpatel@apple.com> | 2011-04-05 21:08:24 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2011-04-05 21:08:24 +0000 |
commit | b4c2bc25439bd4a226a85e1f3d8b420c07590622 (patch) | |
tree | b48c2769091c7cdb1ff9a25890c36cc74de3bafd | |
parent | 4359e5eccf1d0b7c1bf4f466c914ede09ddd3f9d (diff) | |
download | external_llvm-b4c2bc25439bd4a226a85e1f3d8b420c07590622.zip external_llvm-b4c2bc25439bd4a226a85e1f3d8b420c07590622.tar.gz external_llvm-b4c2bc25439bd4a226a85e1f3d8b420c07590622.tar.bz2 |
Refactor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128929 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 31 | ||||
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfDebug.h | 5 |
2 files changed, 21 insertions, 15 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 7fa4b6f..be5c206 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -930,6 +930,20 @@ bool DwarfDebug::addConstantValue(DIE *Die, ConstantInt *CI, return true; } +/// addTemplateParams - Add template parameters in buffer. +void DwarfDebug::addTemplateParams(DIE &Buffer, DIArray TParams) { + // Add template parameters. + for (unsigned i = 0, e = TParams.getNumElements(); i != e; ++i) { + DIDescriptor Element = TParams.getElement(i); + if (Element.isTemplateTypeParameter()) + Buffer.addChild(getOrCreateTemplateTypeParameterDIE( + DITemplateTypeParameter(Element))); + else if (Element.isTemplateValueParameter()) + Buffer.addChild(getOrCreateTemplateValueParameterDIE( + DITemplateValueParameter(Element))); + } + +} /// addToContextOwner - Add Die into the list of its context owner's children. void DwarfDebug::addToContextOwner(DIE *Die, DIDescriptor Context) { if (Context.isType()) { @@ -1155,20 +1169,9 @@ void DwarfDebug::constructTypeDIE(DIE &Buffer, DICompositeType CTy) { addToContextOwner(&Buffer, Context); } - if (Tag == dwarf::DW_TAG_class_type) { - DIArray TParams = CTy.getTemplateParams(); - unsigned N = TParams.getNumElements(); - // Add template parameters. - for (unsigned i = 0; i < N; ++i) { - DIDescriptor Element = TParams.getElement(i); - if (Element.isTemplateTypeParameter()) - Buffer.addChild(getOrCreateTemplateTypeParameterDIE( - DITemplateTypeParameter(Element))); - else if (Element.isTemplateValueParameter()) - Buffer.addChild(getOrCreateTemplateValueParameterDIE( - DITemplateValueParameter(Element))); - } - } + if (Tag == dwarf::DW_TAG_class_type) + addTemplateParams(Buffer, CTy.getTemplateParams()); + break; } default: diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.h b/lib/CodeGen/AsmPrinter/DwarfDebug.h index b4d023d..4aeefde 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.h +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.h @@ -39,7 +39,7 @@ class DIEAbbrev; class DIE; class DIEBlock; class DIEEntry; - +class DIArray; class DIEnumerator; class DIDescriptor; class DIVariable; @@ -320,6 +320,9 @@ private: /// addConstantFPValue - Add constant value entry in variable DIE. bool addConstantFPValue(DIE *Die, const MachineOperand &MO); + /// addTemplateParams - Add template parameters in buffer. + void addTemplateParams(DIE &Buffer, DIArray TParams); + /// addComplexAddress - Start with the address based on the location provided, /// and generate the DWARF information necessary to find the actual variable /// (navigating the extra location information encoded in the type) based on |