Skip to content

Commit 3c04923

Browse files
author
Harlan Haskins
authored
[5.1] [ModuleInterfaces] Rename 'parseable interfaces' to 'module interfaces' (#24053)
* [ModuleInterfaces] Remove 'parseable' from command-line flags Leave the old flag in as an alias to the new flag, for transition purposes. Also go ahead and remove the long-deprecated and unused `emit-interface-path`. Part of rdar://49359734 * [ModuleInterfaces] Replace 'module file' with 'compiled module' ...only in diagnostics. And make the tests pass. rdar://49359734
1 parent 451cf27 commit 3c04923

24 files changed

+94
-79
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -606,16 +606,16 @@ ERROR(sema_opening_import,Fatal,
606606
ERROR(serialization_load_failed,Fatal,
607607
"failed to load module %0", (Identifier))
608608
ERROR(serialization_malformed_module,Fatal,
609-
"malformed module file: %0", (StringRef))
609+
"malformed compiled module: %0", (StringRef))
610610
ERROR(serialization_module_too_new,Fatal,
611-
"module file was created by a newer version of the compiler: %0",
611+
"compiled module was created by a newer version of the compiler: %0",
612612
(StringRef))
613613
ERROR(serialization_module_language_version_mismatch,Fatal,
614614
"module compiled with Swift %0 cannot be imported by the Swift %1 "
615615
"compiler: %2",
616616
(StringRef, StringRef, StringRef))
617617
ERROR(serialization_module_too_old,Fatal,
618-
"module file was created by an older version of the compiler; "
618+
"compiled module was created by an older version of the compiler; "
619619
"rebuild %0 and try again: %1",
620620
(Identifier, StringRef))
621621
ERROR(serialization_missing_single_dependency,Fatal,

include/swift/Frontend/FrontendOptions.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class FrontendOptions {
131131
MergeModules, ///< Merge modules only
132132

133133
/// Build from a swiftinterface, as close to `import` as possible
134-
BuildModuleFromParseableInterface,
134+
CompileModuleFromInterface,
135135

136136
EmitSIBGen, ///< Emit serialized AST + raw SIL
137137
EmitSIB, ///< Emit serialized AST + canonical SIL
@@ -269,8 +269,8 @@ class FrontendOptions {
269269
bool TrackSystemDeps = false;
270270

271271
/// Should we serialize the hashes of dependencies (vs. the modification
272-
/// times) when compiling a parseable module interface?
273-
bool SerializeParseableModuleInterfaceDependencyHashes = false;
272+
/// times) when compiling a module interface?
273+
bool SerializeModuleInterfaceDependencyHashes = false;
274274

275275
/// The different modes for validating TBD against the LLVM IR.
276276
enum class TBDValidationMode {

include/swift/Option/FrontendOptions.td

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ def emit_fixits_path
5959
: Separate<["-"], "emit-fixits-path">, MetaVarName<"<path>">,
6060
HelpText<"Output compiler fixits as source edits to <path>">;
6161

62-
// For transition purposes.
63-
def emit_interface_path
64-
: Separate<["-"], "emit-interface-path">,
65-
Alias<emit_parseable_module_interface_path>;
62+
def serialize_module_interface_dependency_hashes
63+
: Flag<["-"], "serialize-module-interface-dependency-hashes">,
64+
Flags<[HelpHidden]>;
6665

6766
def serialize_parseable_module_interface_dependency_hashes
6867
: Flag<["-"], "serialize-parseable-module-interface-dependency-hashes">,
68+
Alias<serialize_module_interface_dependency_hashes>,
6969
Flags<[HelpHidden]>;
7070

7171
def tbd_install_name
@@ -153,8 +153,8 @@ def debug_crash_Group : OptionGroup<"<automatic crashing options>">;
153153
class DebugCrashOpt : Group<debug_crash_Group>;
154154

155155

156-
// Flags that are saved into parseable interfaces
157-
let Flags = [FrontendOption, NoDriverOption, HelpHidden, ParseableInterfaceOption] in {
156+
// Flags that are saved into module interfaces
157+
let Flags = [FrontendOption, NoDriverOption, HelpHidden, ModuleInterfaceOption] in {
158158

159159
def enable_objc_interop :
160160
Flag<["-"], "enable-objc-interop">,
@@ -512,14 +512,19 @@ def dump_interface_hash : Flag<["-"], "dump-interface-hash">,
512512
HelpText<"Parse input file(s) and dump interface token hash(es)">,
513513
ModeOpt;
514514

515+
def compile_module_from_interface :
516+
Flag<["-"], "compile-module-from-interface">,
517+
HelpText<"Treat the (single) input as a swiftinterface and produce a module">,
518+
ModeOpt;
519+
515520
def build_module_from_parseable_interface :
516521
Flag<["-"], "build-module-from-parseable-interface">,
517-
HelpText<"Treat the (single) input as a swiftinterface and produce a module">,
522+
Alias<compile_module_from_interface>,
518523
ModeOpt;
519524

520525
def prebuilt_module_cache_path :
521526
Separate<["-"], "prebuilt-module-cache-path">,
522-
HelpText<"Directory of prebuilt modules for loading parseable interfaces">;
527+
HelpText<"Directory of prebuilt modules for loading module interfaces">;
523528
def prebuilt_module_cache_path_EQ :
524529
Joined<["-"], "prebuilt-module-cache-path=">,
525530
Alias<prebuilt_module_cache_path>;

include/swift/Option/Options.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace options {
3535
ModuleWrapOption = (1 << 10),
3636
SwiftFormatOption = (1 << 11),
3737
ArgumentIsPath = (1 << 12),
38-
ParseableInterfaceOption = (1 << 13),
38+
ModuleInterfaceOption = (1 << 13),
3939
};
4040

4141
enum ID {

include/swift/Option/Options.td

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ def DoesNotAffectIncrementalBuild : OptionFlag;
4747
// current working directory.
4848
def ArgumentIsPath : OptionFlag;
4949

50-
// The option should be written into a .swiftinterface parseable interface file,
50+
// The option should be written into a .swiftinterface module interface file,
5151
// and read/parsed from there when reconstituting a .swiftmodule from it.
52-
def ParseableInterfaceOption : OptionFlag;
52+
def ModuleInterfaceOption : OptionFlag;
5353

5454
/////////
5555
// Options
@@ -183,12 +183,12 @@ def j : JoinedOrSeparate<["-"], "j">, Flags<[DoesNotAffectIncrementalBuild]>,
183183
def sdk : Separate<["-"], "sdk">, Flags<[FrontendOption, ArgumentIsPath]>,
184184
HelpText<"Compile against <sdk>">, MetaVarName<"<sdk>">;
185185

186-
def swift_version : Separate<["-"], "swift-version">, Flags<[FrontendOption, ParseableInterfaceOption]>,
186+
def swift_version : Separate<["-"], "swift-version">, Flags<[FrontendOption, ModuleInterfaceOption]>,
187187
HelpText<"Interpret input according to a specific Swift language version number">,
188188
MetaVarName<"<vers>">;
189189

190190
def package_description_version: Separate<["-"], "package-description-version">,
191-
Flags<[FrontendOption, HelpHidden, ParseableInterfaceOption]>,
191+
Flags<[FrontendOption, HelpHidden, ModuleInterfaceOption]>,
192192
HelpText<"The version number to be applied on the input for the PackageDescription availability kind">,
193193
MetaVarName<"<vers>">;
194194

@@ -306,17 +306,17 @@ def module_cache_path : Separate<["-"], "module-cache-path">,
306306
HelpText<"Specifies the Clang module cache path">;
307307

308308
def enable_library_evolution : Flag<["-"], "enable-library-evolution">,
309-
Flags<[FrontendOption, ParseableInterfaceOption]>,
309+
Flags<[FrontendOption, ModuleInterfaceOption]>,
310310
HelpText<"Build the module to allow binary-compatible library evolution">;
311311

312312
def module_name : Separate<["-"], "module-name">,
313-
Flags<[FrontendOption, ParseableInterfaceOption]>,
313+
Flags<[FrontendOption, ModuleInterfaceOption]>,
314314
HelpText<"Name of the module to build">;
315315
def module_name_EQ : Joined<["-"], "module-name=">, Flags<[FrontendOption]>,
316316
Alias<module_name>;
317317

318318
def module_link_name : Separate<["-"], "module-link-name">,
319-
Flags<[FrontendOption, ParseableInterfaceOption]>,
319+
Flags<[FrontendOption, ModuleInterfaceOption]>,
320320
HelpText<"Library to link against when using this module">;
321321
def module_link_name_EQ : Joined<["-"], "module-link-name=">,
322322
Flags<[FrontendOption]>, Alias<module_link_name>;
@@ -337,15 +337,25 @@ def emit_module_path_EQ : Joined<["-"], "emit-module-path=">,
337337
ArgumentIsPath]>,
338338
Alias<emit_module_path>;
339339

340+
def emit_module_interface :
341+
Flag<["-"], "emit-module-interface">,
342+
Flags<[NoInteractiveOption, DoesNotAffectIncrementalBuild]>,
343+
HelpText<"Output module interface file">;
344+
def emit_module_interface_path :
345+
Separate<["-"], "emit-module-interface-path">,
346+
Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild,
347+
ArgumentIsPath]>,
348+
MetaVarName<"<path>">, HelpText<"Output module interface file to <path>">;
349+
340350
def emit_parseable_module_interface :
341351
Flag<["-"], "emit-parseable-module-interface">,
342-
Flags<[NoInteractiveOption, DoesNotAffectIncrementalBuild]>,
343-
HelpText<"Output parseable interface file">;
352+
Alias<emit_module_interface>,
353+
Flags<[NoInteractiveOption, HelpHidden, DoesNotAffectIncrementalBuild]>;
344354
def emit_parseable_module_interface_path :
345355
Separate<["-"], "emit-parseable-module-interface-path">,
356+
Alias<emit_module_interface_path>,
346357
Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild,
347-
ArgumentIsPath]>,
348-
MetaVarName<"<path>">, HelpText<"Output parseable interface file to <path>">;
358+
HelpHidden, ArgumentIsPath]>;
349359

350360
def emit_objc_header : Flag<["-"], "emit-objc-header">,
351361
Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>,
@@ -492,19 +502,19 @@ def Xlinker : Separate<["-"], "Xlinker">,
492502
def O_Group : OptionGroup<"<optimization level options>">;
493503

494504
def Onone : Flag<["-"], "Onone">, Group<O_Group>,
495-
Flags<[FrontendOption, ParseableInterfaceOption]>,
505+
Flags<[FrontendOption, ModuleInterfaceOption]>,
496506
HelpText<"Compile without any optimization">;
497507
def O : Flag<["-"], "O">, Group<O_Group>,
498-
Flags<[FrontendOption, ParseableInterfaceOption]>,
508+
Flags<[FrontendOption, ModuleInterfaceOption]>,
499509
HelpText<"Compile with optimizations">;
500510
def Osize : Flag<["-"], "Osize">, Group<O_Group>,
501-
Flags<[FrontendOption, ParseableInterfaceOption]>,
511+
Flags<[FrontendOption, ModuleInterfaceOption]>,
502512
HelpText<"Compile with optimizations and target small code size">;
503513
def Ounchecked : Flag<["-"], "Ounchecked">, Group<O_Group>,
504-
Flags<[FrontendOption, ParseableInterfaceOption]>,
514+
Flags<[FrontendOption, ModuleInterfaceOption]>,
505515
HelpText<"Compile with optimizations and remove runtime safety checks">;
506516
def Oplayground : Flag<["-"], "Oplayground">, Group<O_Group>,
507-
Flags<[HelpHidden, FrontendOption, ParseableInterfaceOption]>,
517+
Flags<[HelpHidden, FrontendOption, ModuleInterfaceOption]>,
508518
HelpText<"Compile with optimizations appropriate for a playground">;
509519

510520
def RemoveRuntimeAsserts : Flag<["-"], "remove-runtime-asserts">,
@@ -650,7 +660,7 @@ def parse_sil : Flag<["-"], "parse-sil">,
650660
Flags<[FrontendOption, NoInteractiveOption]>,
651661
HelpText<"Parse the input file as SIL code, not Swift source">;
652662
def parse_stdlib : Flag<["-"], "parse-stdlib">,
653-
Flags<[FrontendOption, HelpHidden, ParseableInterfaceOption]>,
663+
Flags<[FrontendOption, HelpHidden, ModuleInterfaceOption]>,
654664
HelpText<"Parse the input file(s) as the Swift standard library">;
655665

656666
def modes_Group : OptionGroup<"<mode options>">, HelpText<"MODES">;
@@ -791,12 +801,12 @@ def resource_dir : Separate<["-"], "resource-dir">,
791801
HelpText<"The directory that holds the compiler resource files">;
792802

793803
def target : Separate<["-"], "target">,
794-
Flags<[FrontendOption, ModuleWrapOption, ParseableInterfaceOption]>,
804+
Flags<[FrontendOption, ModuleWrapOption, ModuleInterfaceOption]>,
795805
HelpText<"Generate code for the given target">;
796806
def target_legacy_spelling : Joined<["--"], "target=">,
797807
Flags<[FrontendOption]>, Alias<target>;
798808

799-
def target_cpu : Separate<["-"], "target-cpu">, Flags<[FrontendOption, ParseableInterfaceOption]>,
809+
def target_cpu : Separate<["-"], "target-cpu">, Flags<[FrontendOption, ModuleInterfaceOption]>,
800810
HelpText<"Generate code for a particular CPU variant">;
801811

802812
def profile_generate : Flag<["-"], "profile-generate">,
@@ -855,7 +865,7 @@ def index_ignore_system_modules : Flag<["-"], "index-ignore-system-modules">,
855865
HelpText<"Avoid indexing system modules">;
856866

857867
def enforce_exclusivity_EQ : Joined<["-"], "enforce-exclusivity=">,
858-
Flags<[FrontendOption, ParseableInterfaceOption]>,
868+
Flags<[FrontendOption, ModuleInterfaceOption]>,
859869
MetaVarName<"<enforcement>">,
860870
HelpText<"Enforce law of exclusivity">;
861871

lib/Driver/Driver.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ static void validateBridgingHeaderArgs(DiagnosticEngine &diags,
127127
if (args.hasArgNoClaim(options::OPT_import_underlying_module))
128128
diags.diagnose({}, diag::error_framework_bridging_header);
129129

130-
if (args.hasArgNoClaim(options::OPT_emit_parseable_module_interface,
131-
options::OPT_emit_parseable_module_interface_path)) {
130+
if (args.hasArgNoClaim(options::OPT_emit_module_interface,
131+
options::OPT_emit_module_interface_path)) {
132132
diags.diagnose({}, diag::error_bridging_header_parseable_interface);
133133
}
134134
}
@@ -1522,8 +1522,8 @@ void Driver::buildOutputInfo(const ToolChain &TC, const DerivedArgList &Args,
15221522
OI.ShouldTreatModuleAsTopLevelOutput = false;
15231523
} else if (Args.hasArg(options::OPT_emit_objc_header,
15241524
options::OPT_emit_objc_header_path,
1525-
options::OPT_emit_parseable_module_interface,
1526-
options::OPT_emit_parseable_module_interface_path) &&
1525+
options::OPT_emit_module_interface,
1526+
options::OPT_emit_module_interface_path) &&
15271527
OI.CompilerMode != OutputInfo::Mode::SingleCompile) {
15281528
// An option has been passed which requires whole-module knowledge, but we
15291529
// don't have that. Generate a module, but treat it as an intermediate
@@ -2509,8 +2509,8 @@ Job *Driver::buildJobsForAction(Compilation &C, const JobAction *JA,
25092509
chooseSwiftModuleDocOutputPath(C, OutputMap, workingDirectory,
25102510
Output.get());
25112511

2512-
if (C.getArgs().hasArg(options::OPT_emit_parseable_module_interface,
2513-
options::OPT_emit_parseable_module_interface_path))
2512+
if (C.getArgs().hasArg(options::OPT_emit_module_interface,
2513+
options::OPT_emit_module_interface_path))
25142514
chooseParseableInterfacePath(C, JA, workingDirectory, Buf, Output.get());
25152515

25162516
if (C.getArgs().hasArg(options::OPT_update_code) && isa<CompileJobAction>(JA))
@@ -2829,7 +2829,7 @@ void Driver::chooseParseableInterfacePath(Compilation &C, const JobAction *JA,
28292829

28302830
StringRef outputPath = *getOutputFilenameFromPathArgOrAsTopLevel(
28312831
C.getOutputInfo(), C.getArgs(),
2832-
options::OPT_emit_parseable_module_interface_path,
2832+
options::OPT_emit_module_interface_path,
28332833
file_types::TY_SwiftParseableInterfaceFile,
28342834
/*TreatAsTopLevelOutput*/true, workingDirectory, buffer);
28352835
output->setAdditionalOutputForType(file_types::TY_SwiftParseableInterfaceFile,

lib/Frontend/ArgsToFrontendOptionsConverter.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ bool ArgsToFrontendOptionsConverter::convert(
8080

8181
Opts.TrackSystemDeps |= Args.hasArg(OPT_track_system_dependencies);
8282

83-
Opts.SerializeParseableModuleInterfaceDependencyHashes |=
84-
Args.hasArg(OPT_serialize_parseable_module_interface_dependency_hashes);
83+
Opts.SerializeModuleInterfaceDependencyHashes |=
84+
Args.hasArg(OPT_serialize_module_interface_dependency_hashes);
8585

8686
computePrintStatsOptions();
8787
computeDebugTimeOptions();
@@ -380,8 +380,8 @@ ArgsToFrontendOptionsConverter::determineRequestedAction(const ArgList &args) {
380380
return FrontendOptions::ActionType::REPL;
381381
if (Opt.matches(OPT_interpret))
382382
return FrontendOptions::ActionType::Immediate;
383-
if (Opt.matches(OPT_build_module_from_parseable_interface))
384-
return FrontendOptions::ActionType::BuildModuleFromParseableInterface;
383+
if (Opt.matches(OPT_compile_module_from_interface))
384+
return FrontendOptions::ActionType::CompileModuleFromInterface;
385385

386386
llvm_unreachable("Unhandled mode option");
387387
}

lib/Frontend/ArgsToFrontendOutputsConverter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ SupplementaryOutputPathsComputer::getSupplementaryOutputPathsFromArguments()
295295
options::OPT_emit_loaded_module_trace_path);
296296
auto TBD = getSupplementaryFilenamesFromArguments(options::OPT_emit_tbd_path);
297297
auto parseableInterfaceOutput = getSupplementaryFilenamesFromArguments(
298-
options::OPT_emit_parseable_module_interface_path);
298+
options::OPT_emit_module_interface_path);
299299

300300
if (!objCHeaderOutput || !moduleOutput || !moduleDocOutput ||
301301
!dependenciesFile || !referenceDependenciesFile ||
@@ -515,7 +515,7 @@ SupplementaryOutputPathsComputer::readSupplementaryOutputFileMap() const {
515515
options::OPT_emit_reference_dependencies_path,
516516
options::OPT_serialize_diagnostics_path,
517517
options::OPT_emit_loaded_module_trace_path,
518-
options::OPT_emit_parseable_module_interface_path,
518+
options::OPT_emit_module_interface_path,
519519
options::OPT_emit_tbd_path)) {
520520
Diags.diagnose(SourceLoc(),
521521
diag::error_cannot_have_supplementary_outputs,

lib/Frontend/CompilerInvocation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static void PrintArg(raw_ostream &OS, const char *Arg, StringRef TempDir) {
178178
OS << '"';
179179
}
180180

181-
/// Save a copy of any flags marked as ParseableInterfaceOption, if running
181+
/// Save a copy of any flags marked as ModuleInterfaceOption, if running
182182
/// in a mode that is going to emit a .swiftinterface file.
183183
static void SaveParseableInterfaceArgs(ParseableInterfaceOptions &Opts,
184184
FrontendOptions &FOpts,
@@ -187,7 +187,7 @@ static void SaveParseableInterfaceArgs(ParseableInterfaceOptions &Opts,
187187
return;
188188
ArgStringList RenderedArgs;
189189
for (auto A : Args) {
190-
if (A->getOption().hasFlag(options::ParseableInterfaceOption))
190+
if (A->getOption().hasFlag(options::ModuleInterfaceOption))
191191
A->render(Args, RenderedArgs);
192192
}
193193
llvm::raw_string_ostream OS(Opts.ParseableInterfaceFlags);

0 commit comments

Comments
 (0)