summaryrefslogtreecommitdiff
path: root/lib/Lex/HeaderSearch.cpp
diff options
context:
space:
mode:
authorVolodymyr Sapsai <vsapsai@apple.com>2019-05-27 19:15:30 +0000
committerVolodymyr Sapsai <vsapsai@apple.com>2019-05-27 19:15:30 +0000
commitb84e04d4c031c8ff9a1a6875381f4a34b923cad7 (patch)
tree1174c0683bd1eb49be40ad897cfd78d8ec4881ed /lib/Lex/HeaderSearch.cpp
parent3098b618c7d10cd82cfe977b53a76df8b822266b (diff)
downloadclang-b84e04d4c031c8ff9a1a6875381f4a34b923cad7.tar.gz
[Preprocessor] Fix crash emitting note with framework location for "file not found" error.
A filename can be remapped with a header map to point to a framework header and we can find the corresponding framework without the header. But if the original filename doesn't have a remapped framework name, we'll fail to find its location and will dereference a null pointer during diagnostics emission. Fix by tracking remappings better and emit the note only if a framework is found before any of the remappings. rdar://problem/48883447 Reviewers: arphaman, erik.pilkington, jkorous Reviewed By: arphaman Subscribers: dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D61707 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@361779 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/HeaderSearch.cpp')
-rw-r--r--lib/Lex/HeaderSearch.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Lex/HeaderSearch.cpp b/lib/Lex/HeaderSearch.cpp
index af763059ea..16a53bf634 100644
--- a/lib/Lex/HeaderSearch.cpp
+++ b/lib/Lex/HeaderSearch.cpp
@@ -869,7 +869,10 @@ const FileEntry *HeaderSearch::LookupFile(
*IsMapped = true;
}
if (IsFrameworkFound)
- *IsFrameworkFound |= IsFrameworkFoundInDir;
+ // Because we keep a filename remapped for subsequent search directory
+ // lookups, ignore IsFrameworkFoundInDir after the first remapping and not
+ // just for remapping in a current search directory.
+ *IsFrameworkFound |= (IsFrameworkFoundInDir && !CacheLookup.MappedName);
if (!FE) continue;
CurDir = &SearchDirs[i];