Do not add redundant arguments in a method definition DIE.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63527 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel
2009-02-02 17:51:41 +00:00
parent d61051f703
commit d5863dd9a8
2 changed files with 121 additions and 11 deletions

View File

@ -1914,18 +1914,20 @@ private:
// Add Return Type.
if (!IsConstructor)
AddType(DW_Unit, SPDie, DIType(Args.getElement(0).getGV()));
// Add arguments.
if (!Args.isNull())
for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) {
DIE *Arg = new DIE(DW_TAG_formal_parameter);
AddType(DW_Unit, Arg, DIType(Args.getElement(i).getGV()));
AddUInt(Arg, DW_AT_artificial, DW_FORM_flag, 1); // ???
SPDie->AddChild(Arg);
}
if (!SP.isDefinition())
AddUInt(SPDie, DW_AT_declaration, DW_FORM_flag, 1);
if (!SP.isDefinition()) {
AddUInt(SPDie, DW_AT_declaration, DW_FORM_flag, 1);
// Add arguments.
// Do not add arguments for subprogram definition. They will be
// handled through RecordVariable.
if (!Args.isNull())
for (unsigned i = 1, N = Args.getNumElements(); i < N; ++i) {
DIE *Arg = new DIE(DW_TAG_formal_parameter);
AddType(DW_Unit, Arg, DIType(Args.getElement(i).getGV()));
AddUInt(Arg, DW_AT_artificial, DW_FORM_flag, 1); // ???
SPDie->AddChild(Arg);
}
}
if (!SP.isLocalToUnit())
AddUInt(SPDie, DW_AT_external, DW_FORM_flag, 1);
@ -2856,6 +2858,11 @@ private:
DIE *&Slot = Unit->getDieMapSlotFor(SP.getGV());
if (Slot) continue;
if (!SP.isDefinition())
// This is a method declaration which will be handled while
// constructing class type.
continue;
DIE *SubprogramDie = CreateSubprogramDIE(Unit, SP);
//Add to map.