Skip to content

Commit 9f44e2c

Browse files
author
Harlan Haskins
committed
[ParseableInterface] Add module arguments if using supplemental output maps
Currently, the check for whether to serialize parseable interface arguments doesn't handle the case where a supplementary output file map is used, preferring only to check if the frontend is passed `-emit*interface`. Instead, check if the frontend inputs and outputs contains a parseable interface, and use that to determine if we need to save args. This also puts `-module-link-name` in the parseable interface arg list.
1 parent 4381735 commit 9f44e2c

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

include/swift/Option/Options.td

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ def module_name_EQ : Joined<["-"], "module-name=">, Flags<[FrontendOption]>,
284284
Alias<module_name>;
285285

286286
def module_link_name : Separate<["-"], "module-link-name">,
287-
Flags<[FrontendOption]>,
287+
Flags<[FrontendOption, ParseableInterfaceOption]>,
288288
HelpText<"Library to link against when using this module">;
289289
def module_link_name_EQ : Joined<["-"], "module-link-name=">,
290290
Flags<[FrontendOption]>, Alias<module_link_name>;

lib/Frontend/ArgsToFrontendOutputsConverter.cpp

+10-8
Original file line numberDiff line numberDiff line change
@@ -507,14 +507,16 @@ createFromTypeToPathMap(const TypeToPathMap *map) {
507507

508508
Optional<std::vector<SupplementaryOutputPaths>>
509509
SupplementaryOutputPathsComputer::readSupplementaryOutputFileMap() const {
510-
if (Arg *A = Args.getLastArg(options::OPT_emit_objc_header_path,
511-
options::OPT_emit_module_path,
512-
options::OPT_emit_module_doc_path,
513-
options::OPT_emit_dependencies_path,
514-
options::OPT_emit_reference_dependencies_path,
515-
options::OPT_serialize_diagnostics_path,
516-
options::OPT_emit_loaded_module_trace_path,
517-
options::OPT_emit_tbd_path)) {
510+
if (Arg *A = Args.getLastArg(
511+
options::OPT_emit_objc_header_path,
512+
options::OPT_emit_module_path,
513+
options::OPT_emit_module_doc_path,
514+
options::OPT_emit_dependencies_path,
515+
options::OPT_emit_reference_dependencies_path,
516+
options::OPT_serialize_diagnostics_path,
517+
options::OPT_emit_loaded_module_trace_path,
518+
options::OPT_emit_parseable_module_interface_path,
519+
options::OPT_emit_tbd_path)) {
518520
Diags.diagnose(SourceLoc(),
519521
diag::error_cannot_have_supplementary_outputs,
520522
A->getSpelling(), "-supplementary-output-file-map");

lib/Frontend/CompilerInvocation.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ static void PrintArg(raw_ostream &OS, const char *Arg, StringRef TempDir) {
159159
/// Save a copy of any flags marked as ParseableInterfaceOption, if running
160160
/// in a mode that is going to emit a .swiftinterface file.
161161
static void SaveParseableInterfaceArgs(ParseableInterfaceOptions &Opts,
162+
FrontendOptions &FOpts,
162163
ArgList &Args, DiagnosticEngine &Diags) {
163-
if (!Args.hasArg(options::OPT_emit_interface_path) &&
164-
!Args.hasArg(options::OPT_emit_parseable_module_interface_path))
164+
if (!FOpts.InputsAndOutputs.hasParseableInterfaceOutputPath())
165165
return;
166166
ArgStringList RenderedArgs;
167167
for (auto A : Args) {
@@ -1188,13 +1188,14 @@ bool CompilerInvocation::parseArgs(
11881188
return true;
11891189
}
11901190

1191-
SaveParseableInterfaceArgs(ParseableInterfaceOpts, ParsedArgs, Diags);
1192-
11931191
if (ParseFrontendArgs(FrontendOpts, ParsedArgs, Diags,
11941192
ConfigurationFileBuffers)) {
11951193
return true;
11961194
}
11971195

1196+
SaveParseableInterfaceArgs(ParseableInterfaceOpts, FrontendOpts,
1197+
ParsedArgs, Diags);
1198+
11981199
if (ParseLangArgs(LangOpts, ParsedArgs, Diags, FrontendOpts)) {
11991200
return true;
12001201
}

0 commit comments

Comments
 (0)