FW: [PATCH] Fix failure to find header in module build

Thompson, John John_Thompson at playstation.sony.com
Mon Jan 13 15:37:21 PST 2014


Hi,

Anyone care to comment on this?

Thanks.

-John

-----Original Message-----
From: cfe-commits-bounces at cs.uiuc.edu [mailto:cfe-commits-bounces at cs.uiuc.edu] On Behalf Of John Thompson
Sent: Friday, January 10, 2014 3:16 PM
To: richard at metafoo.co.uk; john.thompson.jtsoftware at gmail.com
Cc: cfe-commits at cs.uiuc.edu
Subject: [PATCH] Fix failure to find header in module build

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: D2536.1.patch
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140113/d3acef7c/attachment.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ATT00001.txt
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140113/d3acef7c/attachment.txt>


More information about the cfe-commits mailing list