[cfe-commits] r146074 - in /cfe/trunk: lib/Lex/HeaderSearch.cpp test/Modules/auto-module-import.m

Douglas Gregor dgregor at apple.com
Wed Dec 7 13:25:07 PST 2011


Author: dgregor
Date: Wed Dec  7 15:25:07 2011
New Revision: 146074

URL: http://llvm.org/viewvc/llvm-project?rev=146074&view=rev
Log:
Make sure we pick up module_private.map when loading a module.map file.

Modified:
    cfe/trunk/lib/Lex/HeaderSearch.cpp
    cfe/trunk/test/Modules/auto-module-import.m

Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=146074&r1=146073&r2=146074&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/HeaderSearch.cpp (original)
+++ cfe/trunk/lib/Lex/HeaderSearch.cpp Wed Dec  7 15:25:07 2011
@@ -799,7 +799,16 @@
     return !KnownDir->second;
   
   bool Result = ModMap.parseModuleMapFile(File);
-  DirectoryHasModuleMap[Dir] = !Result;
+  if (!Result && llvm::sys::path::filename(File->getName()) == "module.map") {
+    // If the file we loaded was a module.map, look for the corresponding
+    // module_private.map.
+    llvm::SmallString<128> PrivateFilename(Dir->getName());
+    llvm::sys::path::append(PrivateFilename, "module_private.map");
+    if (const FileEntry *PrivateFile = FileMgr.getFile(PrivateFilename))
+      Result = ModMap.parseModuleMapFile(PrivateFile);
+  }
+  
+  DirectoryHasModuleMap[Dir] = !Result;  
   return Result;
 }
 

Modified: cfe/trunk/test/Modules/auto-module-import.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/auto-module-import.m?rev=146074&r1=146073&r2=146074&view=diff
==============================================================================
--- cfe/trunk/test/Modules/auto-module-import.m (original)
+++ cfe/trunk/test/Modules/auto-module-import.m Wed Dec  7 15:25:07 2011
@@ -42,3 +42,5 @@
 
 // Test inclusion of private headers.
 #include <DependsOnModule/DependsOnModulePrivate.h> // expected-warning{{treating #include as an import of module 'DependsOnModule.Private.DependsOnModule'}}
+
+int getDependsOnModulePrivate() { return depends_on_module_private; }





More information about the cfe-commits mailing list