[cfe-commits] r140487 - /cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp
Chandler Carruth
chandlerc at gmail.com
Sun Sep 25 17:26:48 PDT 2011
Author: chandlerc
Date: Sun Sep 25 19:26:47 2011
New Revision: 140487
URL: http://llvm.org/viewvc/llvm-project?rev=140487&view=rev
Log:
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. =]
Modified:
cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp
Modified: cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp?rev=140487&r1=140486&r2=140487&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp (original)
+++ cfe/trunk/lib/Frontend/TextDiagnosticPrinter.cpp Sun Sep 25 19:26:47 2011
@@ -1086,9 +1086,39 @@
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 @@
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) {
More information about the cfe-commits
mailing list