]> granicus.if.org Git - clang/commitdiff
Use the virtual name of headers when searching for a module
authorBen Langmuir <blangmuir@apple.com>
Thu, 15 May 2014 16:20:33 +0000 (16:20 +0000)
committerBen Langmuir <blangmuir@apple.com>
Thu, 15 May 2014 16:20:33 +0000 (16:20 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208901 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/HeaderSearch.cpp

index 87a5053628a512e2008e81b5cf93a1f6a97581d8..6d68c38a2c1f8ea0753fd4691dff1aa0c81ea417 100644 (file)
@@ -483,14 +483,9 @@ const FileEntry *DirectoryLookup::DoFrameworkLookup(
   // 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::DoFrameworkLookup(
         FoundFramework = true;
         break;
       }
+
+      // Get the parent directory name.
+      FrameworkPath = llvm::sys::path::parent_path(FrameworkPath);
+      if (FrameworkPath.empty())
+        break;
     } while (true);
 
     if (FoundFramework) {