Keep track of import dependencies between submodules within the module
that's currently being built. This is important for supporting
transitive dependencies ("export *" in the module map) completely.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146156 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Lex/HeaderSearch.cpp b/lib/Lex/HeaderSearch.cpp
index 9a7230c..b0668c5 100644
--- a/lib/Lex/HeaderSearch.cpp
+++ b/lib/Lex/HeaderSearch.cpp
@@ -197,7 +197,6 @@
     HeaderSearch &HS,
     SmallVectorImpl<char> *SearchPath,
     SmallVectorImpl<char> *RelativePath,
-    StringRef BuildingModule,
     Module **SuggestedModule) const {
   llvm::SmallString<1024> TmpDir;
   if (isNormalDir()) {
@@ -224,10 +223,7 @@
       
       // If there is a module that corresponds to this header, 
       // suggest it.
-      Module *Module = HS.findModuleForHeader(File);
-      if (Module && Module->getTopLevelModuleName() != BuildingModule)
-        *SuggestedModule = Module;
-      
+      *SuggestedModule = HS.findModuleForHeader(File);
       return File;
     }
     
@@ -236,7 +232,7 @@
 
   if (isFramework())
     return DoFrameworkLookup(Filename, HS, SearchPath, RelativePath,
-                             BuildingModule, SuggestedModule);
+                             SuggestedModule);
 
   assert(isHeaderMap() && "Unknown directory lookup");
   const FileEntry * const Result = getHeaderMap()->LookupFile(
@@ -263,7 +259,6 @@
     HeaderSearch &HS,
     SmallVectorImpl<char> *SearchPath,
     SmallVectorImpl<char> *RelativePath,
-    StringRef BuildingModule,
     Module **SuggestedModule) const 
 {
   FileManager &FileMgr = HS.getFileMgr();
@@ -322,11 +317,8 @@
   Module *Module = 0;
   if (SuggestedModule) {
     if (const DirectoryEntry *FrameworkDir
-                                    = FileMgr.getDirectory(FrameworkName)) {
-      if ((Module = HS.getFrameworkModule(ModuleName, FrameworkDir)) &&
-          Module->Name == BuildingModule)
-        Module = 0;
-    }
+                                    = FileMgr.getDirectory(FrameworkName))
+      Module = HS.getFrameworkModule(ModuleName, FrameworkDir);
   }
   
   // Check "/System/Library/Frameworks/Cocoa.framework/Headers/file.h"
@@ -475,7 +467,7 @@
   for (; i != SearchDirs.size(); ++i) {
     const FileEntry *FE =
       SearchDirs[i].LookupFile(Filename, *this, SearchPath, RelativePath,
-                               BuildingModule, SuggestedModule);
+                               SuggestedModule);
     if (!FE) continue;
 
     CurDir = &SearchDirs[i];