aboutsummaryrefslogtreecommitdiff
path: root/lib/Driver/TextDiagnosticPrinter.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-02-17 07:54:55 +0000
committerChris Lattner <sabre@nondot.org>2009-02-17 07:54:55 +0000
commit49a48eb432862117aeb2ed137b8ac83da39352dd (patch)
tree1ffe139fa8d69971206f67b12f459be2ca81a7ce /lib/Driver/TextDiagnosticPrinter.cpp
parentb88af81958b4438a04175ea46d3b4c109ad4625e (diff)
sink a call to getInstantiationLoc to eliminate an assertion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64755 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/TextDiagnosticPrinter.cpp')
-rw-r--r--lib/Driver/TextDiagnosticPrinter.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Driver/TextDiagnosticPrinter.cpp b/lib/Driver/TextDiagnosticPrinter.cpp
index 6421435426..c6a8a23fac 100644
--- a/lib/Driver/TextDiagnosticPrinter.cpp
+++ b/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();