[cfe-commits] r64755 - /cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp

Chris Lattner sabre at nondot.org
Mon Feb 16 23:54:56 PST 2009


Author: lattner
Date: Tue Feb 17 01:54:55 2009
New Revision: 64755

URL: http://llvm.org/viewvc/llvm-project?rev=64755&view=rev
Log:
sink a call to getInstantiationLoc to eliminate an assertion.

Modified:
    cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp

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

==============================================================================
--- cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp (original)
+++ cfe/trunk/lib/Driver/TextDiagnosticPrinter.cpp Tue Feb 17 01:54:55 2009
@@ -104,7 +104,9 @@
 void TextDiagnosticPrinter::EmitCaretDiagnostic(const DiagnosticInfo &Info,
                                                 SourceLocation Loc,
                                                 SourceManager &SM) {
-  assert(Loc.isFileID() && "Shouldn't have instantiation locs here");
+  // We always emit diagnostics about the instantiation points, not the spelling
+  // points.  This more closely correlates to what the user writes.
+  Loc = SM.getInstantiationLoc(Loc);
   
   // Decompose the location into a FID/Offset pair.
   std::pair<FileID, unsigned> LocInfo = SM.getDecomposedLoc(Loc);
@@ -228,10 +230,9 @@
     // Cache the LastLoc, it allows us to omit duplicate source/caret spewage.
     LastLoc = Info.getLocation();
 
-    // Inspect the actual instantiation point of the diagnostic, we don't care
+    // Inspect the actual source location of the diagnostic, we don't care
     // about presumed locations anymore.
-    FullSourceLoc ILoc = Info.getLocation().getInstantiationLoc();
-    EmitCaretDiagnostic(Info, ILoc, ILoc.getManager());
+    EmitCaretDiagnostic(Info, LastLoc, LastLoc.getManager());
   }
   
   OS.flush();





More information about the cfe-commits mailing list