diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-12-06 17:31:28 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-12-06 17:31:28 +0000 |
commit | 356f3d4b530133630c71acfe50937fee2ca50789 (patch) | |
tree | 2e24c890e4eee51563ebb8329b2f2a0eaa83a0ff /clang/lib/Lex/HeaderSearch.cpp | |
parent | f2161a70aae2868fc9ad70a604dce41f0eb0bcd6 (diff) | |
download | bcm5719-llvm-356f3d4b530133630c71acfe50937fee2ca50789.tar.gz bcm5719-llvm-356f3d4b530133630c71acfe50937fee2ca50789.zip |
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.
llvm-svn: 145942
Diffstat (limited to 'clang/lib/Lex/HeaderSearch.cpp')
-rw-r--r-- | clang/lib/Lex/HeaderSearch.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/clang/lib/Lex/HeaderSearch.cpp b/clang/lib/Lex/HeaderSearch.cpp index 1d560fca024..f090e031743 100644 --- a/clang/lib/Lex/HeaderSearch.cpp +++ b/clang/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; } |