[cfe-commits] r170466 - /cfe/trunk/lib/Frontend/TextDiagnostic.cpp

Douglas Gregor dgregor at apple.com
Tue Dec 18 15:02:07 PST 2012


Author: dgregor
Date: Tue Dec 18 17:02:07 2012
New Revision: 170466

URL: http://llvm.org/viewvc/llvm-project?rev=170466&view=rev
Log:
Be defensive when printing module import locations; the diagnostic printer needs to be robust

Modified:
    cfe/trunk/lib/Frontend/TextDiagnostic.cpp

Modified: cfe/trunk/lib/Frontend/TextDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/TextDiagnostic.cpp?rev=170466&r1=170465&r2=170466&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/TextDiagnostic.cpp (original)
+++ cfe/trunk/lib/Frontend/TextDiagnostic.cpp Tue Dec 18 17:02:07 2012
@@ -898,7 +898,7 @@
                                                 PresumedLoc PLoc,
                                                 StringRef ModuleName,
                                                 const SourceManager &SM) {
-  if (DiagOpts->ShowLocation)
+  if (DiagOpts->ShowLocation && PLoc.getFilename())
     OS << "While building module '" << ModuleName << "' imported from "
       << PLoc.getFilename() << ':' << PLoc.getLine() << ":\n";
   else





More information about the cfe-commits mailing list