mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Introduce "-internal" variant of bridging header import flags
The flags "-import-bridging-header" and "-import-pch" import a bridging header, treating the contents as a public import. Introduce "internal-" variants of both flags that provide the same semantics, but are intended to treat the imported contents as if they came in through an internal import. This is just plumbing of the options for the moment.
This commit is contained in:
@@ -363,6 +363,8 @@ setBridgingHeaderFromFrontendOptions(ClangImporterOptions &ImporterOpts,
|
||||
if (!FrontendOpts.InputsAndOutputs.hasInputs())
|
||||
return;
|
||||
|
||||
ImporterOpts.BridgingHeaderIsInternal = FrontendOpts.ImportHeaderAsInternal;
|
||||
|
||||
// If we aren't asked to output a bridging header, we don't need to set this.
|
||||
if (ImporterOpts.PrecompiledHeaderOutputDir.empty())
|
||||
return;
|
||||
@@ -2109,10 +2111,24 @@ static bool ParseClangImporterArgs(ClangImporterOptions &Opts, ArgList &Args,
|
||||
else if (Args.hasArg(OPT_emit_pcm) || Args.hasArg(OPT_dump_pcm))
|
||||
Opts.Mode = ClangImporterOptions::Modes::PrecompiledModule;
|
||||
|
||||
if (auto *A = Args.getLastArg(OPT_import_bridging_header))
|
||||
bool hadNormalBridgingHeader = false;
|
||||
if (auto *A = Args.getLastArg(OPT_import_bridging_header,
|
||||
OPT_internal_import_bridging_header)) {
|
||||
Opts.BridgingHeader = A->getValue();
|
||||
if (auto *A = Args.getLastArg(OPT_import_pch))
|
||||
Opts.BridgingHeaderIsInternal =
|
||||
A->getOption().getID() == OPT_internal_import_bridging_header;
|
||||
}
|
||||
if (auto *A = Args.getLastArg(OPT_import_pch, OPT_internal_import_pch)) {
|
||||
Opts.BridgingHeaderPCH = A->getValue();
|
||||
bool importAsInternal = A->getOption().getID() == OPT_internal_import_pch;
|
||||
if (hadNormalBridgingHeader &&
|
||||
importAsInternal != Opts.BridgingHeaderIsInternal) {
|
||||
Diags.diagnose(SourceLoc(),
|
||||
diag::bridging_header_and_pch_internal_mismatch);
|
||||
}
|
||||
Opts.BridgingHeaderIsInternal = importAsInternal;
|
||||
}
|
||||
|
||||
Opts.DisableSwiftBridgeAttr |= Args.hasArg(OPT_disable_swift_bridge_attr);
|
||||
|
||||
Opts.DisableOverlayModules |= Args.hasArg(OPT_emit_imported_modules);
|
||||
|
||||
Reference in New Issue
Block a user