diff options
| author | Ben Langmuir <blangmuir@apple.com> | 2014-03-20 18:27:26 +0000 |
|---|---|---|
| committer | Ben Langmuir <blangmuir@apple.com> | 2014-03-20 18:27:26 +0000 |
| commit | 8ce754cfcf5c56f67d8b4901770779b04ccada91 (patch) | |
| tree | 54fae12c56165dc9b5aa69cb6e2496258f3c0fda /lib/Lex/HeaderSearch.cpp | |
| parent | e896106ae063b3c12432095624e543ed8eadee0b (diff) | |
| download | clang-8ce754cfcf5c56f67d8b4901770779b04ccada91.tar.gz clang-8ce754cfcf5c56f67d8b4901770779b04ccada91.tar.bz2 clang-8ce754cfcf5c56f67d8b4901770779b04ccada91.tar.xz | |
Prevent lookup of subframework modules by name without parent framework
We were 'allowing' the following import
@import Sub;
where Sub is a subframework of Foo and we had a -F path inside
Foo.framework/Frameworks and no module map file for Sub. This would
later hit assertion failures in debug builds.
Now we should correctly diagnose this as a module not found error.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204368 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/HeaderSearch.cpp')
| -rw-r--r-- | lib/Lex/HeaderSearch.cpp | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/lib/Lex/HeaderSearch.cpp b/lib/Lex/HeaderSearch.cpp index 685b3efd57..e9f6bb3ac0 100644 --- a/lib/Lex/HeaderSearch.cpp +++ b/lib/Lex/HeaderSearch.cpp @@ -1223,30 +1223,9 @@ Module *HeaderSearch::loadFrameworkModule(StringRef Name, return ModMap.findModule(Name); } - // Figure out the top-level framework directory and the submodule path from - // that top-level framework to the requested framework. - SmallVector<std::string, 2> SubmodulePath; - SubmodulePath.push_back(Name); - const DirectoryEntry *TopFrameworkDir - = ::getTopFrameworkDir(FileMgr, Dir->getName(), SubmodulePath); - - - // Try to infer a module map from the top-level framework directory. - Module *Result = ModMap.inferFrameworkModule(SubmodulePath.back(), - TopFrameworkDir, - IsSystem, - /*Parent=*/0); - if (!Result) - return 0; - - // Follow the submodule path to find the requested (sub)framework module - // within the top-level framework module. - SubmodulePath.pop_back(); - while (!SubmodulePath.empty() && Result) { - Result = ModMap.lookupModuleQualified(SubmodulePath.back(), Result); - SubmodulePath.pop_back(); - } - return Result; + + // Try to infer a module map from the framework directory. + return ModMap.inferFrameworkModule(Name, Dir, IsSystem, /*Parent=*/0); } |
