" 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!




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63396 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/TextDiagnosticPrinter.cpp b/lib/Driver/TextDiagnosticPrinter.cpp
index 36e2d28..27353b8 100644
--- a/lib/Driver/TextDiagnosticPrinter.cpp
+++ b/lib/Driver/TextDiagnosticPrinter.cpp
@@ -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) {