aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/TextDiagnosticPrinter.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-02-25 03:23:40 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-02-25 03:23:40 +0000
commitb96b6709fbf5044ab06223ebfefccd58d7aaa88b (patch)
treed25b90bffcb39c28c07c0c6f21f9a8300e3c6459 /lib/Frontend/TextDiagnosticPrinter.cpp
parentf316a1d40bf224f16576b9b1727003d2259399f9 (diff)
Add TextDiagnosticPrinter::setPrefix, for adding a string to prefix diagnostic
messages with. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97101 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/TextDiagnosticPrinter.cpp')
-rw-r--r--lib/Frontend/TextDiagnosticPrinter.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Frontend/TextDiagnosticPrinter.cpp b/lib/Frontend/TextDiagnosticPrinter.cpp
index 3c64332512..d2aa5480b4 100644
--- a/lib/Frontend/TextDiagnosticPrinter.cpp
+++ b/lib/Frontend/TextDiagnosticPrinter.cpp
@@ -31,7 +31,7 @@ static const enum llvm::raw_ostream::Colors warningColor =
llvm::raw_ostream::MAGENTA;
static const enum llvm::raw_ostream::Colors errorColor = llvm::raw_ostream::RED;
static const enum llvm::raw_ostream::Colors fatalColor = llvm::raw_ostream::RED;
-// used for changing only the bold attribute
+// Used for changing only the bold attribute.
static const enum llvm::raw_ostream::Colors savedColor =
llvm::raw_ostream::SAVEDCOLOR;
@@ -682,6 +682,9 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level,
// file+line+column number prefix is.
uint64_t StartOfLocationInfo = OS.tell();
+ if (!Prefix.empty())
+ OS << Prefix << ": ";
+
// If the location is specified, print out a file/line/col and include trace
// if enabled.
if (Info.getLocation().isValid()) {