diff options
-rw-r--r-- | lib/Lex/HeaderSearch.cpp | 9 | ||||
-rw-r--r-- | test/Modules/auto-module-import.c | 11 |
2 files changed, 14 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; } diff --git a/test/Modules/auto-module-import.c b/test/Modules/auto-module-import.c index 51e9ee2d03..783b53d068 100644 --- a/test/Modules/auto-module-import.c +++ b/test/Modules/auto-module-import.c @@ -18,3 +18,14 @@ Module *mod; // expected-error{{unknown type name 'Module'}} Module *mod2; int getDependsOther() { return depends_on_module_other; } + +void testSubframeworkOther() { + double *sfo1 = sub_framework_other; // expected-error{{use of undeclared identifier 'sub_framework_other'}} +} + +// Test header cross-subframework include pattern. +#include <DependsOnModule/../Frameworks/SubFramework.framework/Headers/Other.h> // expected-warning{{treating #include as an import of module 'DependsOnModule.SubFramework'}} + +void testSubframeworkOtherAgain() { + double *sfo1 = sub_framework_other; +} |