IAS: correct debug line info for asm macros
authorSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 24 Dec 2014 06:32:43 +0000 (06:32 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Wed, 24 Dec 2014 06:32:43 +0000 (06:32 +0000)
commit3681929e116d9b753666436109f1faffd89ff279
treedef74c8a14d7fa66babc5d6ee5028eca579e5696
parent3bc4397f1f68e89005e081e1653eadc94f5d96bf
IAS: correct debug line info for asm macros

Correct the line information generation for preprocessed assembly.  Although we
tracked the source information for the macro instantiation, we failed to account
for the fact that we were instantiating a macro, which is populated into a new
buffer and that the line information would be relative to the definition rather
than the actual instantiation location.  This could cause the line number
associated with the statement to be very high due to wrapping of the difference
calculated for the preprocessor line information emitted into the stream.
Properly calculate the line for the macro instantiation, referencing the line
where the macro is actually used as GCC/gas do.

The test case uses x86, though the same problem exists on any other target using
the LLVM IAS.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224810 91177308-0d34-0410-b5e6-96231b3b80d8
lib/MC/MCParser/AsmParser.cpp
test/DebugInfo/X86/asm-macro-line-number.s [new file with mode: 0644]