]> granicus.if.org Git - clang/commitdiff
don't crash on invalid ranges in -fprint-source-range-info
authorChris Lattner <sabre@nondot.org>
Sun, 19 Apr 2009 22:24:10 +0000 (22:24 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 19 Apr 2009 22:24:10 +0000 (22:24 +0000)
mode, just ignore them as usual.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69558 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/TextDiagnosticPrinter.cpp

index 7d3c4c23ffd6a9b06c895321a135ec0a455f8a96..0dd71d7bb38a125114792104112f2856f5e558ce 100644 (file)
@@ -267,6 +267,9 @@ void TextDiagnosticPrinter::HandleDiagnostic(Diagnostic::Level Level,
         bool PrintedRange = false;
         
         for (unsigned i = 0, e = Info.getNumRanges(); i != e; ++i) {
+          // Ignore invalid ranges.
+          if (!Info.getRange(i).isValid()) continue;
+
           SourceLocation B = Info.getRange(i).getBegin();
           SourceLocation E = Info.getRange(i).getEnd();
           std::pair<FileID, unsigned> BInfo=SM.getDecomposedInstantiationLoc(B);