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;
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;
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to