[DebugInfo] Use WithColor to print errors/warnings
Use the convenience methods from WithColor to consistently print errors
and warnings in libDebugInfo.
llvm-svn: 330092
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
index cba21b0..dd74ea3 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
@@ -17,6 +17,7 @@
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/Path.h"
+#include "llvm/Support/WithColor.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
@@ -318,10 +319,11 @@
if (!parseV5DirFileTables(DebugLineData, OffsetPtr, EndPrologueOffset,
FormParams, Ctx, U, ContentTypes,
IncludeDirectories, FileNames)) {
- fprintf(stderr,
- "warning: parsing line table prologue at 0x%8.8" PRIx64
- " found an invalid directory or file table description at"
- " 0x%8.8" PRIx64 "\n", PrologueOffset, (uint64_t)*OffsetPtr);
+ WithColor::warning() << format(
+ "parsing line table prologue at 0x%8.8" PRIx64
+ " found an invalid directory or file table description at"
+ " 0x%8.8" PRIx64 "\n",
+ PrologueOffset, (uint64_t)*OffsetPtr);
return false;
}
} else
@@ -329,11 +331,11 @@
ContentTypes, IncludeDirectories, FileNames);
if (*OffsetPtr != EndPrologueOffset) {
- fprintf(stderr,
- "warning: parsing line table prologue at 0x%8.8" PRIx64
- " should have ended at 0x%8.8" PRIx64
- " but it ended at 0x%8.8" PRIx64 "\n",
- PrologueOffset, EndPrologueOffset, (uint64_t)*OffsetPtr);
+ WithColor::warning() << format(
+ "parsing line table prologue at 0x%8.8" PRIx64
+ " should have ended at 0x%8.8" PRIx64 " but it ended at 0x%8.8" PRIx64
+ "\n",
+ PrologueOffset, EndPrologueOffset, (uint64_t)*OffsetPtr);
return false;
}
return true;
@@ -828,10 +830,9 @@
*OS << "\n";
}
- if (!State.Sequence.Empty) {
- fprintf(stderr, "warning: last sequence in debug line table is not"
- "terminated!\n");
- }
+ if (!State.Sequence.Empty)
+ WithColor::warning() << "last sequence in debug line table is not"
+ "terminated!\n";
// Sort all sequences so that address lookup will work faster.
if (!Sequences.empty()) {