[PATCH] Modules - fix exclude header with umbrella directory

John Thompson john.thompson.jtsoftware at gmail.com
Fri Mar 14 18:59:31 PDT 2014


Hi rsmith,

This patch removes some code that seems to interfere with clang handling "exclude header" fields correctly.  "exclude header" fields in the module map should always be relative to the module map, not the umbrella directory.  This still needs a test case, which I'll get to next, if this seems correct.  Tracing in the debugger shows that the exclude is handled correctly, and all clang "test" tests pass.


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

Files:
  lib/Lex/ModuleMap.cpp

Index: lib/Lex/ModuleMap.cpp
===================================================================
--- lib/Lex/ModuleMap.cpp
+++ lib/Lex/ModuleMap.cpp
@@ -976,8 +976,6 @@
     void parseConflict();
     void parseInferredModuleDecl(bool Framework, bool Explicit);
     bool parseOptionalAttributes(Attributes &Attrs);
-
-    const DirectoryEntry *getOverriddenHeaderSearchDir();
     
   public:
     explicit ModuleMapParser(Lexer &L, SourceManager &SourceMgr, 
@@ -1590,10 +1588,6 @@
   if (llvm::sys::path::is_absolute(Header.FileName)) {
     PathName = Header.FileName;
     File = SourceMgr.getFileManager().getFile(PathName);
-  } else if (const DirectoryEntry *Dir = getOverriddenHeaderSearchDir()) {
-    PathName = Dir->getName();
-    llvm::sys::path::append(PathName, Header.FileName);
-    File = SourceMgr.getFileManager().getFile(PathName);
   } else {
     // Search for the header file within the search directory.
     PathName = Directory->getName();
@@ -2145,22 +2139,6 @@
   return HadError;
 }
 
-/// \brief If there is a specific header search directory due the presence
-/// of an umbrella directory, retrieve that directory. Otherwise, returns null.
-const DirectoryEntry *ModuleMapParser::getOverriddenHeaderSearchDir() {
-  for (Module *Mod = ActiveModule; Mod; Mod = Mod->Parent) {
-    // If we have an umbrella directory, use that.
-    if (Mod->hasUmbrellaDir())
-      return Mod->getUmbrellaDir();
-    
-    // If we have a framework directory, stop looking.
-    if (Mod->IsFramework)
-      return 0;
-  }
-  
-  return 0;
-}
-
 /// \brief Parse a module map file.
 ///
 ///   module-map-file:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3090.1.patch
Type: text/x-patch
Size: 1628 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140314/4c929d14/attachment.bin>


More information about the cfe-commits mailing list