[cfe-commits] r63396 - in /cfe/trunk: include/clang/Driver/TextDiagnosticPrinter.h lib/Driver/TextDiagnosticPrinter.cpp

Chris Lattner sabre at nondot.org
Fri Jan 30 09:41:54 PST 2009


Author: lattner
Date: Fri Jan 30 11:41:53 2009
New Revision: 63396

URL: http://llvm.org/viewvc/llvm-project?rev=63396&view=rev
Log:
" Attached is a patch for TextDiagnosticPrinter that adds an optional
parameter that allows users to omit the printing of the source
location on a diagnostic. So basically it would omit the "abc.c:5:1: "
at the beginning of the line."

Patch by Alexei Svitkine!



Modified:
    cfe/trunk/include/clang/Driver/TextDiagnosticPrinter.h
    cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp

Modified: cfe/trunk/include/clang/Driver/TextDiagnosticPrinter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/TextDiagnosticPrinter.h?rev=63396&r1=63395&r2=63396&view=diff

==============================================================================
--- cfe/trunk/include/clang/Driver/TextDiagnosticPrinter.h (original)
+++ cfe/trunk/include/clang/Driver/TextDiagnosticPrinter.h Fri Jan 30 11:41:53 2009
@@ -31,10 +31,12 @@
   llvm::raw_ostream &OS;
   bool ShowColumn;
   bool CaretDiagnostics;
+  bool ShowLocation;
 public:
   TextDiagnosticPrinter(llvm::raw_ostream &os, bool showColumn = true,
-                        bool caretDiagnistics = true)
-    : OS(os), ShowColumn(showColumn), CaretDiagnostics(caretDiagnistics) {}
+                        bool caretDiagnistics = true, bool showLocation = true)
+    : OS(os), ShowColumn(showColumn), CaretDiagnostics(caretDiagnistics),
+      ShowLocation(showLocation) {}
 
   void PrintIncludeStack(SourceLocation Loc, const SourceManager &SM);
 

Modified: cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp?rev=63396&r1=63395&r2=63396&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp (original)
+++ cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp Fri Jan 30 11:41:53 2009
@@ -113,10 +113,12 @@
   
     // Compute the column number.
     ColNo = PLoc.getColumn();
-    OS << PLoc.getFilename() << ':' << LineNo << ':';
-    if (ColNo && ShowColumn) 
-      OS << ColNo << ':';
-    OS << ' ';
+    if (ShowLocation) {
+      OS << PLoc.getFilename() << ':' << LineNo << ':';
+      if (ColNo && ShowColumn) 
+        OS << ColNo << ':';
+      OS << ' ';
+    }
   }
   
   switch (Level) {





More information about the cfe-commits mailing list