[Preprocessor] Fix crash emitting note with framework location for "file not found...
authorVolodymyr Sapsai <vsapsai@apple.com>
Mon, 27 May 2019 19:15:30 +0000 (19:15 +0000)
committerVolodymyr Sapsai <vsapsai@apple.com>
Mon, 27 May 2019 19:15:30 +0000 (19:15 +0000)
commite32ff096858578f526b6d05ab97c8f083f2e1834
tree5d29321aa293c805bb59fd1f8b7b81abb1ce4e73
parente13ae3e4d82b95ca1086f658de00402ffb6b128e
[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

llvm-svn: 361779
clang/include/clang/Lex/HeaderSearch.h
clang/lib/Lex/HeaderSearch.cpp
clang/test/Preprocessor/Inputs/include-header-missing-in-framework/TestFramework.hmap.json [new file with mode: 0644]
clang/test/Preprocessor/include-header-missing-in-framework-with-headermap.c [new file with mode: 0644]