From d23fd9aa52efc751322fbf7a3fc125ce58d44e4c Mon Sep 17 00:00:00 2001 From: Ben Langmuir Date: Thu, 15 May 2014 16:20:33 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208901 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Lex/HeaderSearch.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/Lex/HeaderSearch.cpp b/lib/Lex/HeaderSearch.cpp index 87a5053628..6d68c38a2c 100644 --- a/lib/Lex/HeaderSearch.cpp +++ b/lib/Lex/HeaderSearch.cpp @@ -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) { -- 2.40.0