[PATCH] Fix failure to find header in module build

John Thompson john.thompson.jtsoftware at gmail.com
Fri Jan 10 15:16:15 PST 2014


Hi rsmith,

This is a stab at fixing the problem where a module build fails to find a header in the case where relative -I header search paths are used.  I don't know if it's the right approach, but it passes the tests and fixes my example using relative paths in -I options.

http://llvm-reviews.chandlerc.com/D2536

Files:
  lib/Lex/HeaderSearch.cpp

Index: lib/Lex/HeaderSearch.cpp
===================================================================
--- lib/Lex/HeaderSearch.cpp
+++ lib/Lex/HeaderSearch.cpp
@@ -690,6 +690,17 @@
     }
   }
 
+  // If no includers (as in case of module build), and not an angled
+  // include, do a final check in the current directory
+  if (Includers.empty() && !isAngled && !NoCurDirSearch) {
+    const FileEntry *Result = FileMgr.getFile(Filename, /*openFile=*/true);
+    if (Result) {
+      CacheLookup.second
+        = LookupFileCache.GetOrCreateValue(Filename).getValue().second;
+      return Result;
+    }
+  }
+
   // Otherwise, didn't find it. Remember we didn't find this.
   CacheLookup.second = SearchDirs.size();
   return 0;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2536.1.patch
Type: text/x-patch
Size: 747 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140110/50b09cda/attachment.bin>


More information about the cfe-commits mailing list