[llvm] r314498 - [dwarfdump][NFC] Consistent errors and warnings with --verify

Jonas Devlieghere via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 29 02:33:31 PDT 2017


Author: jdevlieghere
Date: Fri Sep 29 02:33:31 2017
New Revision: 314498

URL: http://llvm.org/viewvc/llvm-project?rev=314498&view=rev
Log:
[dwarfdump][NFC] Consistent errors and warnings with --verify

This patch introduces 3 helper functions: error(), warn() and note() to
make printing  during verification more consistent. When supported, the
respective prefixes are printed in color using the same color scheme as
clang.

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

Modified:
    llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFVerifier.h
    llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp
    llvm/trunk/lib/DebugInfo/DWARF/SyntaxHighlighting.cpp
    llvm/trunk/lib/DebugInfo/DWARF/SyntaxHighlighting.h
    llvm/trunk/test/tools/llvm-dwarfdump/X86/apple_names_verify_form.s
    llvm/trunk/test/tools/llvm-dwarfdump/X86/apple_names_verify_num_atoms.s
    llvm/trunk/test/tools/llvm-dwarfdump/X86/verify_debug_abbrev.s
    llvm/trunk/test/tools/llvm-dwarfdump/X86/verify_debug_info.s
    llvm/trunk/test/tools/llvm-dwarfdump/X86/verify_unit_header_chain.s

Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFVerifier.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFVerifier.h?rev=314498&r1=314497&r2=314498&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFVerifier.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFVerifier.h Fri Sep 29 02:33:31 2017
@@ -96,6 +96,10 @@ private:
   std::map<uint64_t, std::set<uint32_t>> ReferenceToDIEOffsets;
   uint32_t NumDebugLineErrors = 0;
 
+  raw_ostream &error() const;
+  raw_ostream &warn() const;
+  raw_ostream &note() const;
+
   /// Verifies the abbreviations section.
   ///
   /// This function currently checks that:

Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp?rev=314498&r1=314497&r2=314498&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFVerifier.cpp Fri Sep 29 02:33:31 2017
@@ -7,6 +7,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "SyntaxHighlighting.h"
 #include "llvm/DebugInfo/DWARF/DWARFVerifier.h"
 #include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"
 #include "llvm/DebugInfo/DWARF/DWARFContext.h"
@@ -23,6 +24,7 @@
 using namespace llvm;
 using namespace dwarf;
 using namespace object;
