diff options
author | Chris Lattner <sabre@nondot.org> | 2009-02-17 07:54:55 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-02-17 07:54:55 +0000 |
commit | 5abfe97bf113753b59a47672774e935e867aeb24 (patch) | |
tree | 4592a48f898695596007b388a900ba87d8b84f9f /clang | |
parent | d22603cef0457178040f52c96f2304c1de450173 (diff) | |
download | bcm5719-llvm-5abfe97bf113753b59a47672774e935e867aeb24.tar.gz bcm5719-llvm-5abfe97bf113753b59a47672774e935e867aeb24.zip |
sink a call to getInstantiationLoc to eliminate an assertion.
llvm-svn: 64755
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/Driver/TextDiagnosticPrinter.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/Driver/TextDiagnosticPrinter.cpp b/clang/lib/Driver/TextDiagnosticPrinter.cpp index 64214354264..c6a8a23facc 100644 --- a/clang/lib/Driver/TextDiagnosticPrinter.cpp +++ b/clang/lib/Driver/TextDiagnosticPrinter.cpp @@ -104,7 +104,9 @@ void TextDiagnosticPrinter::HighlightRange(const SourceRange &R, 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 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level, // 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(); |