diff options
author | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2017-03-21 16:43:51 +0000 |
---|---|---|
committer | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2017-03-21 16:43:51 +0000 |
commit | 08ebd61a80b3a0c68675a75bdff984fd2b7c6b39 (patch) | |
tree | 96cfa4bf1bec1f7c03cf0ee5a45d032c91563186 /clang/lib/Lex/ModuleMap.cpp | |
parent | 5af82a7ae1eea8477be87bb9003aee5583003562 (diff) | |
download | bcm5719-llvm-08ebd61a80b3a0c68675a75bdff984fd2b7c6b39.tar.gz bcm5719-llvm-08ebd61a80b3a0c68675a75bdff984fd2b7c6b39.zip |
[Modules] Find PrivateHeaders when looking into subframeworks
Fix the current parsing of subframeworks in modulemaps to lookup for
headers based on whether they are frameworks.
rdar://problem/30563982
llvm-svn: 298391
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
-rw-r--r-- | clang/lib/Lex/ModuleMap.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index 384e5707dca..61ad5948cd5 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/lib/Lex/ModuleMap.cpp @@ -1841,7 +1841,7 @@ void ModuleMapParser::parseHeaderDecl(MMToken::TokenKind LeadingToken, Module::UnresolvedHeaderDirective Header; Header.FileName = Tok.getString(); Header.FileNameLoc = consumeToken(); - + // Check whether we already have an umbrella. if (LeadingToken == MMToken::UmbrellaKeyword && ActiveModule->Umbrella) { Diags.Report(Header.FileNameLoc, diag::err_mmap_umbrella_clash) @@ -1861,19 +1861,25 @@ void ModuleMapParser::parseHeaderDecl(MMToken::TokenKind LeadingToken, // Search for the header file within the search directory. SmallString<128> FullPathName(Directory->getName()); unsigned FullPathLength = FullPathName.size(); - + if (ActiveModule->isPartOfFramework()) { appendSubframeworkPaths(ActiveModule, RelativePathName); - + unsigned RelativePathLength = RelativePathName.size(); + // Check whether this file is in the public headers. llvm::sys::path::append(RelativePathName, "Headers", Header.FileName); llvm::sys::path::append(FullPathName, RelativePathName); File = SourceMgr.getFileManager().getFile(FullPathName); - + + // Check whether this file is in the private headers. if (!File) { - // Check whether this file is in the private headers. - // FIXME: Should we retain the subframework paths here? - RelativePathName.clear(); + // Ideally, private modules in the form 'FrameworkName.Private' should + // be defined as 'module FrameworkName.Private', and not as + // 'framework module FrameworkName.Private', since a 'Private.Framework' + // does not usually exist. However, since both are currently widely used + // for private modules, make sure we find the right path in both cases. + RelativePathName.resize(ActiveModule->IsFramework ? 0 + : RelativePathLength); FullPathName.resize(FullPathLength); llvm::sys::path::append(RelativePathName, "PrivateHeaders", Header.FileName); |