+using namespace syntax;
 
 DWARFVerifier::DieRangeInfo::address_range_iterator
 DWARFVerifier::DieRangeInfo::insert(const DWARFAddressRange &R) {
@@ -148,19 +150,20 @@ bool DWARFVerifier::verifyUnitHeader(con
   if (!ValidLength || !ValidVersion || !ValidAddrSize || !ValidAbbrevOffset ||
       !ValidType) {
     Success = false;
-    OS << format("Units[%d] - start offset: 0x%08x \n", UnitIndex, OffsetStart);
+    error() << format("Units[%d] - start offset: 0x%08x \n", UnitIndex,
+                      OffsetStart);
     if (!ValidLength)
-      OS << "\tError: The length for this unit is too "
+      note() << "The length for this unit is too "
             "large for the .debug_info provided.\n";
     if (!ValidVersion)
-      OS << "\tError: The 16 bit unit header version is not valid.\n";
+      note() << "The 16 bit unit header version is not valid.\n";
     if (!ValidType)
-      OS << "\tError: The unit type encoding is not valid.\n";
+      note() << "The unit type encoding is not valid.\n";
     if (!ValidAbbrevOffset)
-      OS << "\tError: The offset into the .debug_abbrev section is "
+      note() << "The offset into the .debug_abbrev section is "
             "not valid.\n";
     if (!ValidAddrSize)
-      OS << "\tError: The address size is unsupported.\n";
+      note() << "The address size is unsupported.\n";
   }
   *Offset = OffsetStart + Length + 4;
   return Success;
@@ -183,7 +186,7 @@ bool DWARFVerifier::verifyUnitContents(D
     DieRangeInfo RI;
     NumUnitErrors += verifyDieRanges(Die, RI);
   } else {
-    OS << "error: Compilation unit without unit DIE.\n";
+    error() << "Compilation unit without unit DIE.\n";
     NumUnitErrors++;
   }
 
@@ -200,8 +203,8 @@ unsigned DWARFVerifier::verifyAbbrevSect
       for (auto Attribute : AbbrDecl.attributes()) {
         auto Result = AttributeSet.insert(Attribute.Attr);
         if (!Result.second) {
-          OS << "Error: Abbreviation declaration contains multiple "
-             << AttributeString(Attribute.Attr) << " attributes.\n";
+          error() << "Abbreviation declaration contains multiple "
+                  << AttributeString(Attribute.Attr) << " attributes.\n";
           AbbrDecl.dump(OS);
           ++NumErrors;
         }
@@ -290,7 +293,7 @@ bool DWARFVerifier::handleDebugInfo() {
     ++UnitIdx;
   }
   if (UnitIdx == 0 && !hasDIE) {
-    OS << "Warning: .debug_info is empty.\n";
+    warn() << ".debug_info is empty.\n";
     isHeaderChainValid = true;
   }
   NumDebugInfoErrors += verifyDebugInfoReferences();
@@ -312,9 +315,9 @@ unsigned DWARFVerifier::verifyDieRanges(
   for (auto Range : Ranges) {
     if (!Range.valid()) {
       ++NumErrors;
-      OS << format("error: Invalid address range [0x%08" PRIx64
-                   " - 0x%08" PRIx64 "].\n",
-                   Range.LowPC, Range.HighPC);
+      error() << format("Invalid address range [0x%08" PRIx64 " - 0x%08" PRIx64
+                        "].\n",
+                        Range.LowPC, Range.HighPC);
       continue;
     }
 
@@ -322,11 +325,11 @@ unsigned DWARFVerifier::verifyDieRanges(
     const auto IntersectingRange = RI.insert(Range);
     if (IntersectingRange != RI.Ranges.end()) {
       ++NumErrors;
-      OS << format("error: DIE has overlapping address ranges: [0x%08" PRIx64
-                   " - 0x%08" PRIx64 "] and [0x%08" PRIx64 " - 0x%08" PRIx64
-                   "].\n",
-                   Range.LowPC, Range.HighPC, IntersectingRange->LowPC,
-                   IntersectingRange->HighPC);
+      error() << format("DIE has overlapping address ranges: [0x%08" PRIx64
+                        " - 0x%08" PRIx64 "] and [0x%08" PRIx64
+                        " - 0x%08" PRIx64 "].\n",
+                        Range.LowPC, Range.HighPC, IntersectingRange->LowPC,
+                        IntersectingRange->HighPC);
       break;
     }
   }
@@ -335,7 +338,7 @@ unsigned DWARFVerifier::verifyDieRanges(
   const auto IntersectingChild = ParentRI.insert(RI);
   if (IntersectingChild != ParentRI.Children.end()) {
     ++NumErrors;
-    OS << "error: DIEs have overlapping address ranges:";
+    error() << "DIEs have overlapping address ranges:";
     Die.dump(OS, 0);
     IntersectingChild->Die.dump(OS, 0);
     OS << "\n";
@@ -347,8 +350,8 @@ unsigned DWARFVerifier::verifyDieRanges(
                              ParentRI.Die.getTag() == DW_TAG_subprogram);
   if (ShouldBeContained && !ParentRI.contains(RI)) {
     ++NumErrors;
-    OS << "error: DIE address ranges are not "
-          "contained in its parent's ranges:";
+    error() << "DIE address ranges are not "
+               "contained in its parent's ranges:";
     Die.dump(OS, 0);
     ParentRI.Die.dump(OS, 0);
     OS << "\n";
@@ -372,14 +375,14 @@ unsigned DWARFVerifier::verifyDebugInfoA
     if (auto SectionOffset = AttrValue.Value.getAsSectionOffset()) {
       if (*SectionOffset >= DObj.getRangeSection().Data.size()) {
         ++NumErrors;
-        OS << "error: DW_AT_ranges offset is beyond .debug_ranges "
-              "bounds:\n";
+        error() << "DW_AT_ranges offset is beyond .debug_ranges "
+                   "bounds:\n";
         Die.dump(OS, 0, DumpOpts);
         OS << "\n";
       }
     } else {
       ++NumErrors;
-      OS << "error: DIE has invalid DW_AT_ranges encoding:\n";
+      error() << "DIE has invalid DW_AT_ranges encoding:\n";
       Die.dump(OS, 0, DumpOpts);
       OS << "\n";
     }
@@ -389,15 +392,15 @@ unsigned DWARFVerifier::verifyDebugInfoA
     if (auto SectionOffset = AttrValue.Value.getAsSectionOffset()) {
       if (*SectionOffset >= DObj.getLineSection().Data.size()) {
         ++NumErrors;
-        OS << "error: DW_AT_stmt_list offset is beyond .debug_line "
-              "bounds: "
-           << format("0x%08" PRIx64, *SectionOffset) << "\n";
+        error() << "DW_AT_stmt_list offset is beyond .debug_line "
+                   "bounds: "
+                << format("0x%08" PRIx64, *SectionOffset) << "\n";
         Die.dump(OS, 0, DumpOpts);
         OS << "\n";
       }
     } else {
       ++NumErrors;
-      OS << "error: DIE has invalid DW_AT_stmt_list encoding:\n";
+      error() << "DIE has invalid DW_AT_stmt_list encoding:\n";
       Die.dump(OS, 0, DumpOpts);
       OS << "\n";
     }
@@ -429,10 +432,10 @@ unsigned DWARFVerifier::verifyDebugInfoF
       auto CUOffset = AttrValue.Value.getRawUValue();
       if (CUOffset >= CUSize) {
         ++NumErrors;
-        OS << "error: " << FormEncodingString(Form) << " CU offset "
-           << format("0x%08" PRIx64, CUOffset)
-           << " is invalid (must be less than CU size of "
-           << format("0x%08" PRIx32, CUSize) << "):\n";
+        error() << FormEncodingString(Form) << " CU offset "
+                << format("0x%08" PRIx64, CUOffset)
+                << " is invalid (must be less than CU size of "
+                << format("0x%08" PRIx32, CUSize) << "):\n";
         Die.dump(OS, 0, DumpOpts);
         OS << "\n";
       } else {
@@ -451,8 +454,8 @@ unsigned DWARFVerifier::verifyDebugInfoF
     if (RefVal) {
       if (*RefVal >= DObj.getInfoSection().Data.size()) {
         ++NumErrors;
-        OS << "error: DW_FORM_ref_addr offset beyond .debug_info "
-              "bounds:\n";
+        error() << "DW_FORM_ref_addr offset beyond .debug_info "
+                   "bounds:\n";
         Die.dump(OS, 0, DumpOpts);
         OS << "\n";
       } else {
@@ -468,7 +471,7 @@ unsigned DWARFVerifier::verifyDebugInfoF
     assert(SecOffset); // DW_FORM_strp is a section offset.
     if (SecOffset && *SecOffset >= DObj.getStringSection().size()) {
       ++NumErrors;
-      OS << "error: DW_FORM_strp offset beyond .debug_str bounds:\n";
+      error() << "DW_FORM_strp offset beyond .debug_str bounds:\n";
       Die.dump(OS, 0, DumpOpts);
       OS << "\n";
     }
@@ -490,8 +493,8 @@ unsigned DWARFVerifier::verifyDebugInfoR
     if (Die)
       continue;
     ++NumErrors;
-    OS << "error: invalid DIE reference " << format("0x%08" PRIx64, Pair.first)
-       << ". Offset is in between DIEs:\n";
+    error() << "invalid DIE reference " << format("0x%08" PRIx64, Pair.first)
+            << ". Offset is in between DIEs:\n";
     for (auto Offset : Pair.second) {
       auto ReferencingDie = DCtx.getDIEForOffset(Offset);
       ReferencingDie.dump(OS, 0, DumpOpts);
@@ -517,8 +520,8 @@ void DWARFVerifier::verifyDebugLineStmtO
     if (LineTableOffset < DCtx.getDWARFObj().getLineSection().Data.size()) {
       if (!LineTable) {
         ++NumDebugLineErrors;
-        OS << "error: .debug_line[" << format("0x%08" PRIx32, LineTableOffset)
-           << "] was not able to be parsed for CU:\n";
+        error() << ".debug_line[" << format("0x%08" PRIx32, LineTableOffset)
+                << "] was not able to be parsed for CU:\n";
         Die.dump(OS, 0, DumpOpts);
         OS << '\n';
         continue;
@@ -533,10 +536,10 @@ void DWARFVerifier::verifyDebugLineStmtO
     auto Iter = StmtListToDie.find(LineTableOffset);
     if (Iter != StmtListToDie.end()) {
       ++NumDebugLineErrors;
-      OS << "error: two compile unit DIEs, "
-         << format("0x%08" PRIx32, Iter->second.getOffset()) << " and "
-         << format("0x%08" PRIx32, Die.getOffset())
-         << ", have the same DW_AT_stmt_list section offset:\n";
+      error() << "two compile unit DIEs, "
+              << format("0x%08" PRIx32, Iter->second.getOffset()) << " and "
+              << format("0x%08" PRIx32, Die.getOffset())
+              << ", have the same DW_AT_stmt_list section offset:\n";
       Iter->second.dump(OS, 0, DumpOpts);
       Die.dump(OS, 0, DumpOpts);
       OS << '\n';
@@ -565,12 +568,12 @@ void DWARFVerifier::verifyDebugLineRows(
       // Verify directory index.
       if (FileName.DirIdx > MaxDirIndex) {
         ++NumDebugLineErrors;
-        OS << "error: .debug_line["
-           << format("0x%08" PRIx64,
-                     *toSectionOffset(Die.find(DW_AT_stmt_list)))
-           << "].prologue.file_names[" << FileIndex
-           << "].dir_idx contains an invalid index: " << FileName.DirIdx
-           << "\n";
+        error() << ".debug_line["
+                << format("0x%08" PRIx64,
+                          *toSectionOffset(Die.find(DW_AT_stmt_list)))
+                << "].prologue.file_names[" << FileIndex
+                << "].dir_idx contains an invalid index: " << FileName.DirIdx
+                << "\n";
       }
 
       // Check file paths for duplicates.
@@ -584,11 +587,11 @@ void DWARFVerifier::verifyDebugLineRows(
       if (It == FullPathMap.end())
         FullPathMap[FullPath] = FileIndex;
       else if (It->second != FileIndex) {
-        OS << "warning: .debug_line["
-           << format("0x%08" PRIx64,
-                     *toSectionOffset(Die.find(DW_AT_stmt_list)))
-           << "].prologue.file_names[" << FileIndex
-           << "] is a duplicate of file_names[" << It->second << "]\n";
+        warn() << ".debug_line["
+               << format("0x%08" PRIx64,
+                         *toSectionOffset(Die.find(DW_AT_stmt_list)))
+               << "].prologue.file_names[" << FileIndex
+               << "] is a duplicate of file_names[" << It->second << "]\n";
       }
 
       FileIndex++;
@@ -601,11 +604,11 @@ void DWARFVerifier::verifyDebugLineRows(
       // Verify row address.
       if (Row.Address < PrevAddress) {
         ++NumDebugLineErrors;
-        OS << "error: .debug_line["
-           << format("0x%08" PRIx64,
-                     *toSectionOffset(Die.find(DW_AT_stmt_list)))
-           << "] row[" << RowIndex
-           << "] decreases in address from previous row:\n";
+        error() << ".debug_line["
+                << format("0x%08" PRIx64,
+                          *toSectionOffset(Die.find(DW_AT_stmt_list)))
+                << "] row[" << RowIndex
+                << "] decreases in address from previous row:\n";
 
         DWARFDebugLine::Row::dumpTableHeader(OS);
         if (RowIndex > 0)
@@ -617,11 +620,11 @@ void DWARFVerifier::verifyDebugLineRows(
       // Verify file index.
       if (Row.File > MaxFileIndex) {
         ++NumDebugLineErrors;
-        OS << "error: .debug_line["
-           << format("0x%08" PRIx64,
-                     *toSectionOffset(Die.find(DW_AT_stmt_list)))
-           << "][" << RowIndex << "] has invalid file index " << Row.File
-           << " (valid values are [1," << MaxFileIndex << "]):\n";
+        error() << ".debug_line["
+                << format("0x%08" PRIx64,
+                          *toSectionOffset(Die.find(DW_AT_stmt_list)))
+                << "][" << RowIndex << "] has invalid file index " << Row.File
+                << " (valid values are [1," << MaxFileIndex << "]):\n";
         DWARFDebugLine::Row::dumpTableHeader(OS);
         Row.dump(OS);
         OS << '\n';
@@ -652,17 +655,19 @@ unsigned DWARFVerifier::verifyAccelTable
   DWARFAcceleratorTable AccelTable(AccelSectionData, *StrData);
 
   OS << "Verifying " << SectionName << "...\n";
-  // Verify that the fixed part of the header is not too short.
 
+  // Verify that the fixed part of the header is not too short.
   if (!AccelSectionData.isValidOffset(AccelTable.getSizeHdr())) {
-    OS << "\terror: Section is too small to fit a section header.\n";
+    error() << "Section is too small to fit a section header.\n";
     return 1;
   }
+
   // Verify that the section is not too short.
   if (!AccelTable.extract()) {
-    OS << "\terror: Section is smaller than size described in section header.\n";
+    error() << "Section is smaller than size described in section header.\n";
     return 1;
   }
+
   // Verify that all buckets have a valid hash index or are empty.
   uint32_t NumBuckets = AccelTable.getNumBuckets();
   uint32_t NumHashes = AccelTable.getNumHashes();
@@ -674,18 +679,18 @@ unsigned DWARFVerifier::verifyAccelTable
   for (uint32_t BucketIdx = 0; BucketIdx < NumBuckets; ++BucketIdx) {
     uint32_t HashIdx = AccelSectionData.getU32(&BucketsOffset);
     if (HashIdx >= NumHashes && HashIdx != UINT32_MAX) {
-      OS << format("\terror: Bucket[%d] has invalid hash index: %u.\n", BucketIdx,
-                   HashIdx);
+      error() << format("Bucket[%d] has invalid hash index: %u.\n", BucketIdx,
+                        HashIdx);
       ++NumErrors;
     }
   }
   uint32_t NumAtoms = AccelTable.getAtomsDesc().size();
   if (NumAtoms == 0) {
-    OS << "\terror: no atoms; failed to read HashData.\n";
+    error() << "No atoms: failed to read HashData.\n";
     return 1;
   }
   if (!AccelTable.validateForms()) {
-    OS << "\terror: unsupported form; failed to read HashData.\n";
+    error() << "Unsupported form: failed to read HashData.\n";
     return 1;
   }
 
@@ -696,8 +701,8 @@ unsigned DWARFVerifier::verifyAccelTable
     uint32_t HashDataOffset = AccelSectionData.getU32(&DataOffset);
     if (!AccelSectionData.isValidOffsetForDataOfSize(HashDataOffset,
                                                      sizeof(uint64_t))) {
-      OS << format("\terror: Hash[%d] has invalid HashData offset: 0x%08x.\n",
-                   HashIdx, HashDataOffset);
+      error() << format("Hash[%d] has invalid HashData offset: 0x%08x.\n",
+                        HashIdx, HashDataOffset);
       ++NumErrors;
     }
 
@@ -721,8 +726,8 @@ unsigned DWARFVerifier::verifyAccelTable
           if (!Name)
             Name = "<NULL>";
 
-          OS << format(
-              "\terror: %s Bucket[%d] Hash[%d] = 0x%08x "
+          error() << format(
+              "%s Bucket[%d] Hash[%d] = 0x%08x "
               "Str[%u] = 0x%08x "
               "DIE[%d] = 0x%08x is not a valid DIE offset for \"%s\".\n",
               SectionName, BucketIdx, HashIdx, Hash, StringCount, StrpOffset,
@@ -732,10 +737,10 @@ unsigned DWARFVerifier::verifyAccelTable
           continue;
         }
         if ((Tag != dwarf::DW_TAG_null) && (Die.getTag() != Tag)) {
-          OS << "\terror: Tag " << dwarf::TagString(Tag)
-             << " in accelerator table does not match Tag "
-             << dwarf::TagString(Die.getTag()) << " of DIE[" << HashDataIdx
-             << "].\n";
+          error() << "Tag " << dwarf::TagString(Tag)
+                  << " in accelerator table does not match Tag "
+                  << dwarf::TagString(Die.getTag()) << " of DIE[" << HashDataIdx
+                  << "].\n";
           ++NumErrors;
         }
       }
@@ -763,3 +768,15 @@ bool DWARFVerifier::handleAccelTables()
         verifyAccelTable(&D.getAppleObjCSection(), &StrData, ".apple_objc");
   return NumErrors == 0;
 }
+
+raw_ostream &DWARFVerifier::error() const {
+  return WithColor(OS, syntax::Error).get() << "error: ";
+}
+
+raw_ostream &DWARFVerifier::warn() const {
+  return WithColor(OS, syntax::Warning).get() << "warning: ";
+}
+
+raw_ostream &DWARFVerifier::note() const {
+  return WithColor(OS, syntax::Note).get() << "note: ";
+}

Modified: llvm/trunk/lib/DebugInfo/DWARF/SyntaxHighlighting.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/SyntaxHighlighting.cpp?rev=314498&r1=314497&r2=314498&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/SyntaxHighlighting.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/SyntaxHighlighting.cpp Fri Sep 29 02:33:31 2017
@@ -24,12 +24,15 @@ WithColor::WithColor(raw_ostream &OS, en
   // Detect color from terminal type unless the user passed the --color option.
   if (UseColor == cl::BOU_UNSET ? OS.has_colors() : UseColor == cl::BOU_TRUE) {
     switch (Type) {
-    case Address:    OS.changeColor(raw_ostream::YELLOW);  break;
-    case String:     OS.changeColor(raw_ostream::GREEN);   break;
-    case Tag:        OS.changeColor(raw_ostream::BLUE);    break;
-    case Attribute:  OS.changeColor(raw_ostream::CYAN);    break;
-    case Enumerator: OS.changeColor(raw_ostream::MAGENTA); break;
-    case Macro:      OS.changeColor(raw_ostream::RED);     break;
+    case Address:    OS.changeColor(raw_ostream::YELLOW);         break;
+    case String:     OS.changeColor(raw_ostream::GREEN);          break;
+    case Tag:        OS.changeColor(raw_ostream::BLUE);           break;
+    case Attribute:  OS.changeColor(raw_ostream::CYAN);           break;
+    case Enumerator: OS.changeColor(raw_ostream::MAGENTA);        break;
+    case Macro:      OS.changeColor(raw_ostream::RED);            break;
+    case Error:      OS.changeColor(raw_ostream::RED, true);      break;
+    case Warning:    OS.changeColor(raw_ostream::MAGENTA, true);  break;
+    case Note:       OS.changeColor(raw_ostream::BLACK, true);    break;
     }
   }
 }

Modified: llvm/trunk/lib/DebugInfo/DWARF/SyntaxHighlighting.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/SyntaxHighlighting.h?rev=314498&r1=314497&r2=314498&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/SyntaxHighlighting.h (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/SyntaxHighlighting.h Fri Sep 29 02:33:31 2017
@@ -18,7 +18,17 @@ namespace dwarf {
 namespace syntax {
 
 // Symbolic names for various syntax elements.
-enum HighlightColor { Address, String, Tag, Attribute, Enumerator, Macro };
+enum HighlightColor {
+  Address,
+  String,
+  Tag,
+  Attribute,
+  Enumerator,
+  Macro,
+  Error,
+  Warning,
+  Note
+};
 
 /// An RAII object that temporarily switches an output stream to a
 /// specific color.
@@ -30,8 +40,8 @@ public:
   WithColor(raw_ostream &OS, enum HighlightColor Type);
   ~WithColor();
 
-  raw_ostream& get() { return OS; }
-  operator raw_ostream& () { return OS; }
+  raw_ostream &get() { return OS; }
+  operator raw_ostream &() { return OS; }
 };
 
 } // end namespace syntax

Modified: llvm/trunk/test/tools/llvm-dwarfdump/X86/apple_names_verify_form.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-dwarfdump/X86/apple_names_verify_form.s?rev=314498&r1=314497&r2=314498&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-dwarfdump/X86/apple_names_verify_form.s (original)
+++ llvm/trunk/test/tools/llvm-dwarfdump/X86/apple_names_verify_form.s Fri Sep 29 02:33:31 2017
@@ -3,9 +3,9 @@
 # RUN: | FileCheck %s
 
 # CHECK: Verifying .apple_names...
-# CHECK-NEXT:	error: unsupported form; failed to read HashData.
+# CHECK-NEXT:	error: Unsupported form: failed to read HashData.
 
-# This test is meant to verify that the -verify option 
+# This test is meant to verify that the -verify option
 # in llvm-dwarfdump, correctly identifies that Atom[0].form is unsupported.
 # As a result, the hashdata cannot be read.
 

Modified: llvm/trunk/test/tools/llvm-dwarfdump/X86/apple_names_verify_num_atoms.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-dwarfdump/X86/apple_names_verify_num_atoms.s?rev=314498&r1=314497&r2=314498&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-dwarfdump/X86/apple_names_verify_num_atoms.s (original)
+++ llvm/trunk/test/tools/llvm-dwarfdump/X86/apple_names_verify_num_atoms.s Fri Sep 29 02:33:31 2017
@@ -3,9 +3,9 @@
 # RUN: | FileCheck %s
 
 # CHECK: Verifying .apple_names...
-# CHECK-NEXT:	error: no atoms; failed to read HashData.
+# CHECK-NEXT:	error: No atoms: failed to read HashData.
 
-# This test is meant to verify that the -verify option 
+# This test is meant to verify that the -verify option
 # in llvm-dwarfdump, correctly identifies that there is not Atom.
 # As a result, the hashdata cannot be read.
 
@@ -21,7 +21,7 @@ Linfo_string:
 	.asciz	"i"                     ## string offset=84
 	.asciz	"int"                   ## string offset=86
 	.asciz	"j"                     ## string offset=90
-	
+
 	.section	__DWARF,__debug_info,regular,debug
 Lsection_info:
 	.section	__DWARF,__apple_names,regular,debug

Modified: llvm/trunk/test/tools/llvm-dwarfdump/X86/verify_debug_abbrev.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-dwarfdump/X86/verify_debug_abbrev.s?rev=314498&r1=314497&r2=314498&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-dwarfdump/X86/verify_debug_abbrev.s (original)
+++ llvm/trunk/test/tools/llvm-dwarfdump/X86/verify_debug_abbrev.s Fri Sep 29 02:33:31 2017
@@ -3,12 +3,12 @@
 # RUN: | FileCheck %s
 
 # CHECK: Verifying .debug_abbrev...
-# CHECK-NEXT: Error: Abbreviation declaration contains multiple DW_AT_stmt_list attributes.
+# CHECK-NEXT: error: Abbreviation declaration contains multiple DW_AT_stmt_list attributes.
 # CHECK-NEXT:[1] DW_TAG_compile_unit	DW_CHILDREN_no
 # CHECK-NEXT:	DW_AT_stmt_list	DW_FORM_sec_offset
 # CHECK-NEXT:	DW_AT_GNU_dwo_name	DW_FORM_strp
 # CHECK-NEXT:	DW_AT_stmt_list	DW_FORM_strp{{[[:space:]]}}
-# CHECK-NEXT: Error: Abbreviation declaration contains multiple DW_AT_producer attributes.
+# CHECK-NEXT: error: Abbreviation declaration contains multiple DW_AT_producer attributes.
 # CHECK-NEXT:[1] DW_TAG_compile_unit	DW_CHILDREN_yes
 # CHECK-NEXT:	DW_AT_GNU_dwo_name	DW_FORM_GNU_str_index
 # CHECK-NEXT:	DW_AT_producer	DW_FORM_GNU_str_index
@@ -41,4 +41,3 @@
   .byte  0                       # EOM(1)
   .byte  0                       # EOM(2)
   .byte  0                       # EOM(3)
-  
\ No newline at end of file

Modified: llvm/trunk/test/tools/llvm-dwarfdump/X86/verify_debug_info.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-dwarfdump/X86/verify_debug_info.s?rev=314498&r1=314497&r2=314498&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-dwarfdump/X86/verify_debug_info.s (original)
+++ llvm/trunk/test/tools/llvm-dwarfdump/X86/verify_debug_info.s Fri Sep 29 02:33:31 2017
@@ -11,9 +11,9 @@
 # CHECK-NEXT: DW_AT_comp_dir [DW_FORM_strp]	( .debug_str[0x0000003f] = "/Users/sgravani/Development/tests")
 # CHECK-NEXT: DW_AT_low_pc [DW_FORM_addr]	(0x0000000000000000)
 # CHECK-NEXT: DW_AT_high_pc [DW_FORM_data4]	(0x00000016){{[[:space:]]}}
-# CHECK-NEXT: Units[2] - start offset: 0x00000068
-# CHECK-NEXT:	Error: The length for this unit is too large for the .debug_info provided.
-# CHECK-NEXT:	Error: The unit type encoding is not valid.
+# CHECK-NEXT: error: Units[2] - start offset: 0x00000068
+# CHECK-NEXT: note: The length for this unit is too large for the .debug_info provided.
+# CHECK-NEXT: note: The unit type encoding is not valid.
 
 
 	.section	__TEXT,__text,regular,pure_instructions

Modified: llvm/trunk/test/tools/llvm-dwarfdump/X86/verify_unit_header_chain.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-dwarfdump/X86/verify_unit_header_chain.s?rev=314498&r1=314497&r2=314498&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-dwarfdump/X86/verify_unit_header_chain.s (original)
+++ llvm/trunk/test/tools/llvm-dwarfdump/X86/verify_unit_header_chain.s Fri Sep 29 02:33:31 2017
@@ -3,14 +3,14 @@
 # RUN: | FileCheck %s
 
 # CHECK: Verifying .debug_info Unit Header Chain...
-# CHECK-NEXT: Units[1] - start offset: 0x0000000d 
-# CHECK-NEXT: 	Error: The unit type encoding is not valid.
-# CHECK-NEXT: 	Error: The address size is unsupported.
-# CHECK-NEXT: Units[2] - start offset: 0x00000026 
-# CHECK-NEXT: 	Error: The 16 bit unit header version is not valid.
-# CHECK-NEXT: 	Error: The offset into the .debug_abbrev section is not valid.
-# CHECK-NEXT: Units[4] - start offset: 0x00000041 
-# CHECK-NEXT: 	Error: The length for this unit is too large for the .debug_info provided.
+# CHECK-NEXT: error: Units[1] - start offset: 0x0000000d
+# CHECK-NEXT: note: The unit type encoding is not valid.
+# CHECK-NEXT: note: The address size is unsupported.
+# CHECK-NEXT: error: Units[2] - start offset: 0x00000026
+# CHECK-NEXT: note: The 16 bit unit header version is not valid.
+# CHECK-NEXT: note: The offset into the .debug_abbrev section is not valid.
+# CHECK-NEXT: error: Units[4] - start offset: 0x00000041
+# CHECK-NEXT: note: The length for this unit is too large for the .debug_info provided.
 
 	.section	__TEXT,__text,regular,pure_instructions
 	.file	1 "basic.c"
@@ -73,7 +73,7 @@ Ltu_begin1:
 	.long	0
 	.quad	0
 	.long   0
-	.byte 	0		
+	.byte 	0
 
 .subsections_via_symbols
 	.section	__DWARF,__debug_line,regular,debug




More information about the llvm-commits mailing list