OSDN Git Service

[AsmPrinter] Collapse .loc 0 0 directives
authorJonas Devlieghere <jonas@devlieghere.com>
Wed, 16 Jan 2019 23:26:29 +0000 (23:26 +0000)
committerJonas Devlieghere <jonas@devlieghere.com>
Wed, 16 Jan 2019 23:26:29 +0000 (23:26 +0000)
commitc657e7f5f254460f8ef21c3199e562dbbc5e646b
tree35aa58ca477bbc7111c2bd81e6c6df7ffef71613
parent22cdd42712f9ac888fe54e6d10ef44190bc35ded
[AsmPrinter] Collapse .loc 0 0 directives

Currently we do not always collapse subsequent .loc 0 0 directives. The
reason is that we were checking for a PrevInstLoc which is not set when
we emit a line-0 record. We should only check the LastAsmLine, which
seems to be created exactly for this purpose.

  // When we emit a line-0 record, we don't update PrevInstLoc; so look at
  // the last line number actually emitted, to see if it was line 0.
  unsigned LastAsmLine =
    Asm->OutStreamer->getContext().getCurrentDwarfLoc().getLine();

Differential revision: https://reviews.llvm.org/D56767

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351395 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/AsmPrinter/DwarfDebug.cpp
test/DebugInfo/MIR/X86/debug-loc-0.mir [new file with mode: 0644]