diff options
author | Reid Kleckner <rnk@google.com> | 2015-10-20 18:45:57 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2015-10-20 18:45:57 +0000 |
commit | afb9aaefe36fcf038b0193c6eb7c680404667811 (patch) | |
tree | 8d06b1a49944c0e15e4afd0f2e93cd1c2577d407 | |
parent | c8925b18719f5ee2da586a3f41b3e143c5d3466a (diff) | |
download | bcm5719-llvm-afb9aaefe36fcf038b0193c6eb7c680404667811.tar.gz bcm5719-llvm-afb9aaefe36fcf038b0193c6eb7c680404667811.zip |
Add back null check removed accidentally in r250554
Fixes PR25262
llvm-svn: 250844
-rw-r--r-- | clang/lib/Lex/HeaderSearch.cpp | 2 | ||||
-rw-r--r-- | clang/test/Frontend/force-include-not-found.c | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp index 469d782deb3..8a686a7f3d7 100644 --- a/clang/lib/Lex/HeaderSearch.cpp +++ b/clang/lib/Lex/HeaderSearch.cpp @@ -256,6 +256,8 @@ const FileEntry *HeaderSearch::getFileAndSuggestModule( // If we have a module map that might map this header, load it and // check whether we'll have a suggestion for a module. const FileEntry *File = getFileMgr().getFile(FileName, /*OpenFile=*/true); + if (!File) + return nullptr; // If there is a module that corresponds to this header, suggest it. if (!findUsableModuleForHeader(File, Dir ? Dir : File->getDir(), diff --git a/clang/test/Frontend/force-include-not-found.c b/clang/test/Frontend/force-include-not-found.c new file mode 100644 index 00000000000..191cf9d403d --- /dev/null +++ b/clang/test/Frontend/force-include-not-found.c @@ -0,0 +1,3 @@ +// RUN: not %clang_cc1 %s -include "/abspath/missing file with spaces.h" 2>&1 | FileCheck %s +// CHECK: file not found +int main() { } |