]> granicus.if.org Git - clang/commitdiff
make "in included from" and "in instatiation from" messages respect
authorChris Lattner <sabre@nondot.org>
Tue, 21 Apr 2009 03:57:54 +0000 (03:57 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 21 Apr 2009 03:57:54 +0000 (03:57 +0000)
-fno-show-location, patch by Alexei Svitkine (PR4024)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69657 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/TextDiagnosticPrinter.cpp

index 0dd71d7bb38a125114792104112f2856f5e558ce..be69b760fa394009ba15b62608999cb0c75dd2cd 100644 (file)
@@ -27,9 +27,12 @@ PrintIncludeStack(SourceLocation Loc, const SourceManager &SM) {
 
   // Print out the other include frames first.
   PrintIncludeStack(PLoc.getIncludeLoc(), SM);
-  
-  OS << "In file included from " << PLoc.getFilename()
-     << ':' << PLoc.getLine() << ":\n";
+
+  if (ShowLocation)
+    OS << "In file included from " << PLoc.getFilename()
+       << ':' << PLoc.getLine() << ":\n";
+  else
+    OS << "In included file:\n";
 }
 
 /// HighlightRange - Given a SourceRange and a line number, highlight (with ~'s)
@@ -129,12 +132,15 @@ void TextDiagnosticPrinter::EmitCaretDiagnostic(SourceLocation Loc,
       Ranges[i] = SourceRange(S, E);
     }
     
-    // Emit the file/line/column that this expansion came from.
-    OS << SM.getBufferName(Loc) << ':' << SM.getInstantiationLineNumber(Loc)
-       << ':';
-    if (ShowColumn)
-      OS << SM.getInstantiationColumnNumber(Loc) << ':';
-    OS << " note: instantiated from:\n";
+    if (ShowLocation) {
+      // Emit the file/line/column that this expansion came from.
+      OS << SM.getBufferName(Loc) << ':' << SM.getInstantiationLineNumber(Loc)
+         << ':';
+      if (ShowColumn)
+        OS << SM.getInstantiationColumnNumber(Loc) << ':';
+      OS << ' ';
+    }
+    OS << "note: instantiated from:\n";
   }
   
   // Decompose the location into a FID/Offset pair.