r250844 - Add back null check removed accidentally in r250554

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 20 11:45:57 PDT 2015


Author: rnk
Date: Tue Oct 20 13:45:57 2015
New Revision: 250844

URL: http://llvm.org/viewvc/llvm-project?rev=250844&view=rev
Log:
Add back null check removed accidentally in r250554

Fixes PR25262

Added:
    cfe/trunk/test/Frontend/force-include-not-found.c
Modified:
    cfe/trunk/lib/Lex/HeaderSearch.cpp

Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=250844&r1=250843&r2=250844&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/HeaderSearch.cpp (original)
+++ cfe/trunk/lib/Lex/HeaderSearch.cpp Tue Oct 20 13:45:57 2015
@@ -256,6 +256,8 @@ const FileEntry *HeaderSearch::getFileAn
   // 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(),

Added: cfe/trunk/test/Frontend/force-include-not-found.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/force-include-not-found.c?rev=250844&view=auto
==============================================================================
--- cfe/trunk/test/Frontend/force-include-not-found.c (added)
+++ cfe/trunk/test/Frontend/force-include-not-found.c Tue Oct 20 13:45:57 2015
@@ -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() { }




More information about the cfe-commits mailing list