From adff43ad96defb28bad20d8335ab30beadd72ee8 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 18 Dec 2012 00:52:36 +0000 Subject: More conservative fix for (a crash printing diagnostic ranges). I'm not really happy with this fix, but I'm confident it's correct. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170397 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/DiagnosticRenderer.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/Frontend/DiagnosticRenderer.cpp') diff --git a/lib/Frontend/DiagnosticRenderer.cpp b/lib/Frontend/DiagnosticRenderer.cpp index 89d3867aad..88a8706731 100644 --- a/lib/Frontend/DiagnosticRenderer.cpp +++ b/lib/Frontend/DiagnosticRenderer.cpp @@ -363,6 +363,13 @@ static void mapDiagnosticRanges( End = SM->getImmediateExpansionRange(End).second; } BeginFileID = SM->getFileID(Begin); + if (BeginFileID != SM->getFileID(End)) { + // FIXME: Ugly hack to stop a crash; this code is making bad + // assumptions and it's too complicated for me to reason + // about. + Begin = End = SourceLocation(); + break; + } } // Return the spelling location of the beginning and end of the range. -- cgit v1.2.1