mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #61606 from NuriAmari/fwd-declarations
Import Forward Declared Objective-C Interfaces and Protocols
This commit is contained in:
@@ -1280,7 +1280,9 @@ static bool ValidateModulesOnceOptions(const ClangImporterOptions &Opts,
|
||||
static bool ParseClangImporterArgs(ClangImporterOptions &Opts,
|
||||
ArgList &Args,
|
||||
DiagnosticEngine &Diags,
|
||||
StringRef workingDirectory) {
|
||||
StringRef workingDirectory,
|
||||
const LangOptions &LangOpts,
|
||||
const FrontendOptions &FrontendOpts) {
|
||||
using namespace options;
|
||||
|
||||
if (const Arg *a = Args.getLastArg(OPT_tools_directory)) {
|
||||
@@ -1348,6 +1350,15 @@ static bool ParseClangImporterArgs(ClangImporterOptions &Opts,
|
||||
|
||||
Opts.DumpClangDiagnostics |= Args.hasArg(OPT_dump_clang_diagnostics);
|
||||
|
||||
// When the repl is invoked directly (ie. `lldb --repl="..."`) the action
|
||||
// type seems to be NoneAction.
|
||||
if (FrontendOpts.RequestedAction != FrontendOptions::ActionType::REPL &&
|
||||
FrontendOpts.RequestedAction != FrontendOptions::ActionType::NoneAction &&
|
||||
(Args.hasArg(OPT_enable_import_objc_forward_declarations) ||
|
||||
LangOpts.isSwiftVersionAtLeast(6))) {
|
||||
Opts.ImportForwardDeclarations = true;
|
||||
}
|
||||
|
||||
if (Args.hasArg(OPT_embed_bitcode))
|
||||
Opts.Mode = ClangImporterOptions::Modes::EmbedBitcode;
|
||||
else if (Args.hasArg(OPT_emit_pcm) || Args.hasArg(OPT_dump_pcm))
|
||||
@@ -2756,7 +2767,7 @@ bool CompilerInvocation::parseArgs(
|
||||
}
|
||||
|
||||
if (ParseClangImporterArgs(ClangImporterOpts, ParsedArgs, Diags,
|
||||
workingDirectory)) {
|
||||
workingDirectory, LangOpts, FrontendOpts)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user