aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex/HeaderSearch.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-12-06 17:31:28 +0000
committerDouglas Gregor <dgregor@apple.com>2011-12-06 17:31:28 +0000
commit09833925a3ac68065565e9556d06e9576ec6eaa9 (patch)
tree7b9df1ff2c7260e6d5139fcec0cbfa2255d6d1d7 /lib/Lex/HeaderSearch.cpp
parentd620a84a01cc232a9449dbcc2c40bd43ca314fc9 (diff)
When suggesting a module import for a #include or #import, suggest the
most specific (sub)module based on the actual file we find, rather than always importing the top-level module. This means that #include'ing <Foo/Blah.h> should give us the submodule Foo.Blah. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145942 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/HeaderSearch.cpp')
-rw-r--r--lib/Lex/HeaderSearch.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/Lex/HeaderSearch.cpp b/lib/Lex/HeaderSearch.cpp
index 1d560fca02..f090e03174 100644
--- a/lib/Lex/HeaderSearch.cpp
+++ b/lib/Lex/HeaderSearch.cpp
@@ -341,15 +341,12 @@ const FileEntry *DirectoryLookup::DoFrameworkLookup(
}
// Determine whether this is the module we're building or not.
- // FIXME: Do we still need the ".." hack?
- bool AutomaticImport = Module &&
- !Filename.substr(SlashPos + 1).startswith("..");
-
+ bool AutomaticImport = Module;
FrameworkName.append(Filename.begin()+SlashPos+1, Filename.end());
if (const FileEntry *FE = FileMgr.getFile(FrameworkName.str(),
/*openFile=*/!AutomaticImport)) {
if (AutomaticImport)
- *SuggestedModule = Module;
+ *SuggestedModule = HS.findModuleForHeader(FE);
return FE;
}
@@ -364,7 +361,7 @@ const FileEntry *DirectoryLookup::DoFrameworkLookup(
const FileEntry *FE = FileMgr.getFile(FrameworkName.str(),
/*openFile=*/!AutomaticImport);
if (FE && AutomaticImport)
- *SuggestedModule = Module;
+ *SuggestedModule = HS.findModuleForHeader(FE);
return FE;
}