diff options
author | Devang Patel <dpatel@apple.com> | 2009-02-02 17:51:41 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-02-02 17:51:41 +0000 |
commit | d5863dd9a806300bd020b80de3067fd36ac213c6 (patch) | |
tree | 80553d0d9f0e6ddf0710b12b31e580acc1f2247d /lib/CodeGen/AsmPrinter/DwarfWriter.cpp | |
parent | d61051f70313067b63abd315f4a8bec1c66a5e0f (diff) |
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
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DwarfWriter.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfWriter.cpp | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfWriter.cpp b/lib/CodeGen/AsmPrinter/DwarfWriter.cpp index 95990cfe67..638def2b06 100644 --- a/lib/CodeGen/AsmPrinter/DwarfWriter.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfWriter.cpp @@ -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. |