[llvm] r330440 - [DebugInfo] Use WithColor for more debug line warnings

Andrew Ng via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 20 08:29:47 PDT 2018


Author: anng
Date: Fri Apr 20 08:29:47 2018
New Revision: 330440

URL: http://llvm.org/viewvc/llvm-project?rev=330440&view=rev
Log:
[DebugInfo] Use WithColor for more debug line warnings

Updated two more debug line related warnings to use WithColor. This was
necessary to ensure consistent output order of the warnings on Windows
for debug line tests.

Differential Revision: https://reviews.llvm.org/D45871

Modified:
    llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
    llvm/trunk/test/DebugInfo/X86/dwarfdump-bogus-LNE.s
    llvm/trunk/test/DebugInfo/X86/dwarfdump-line-mismatch.s

Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp?rev=330440&r1=330439&r2=330440&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp Fri Apr 20 08:29:47 2018
@@ -554,9 +554,10 @@ bool DWARFDebugLine::LineTable::parse(DW
         if (DebugLineData.getAddressSize() == 0)
           DebugLineData.setAddressSize(Len - 1);
         else if (DebugLineData.getAddressSize() != Len - 1) {
-          fprintf(stderr, "Mismatching address size at offset 0x%8.8" PRIx32
-                  " expected 0x%2.2" PRIx8 " found 0x%2.2" PRIx64 "\n",
-                  ExtOffset, DebugLineData.getAddressSize(), Len - 1);
+          WithColor::warning()
+              << format("mismatching address size at offset 0x%8.8" PRIx32
+                        " expected 0x%2.2" PRIx8 " found 0x%2.2" PRIx64 "\n",
+                        ExtOffset, DebugLineData.getAddressSize(), Len - 1);
           // Skip the rest of the line-number program.
           *OffsetPtr = EndOffset;
           return false;
@@ -621,9 +622,10 @@ bool DWARFDebugLine::LineTable::parse(DW
       // Make sure the stated and parsed lengths are the same.
       // Otherwise we have an unparseable line-number program.
       if (*OffsetPtr - ExtOffset != Len) {
-        fprintf(stderr, "Unexpected line op length at offset 0x%8.8" PRIx32
-                " expected 0x%2.2" PRIx64 " found 0x%2.2" PRIx32 "\n",
-                ExtOffset, Len, *OffsetPtr - ExtOffset);
+        WithColor::warning()
+            << format("unexpected line op length at offset 0x%8.8" PRIx32
+                      " expected 0x%2.2" PRIx64 " found 0x%2.2" PRIx32 "\n",
+                      ExtOffset, Len, *OffsetPtr - ExtOffset);
         // Skip the rest of the line-number program.
         *OffsetPtr = EndOffset;
         return false;

Modified: llvm/trunk/test/DebugInfo/X86/dwarfdump-bogus-LNE.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dwarfdump-bogus-LNE.s?rev=330440&r1=330439&r2=330440&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/dwarfdump-bogus-LNE.s (original)
+++ llvm/trunk/test/DebugInfo/X86/dwarfdump-bogus-LNE.s Fri Apr 20 08:29:47 2018
@@ -148,7 +148,7 @@ LT2_header_end:
         .byte   1               # DW_LNE_end_sequence
 LT2_end:
 
-# ERR:      Unexpected line op length at offset 0x0000005e
+# ERR:      warning: unexpected line op length at offset 0x0000005e
 # ERR-SAME: expected 0x02 found 0x01
 
 # The above parsing errors still let us move to the next unit.

Modified: llvm/trunk/test/DebugInfo/X86/dwarfdump-line-mismatch.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dwarfdump-line-mismatch.s?rev=330440&r1=330439&r2=330440&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/dwarfdump-line-mismatch.s (original)
+++ llvm/trunk/test/DebugInfo/X86/dwarfdump-line-mismatch.s Fri Apr 20 08:29:47 2018
@@ -4,7 +4,7 @@
 # RUN: llvm-mc -filetype=obj -triple i686-linux-gnu %s -o - | \
 # RUN: llvm-dwarfdump -debug-line - 2>&1 | FileCheck %s
 
-# CHECK: Mismatching address size at offset 0x{{[0-9a-f]+}}
+# CHECK:      warning: mismatching address size at offset 0x{{[0-9a-f]+}}
 # CHECK-SAME: expected 0x08 found 0x04
 	.text
 	.file	"reduced.c"




More information about the llvm-commits mailing list