From 8927c19a5ed03bef55dac4b623688387bcc794dc Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 22 Jun 2009 08:08:35 +0000 Subject: Update Clang sources to r73879. --- lib/Frontend/TextDiagnosticPrinter.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lib/Frontend/TextDiagnosticPrinter.cpp') diff --git a/lib/Frontend/TextDiagnosticPrinter.cpp b/lib/Frontend/TextDiagnosticPrinter.cpp index 6699c65..d4c7e0f 100644 --- a/lib/Frontend/TextDiagnosticPrinter.cpp +++ b/lib/Frontend/TextDiagnosticPrinter.cpp @@ -640,9 +640,18 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level, SourceLocation B = Info.getRange(i).getBegin(); SourceLocation E = Info.getRange(i).getEnd(); - std::pair BInfo=SM.getDecomposedInstantiationLoc(B); - + B = SM.getInstantiationLoc(B); E = SM.getInstantiationLoc(E); + + // If the End location and the start location are the same and are a + // macro location, then the range was something that came from a macro + // expansion or _Pragma. If this is an object-like macro, the best we + // can do is to highlight the range. If this is a function-like + // macro, we'd also like to highlight the arguments. + if (B == E && Info.getRange(i).getEnd().isMacroID()) + E = SM.getInstantiationRange(Info.getRange(i).getEnd()).second; + + std::pair BInfo = SM.getDecomposedLoc(B); std::pair EInfo = SM.getDecomposedLoc(E); // If the start or end of the range is in another file, just discard -- cgit v1.1