mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 12:26:52 +08:00
[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
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
// B.h
|
||||
@@ -0,0 +1,2 @@
|
||||
// Sub.h
|
||||
#import "B.h"
|
||||
@@ -0,0 +1 @@
|
||||
// BPriv.h
|
||||
@@ -0,0 +1 @@
|
||||
#import "BPriv.h"
|
||||
1
clang/test/Modules/Inputs/Main.framework/Headers/A.h
Normal file
1
clang/test/Modules/Inputs/Main.framework/Headers/A.h
Normal file
@@ -0,0 +1 @@
|
||||
// A.h
|
||||
2
clang/test/Modules/Inputs/Main.framework/Headers/Main.h
Normal file
2
clang/test/Modules/Inputs/Main.framework/Headers/Main.h
Normal file
@@ -0,0 +1,2 @@
|
||||
// Main.h
|
||||
#import "A.h"
|
||||
@@ -0,0 +1,12 @@
|
||||
framework module Main {
|
||||
umbrella header "Main.h"
|
||||
|
||||
module * { export * }
|
||||
export *
|
||||
|
||||
framework module Sub {
|
||||
umbrella header "Sub.h"
|
||||
module * { export * }
|
||||
export *
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
module Main.Private {
|
||||
umbrella header "MainPriv.h"
|
||||
module * { export * }
|
||||
export *
|
||||
}
|
||||
|
||||
module Main.Sub.Private {
|
||||
umbrella header "SubPriv.h"
|
||||
module * { export * }
|
||||
export *
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
// APriv.h
|
||||
@@ -0,0 +1 @@
|
||||
#import "APriv.h"
|
||||
2
clang/test/Modules/find-privateheaders.m
Normal file
2
clang/test/Modules/find-privateheaders.m
Normal file
@@ -0,0 +1,2 @@
|
||||
// RUN: %clang_cc1 -fmodules -fsyntax-only -F%S/Inputs %s
|
||||
#import "Main/Main.h"
|
||||
Reference in New Issue
Block a user