r208901 - Use the virtual name of headers when searching for a module
    Ben Langmuir 
    blangmuir at apple.com
       
    Thu May 15 09:20:33 PDT 2014
    
    
  
Author: benlangmuir
Date: Thu May 15 11:20:33 2014
New Revision: 208901
URL: http://llvm.org/viewvc/llvm-project?rev=208901&view=rev
Log:
Use the virtual name of headers when searching for a module
When using the VFS, we want the virtual header location when searching
for a framework module, since that will be the one in the correct
directory structure for the module.
I'll add a regression test once I finish reducing the larger one I have.
Modified:
    cfe/trunk/lib/Lex/HeaderSearch.cpp
Modified: cfe/trunk/lib/Lex/HeaderSearch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/HeaderSearch.cpp?rev=208901&r1=208900&r2=208901&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/HeaderSearch.cpp (original)
+++ cfe/trunk/lib/Lex/HeaderSearch.cpp Thu May 15 11:20:33 2014
@@ -483,14 +483,9 @@ const FileEntry *DirectoryLookup::DoFram
   // If we found the header and are allowed to suggest a module, do so now.
   if (FE && SuggestedModule) {
     // Find the framework in which this header occurs.
-    StringRef FrameworkPath = FE->getName();
+    StringRef FrameworkPath = FE->getDir()->getName();
     bool FoundFramework = false;
     do {
-      // Get the parent directory name.
-      FrameworkPath = llvm::sys::path::parent_path(FrameworkPath);
-      if (FrameworkPath.empty())
-        break;
-
       // Determine whether this directory exists.
       const DirectoryEntry *Dir = FileMgr.getDirectory(FrameworkPath);
       if (!Dir)
@@ -502,6 +497,11 @@ const FileEntry *DirectoryLookup::DoFram
         FoundFramework = true;
         break;
       }
+
+      // Get the parent directory name.
+      FrameworkPath = llvm::sys::path::parent_path(FrameworkPath);
+      if (FrameworkPath.empty())
+        break;
     } while (true);
 
     if (FoundFramework) {
    
    
More information about the cfe-commits
mailing list