diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2012-12-18 00:52:36 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2012-12-18 00:52:36 +0000 |
commit | 672845bcde0c0d49b133b50110b5229e158a7ef7 (patch) | |
tree | 3d8e5175114df373cc0b14b80fa0a8eea70fcf4b /clang/lib/Frontend | |
parent | f53f5785674af89c021c8b3aa54552231273bb35 (diff) | |
download | bcm5719-llvm-672845bcde0c0d49b133b50110b5229e158a7ef7.tar.gz bcm5719-llvm-672845bcde0c0d49b133b50110b5229e158a7ef7.zip |
More conservative fix for <rdar://problem/12847524> (a crash printing diagnostic ranges).
I'm not really happy with this fix, but I'm confident it's correct.
llvm-svn: 170397
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r-- | clang/lib/Frontend/DiagnosticRenderer.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Frontend/DiagnosticRenderer.cpp b/clang/lib/Frontend/DiagnosticRenderer.cpp index 89d3867aadd..88a8706731c 100644 --- a/clang/lib/Frontend/DiagnosticRenderer.cpp +++ b/clang/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. |