Refactor.

llvm-svn: 128929
This commit is contained in:
Devang Patel 2011-04-05 21:08:24 +00:00
parent e1dd424380
commit d4e20eacf0
2 changed files with 21 additions and 15 deletions

View File

@ -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:

View File

@ -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