diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2011-09-26 00:26:47 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2011-09-26 00:26:47 +0000 |
commit | a629004ec698daec414b00d773f6a73d8465ef8d (patch) | |
tree | 73d9a51a62912b1d6cc95f786d186a7f0174f206 /lib/Frontend/TextDiagnosticPrinter.cpp | |
parent | 534ed20bd2956b912da911f02b39be6b15cb68ec (diff) |
Revert r140484. That was *not* ready to be committed! Only halfway done,
and completely broken at that.
Sorry, must remember to stash rather than commit. =]
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140487 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/TextDiagnosticPrinter.cpp')
-rw-r--r-- | lib/Frontend/TextDiagnosticPrinter.cpp | 73 |
1 files changed, 34 insertions, 39 deletions
diff --git a/lib/Frontend/TextDiagnosticPrinter.cpp b/lib/Frontend/TextDiagnosticPrinter.cpp index 8d33a426f5..f645bd4925 100644 --- a/lib/Frontend/TextDiagnosticPrinter.cpp +++ b/lib/Frontend/TextDiagnosticPrinter.cpp @@ -1086,9 +1086,39 @@ static void PrintDiagnosticLevel(raw_ostream &OS, OS.resetColor(); } -static void FormatDiagnosticMessage(const Diagnostic &Info, - const DiagnosticOptions &DiagOpts, - SmallVectorImpl<char> &OutStr) { +void TextDiagnosticPrinter::HandleDiagnostic(DiagnosticsEngine::Level Level, + const DiagnosticInfo &Info) { + // Default implementation (Warnings/errors count). + DiagnosticConsumer::HandleDiagnostic(Level, Info); + + // Keeps track of the the starting position of the location + // information (e.g., "foo.c:10:4:") that precedes the error + // message. We use this information to determine how long the + // file+line+column number prefix is. + uint64_t StartOfLocationInfo = OS.tell(); + + if (!Prefix.empty()) + OS << Prefix << ": "; + + if (Info.getLocation().isValid()) { + const SourceManager &SM = Info.getSourceManager(); + PresumedLoc PLoc = getDiagnosticPresumedLoc(SM, Info.getLocation()); + + // First, if this diagnostic is not in the main file, print out the + // "included from" lines. + PrintIncludeStack(Level, PLoc.getIncludeLoc(), SM); + StartOfLocationInfo = OS.tell(); + + // Next emit the location of this particular diagnostic. + EmitDiagnosticLoc(Level, Info, SM, PLoc); + + if (DiagOpts->ShowColors) + OS.resetColor(); + } + + PrintDiagnosticLevel(OS, Level, DiagOpts->ShowColors); + + llvm::SmallString<100> OutStr; Info.FormatDiagnostic(OutStr); if (DiagOpts->ShowNames && @@ -1156,43 +1186,8 @@ static void FormatDiagnosticMessage(const Diagnostic &Info, OutStr += "]"; } -} - -void TextDiagnosticPrinter::HandleDiagnostic(DiagnosticsEngine::Level Level, - const DiagnosticInfo &Info) { - // Default implementation (Warnings/errors count). - DiagnosticConsumer::HandleDiagnostic(Level, Info); - - // Keeps track of the the starting position of the location - // information (e.g., "foo.c:10:4:") that precedes the error - // message. We use this information to determine how long the - // file+line+column number prefix is. - uint64_t StartOfLocationInfo = OS.tell(); - - if (!Prefix.empty()) - OS << Prefix << ": "; - - if (Info.getLocation().isValid()) { - const SourceManager &SM = Info.getSourceManager(); - PresumedLoc PLoc = getDiagnosticPresumedLoc(SM, Info.getLocation()); - - // First, if this diagnostic is not in the main file, print out the - // "included from" lines. - PrintIncludeStack(Level, PLoc.getIncludeLoc(), SM); - StartOfLocationInfo = OS.tell(); - - // Next emit the location of this particular diagnostic. - EmitDiagnosticLoc(Level, Info, SM, PLoc); - - if (DiagOpts->ShowColors) - OS.resetColor(); - } - - PrintDiagnosticLevel(OS, Level, DiagOpts->ShowColors); - - llvm::SmallString<100> OutStr; - FormatDiagnosticMessage(Info, *Diagopts, OutStr); + if (DiagOpts->ShowColors) { // Print warnings, errors and fatal errors in bold, no color switch (Level) { |