Skip to content

[5.1] [ModuleInterfaces] Rename 'parseable interfaces' to 'module interfaces' #24053

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions include/swift/AST/DiagnosticsSema.def
Original file line number Diff line number Diff line change
Expand Up @@ -606,16 +606,16 @@ ERROR(sema_opening_import,Fatal,
ERROR(serialization_load_failed,Fatal,
"failed to load module %0", (Identifier))
ERROR(serialization_malformed_module,Fatal,
"malformed module file: %0", (StringRef))
"malformed compiled module: %0", (StringRef))
ERROR(serialization_module_too_new,Fatal,
"module file was created by a newer version of the compiler: %0",
"compiled module was created by a newer version of the compiler: %0",
(StringRef))
ERROR(serialization_module_language_version_mismatch,Fatal,
"module compiled with Swift %0 cannot be imported by the Swift %1 "
"compiler: %2",
(StringRef, StringRef, StringRef))
ERROR(serialization_module_too_old,Fatal,
"module file was created by an older version of the compiler; "
"compiled module was created by an older version of the compiler; "
"rebuild %0 and try again: %1",
(Identifier, StringRef))
ERROR(serialization_missing_single_dependency,Fatal,
Expand Down
6 changes: 3 additions & 3 deletions include/swift/Frontend/FrontendOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class FrontendOptions {
MergeModules, ///< Merge modules only

/// Build from a swiftinterface, as close to `import` as possible
BuildModuleFromParseableInterface,
CompileModuleFromInterface,

EmitSIBGen, ///< Emit serialized AST + raw SIL
EmitSIB, ///< Emit serialized AST + canonical SIL
Expand Down Expand Up @@ -269,8 +269,8 @@ class FrontendOptions {
bool TrackSystemDeps = false;

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

/// The different modes for validating TBD against the LLVM IR.
enum class TBDValidationMode {
Expand Down
21 changes: 13 additions & 8 deletions include/swift/Option/FrontendOptions.td
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ def emit_fixits_path
: Separate<["-"], "emit-fixits-path">, MetaVarName<"<path>">,
HelpText<"Output compiler fixits as source edits to <path>">;

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

def serialize_parseable_module_interface_dependency_hashes
: Flag<["-"], "serialize-parseable-module-interface-dependency-hashes">,
Alias<serialize_module_interface_dependency_hashes>,
Flags<[HelpHidden]>;

def tbd_install_name
Expand Down Expand Up @@ -153,8 +153,8 @@ def debug_crash_Group : OptionGroup<"<automatic crashing options>">;
class DebugCrashOpt : Group<debug_crash_Group>;


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

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

def compile_module_from_interface :
Flag<["-"], "compile-module-from-interface">,
HelpText<"Treat the (single) input as a swiftinterface and produce a module">,
ModeOpt;

def build_module_from_parseable_interface :
Flag<["-"], "build-module-from-parseable-interface">,
HelpText<"Treat the (single) input as a swiftinterface and produce a module">,
Alias<compile_module_from_interface>,
ModeOpt;

def prebuilt_module_cache_path :
Separate<["-"], "prebuilt-module-cache-path">,
HelpText<"Directory of prebuilt modules for loading parseable interfaces">;
HelpText<"Directory of prebuilt modules for loading module interfaces">;
def prebuilt_module_cache_path_EQ :
Joined<["-"], "prebuilt-module-cache-path=">,
Alias<prebuilt_module_cache_path>;
Expand Down
2 changes: 1 addition & 1 deletion include/swift/Option/Options.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace options {
ModuleWrapOption = (1 << 10),
SwiftFormatOption = (1 << 11),
ArgumentIsPath = (1 << 12),
ParseableInterfaceOption = (1 << 13),
ModuleInterfaceOption = (1 << 13),
};

enum ID {
Expand Down
50 changes: 30 additions & 20 deletions include/swift/Option/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ def DoesNotAffectIncrementalBuild : OptionFlag;
// current working directory.
def ArgumentIsPath : OptionFlag;

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

/////////
// Options
Expand Down Expand Up @@ -183,12 +183,12 @@ def j : JoinedOrSeparate<["-"], "j">, Flags<[DoesNotAffectIncrementalBuild]>,
def sdk : Separate<["-"], "sdk">, Flags<[FrontendOption, ArgumentIsPath]>,
HelpText<"Compile against <sdk>">, MetaVarName<"<sdk>">;

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

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

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

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

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

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

def emit_module_interface :
Flag<["-"], "emit-module-interface">,
Flags<[NoInteractiveOption, DoesNotAffectIncrementalBuild]>,
HelpText<"Output module interface file">;
def emit_module_interface_path :
Separate<["-"], "emit-module-interface-path">,
Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild,
ArgumentIsPath]>,
MetaVarName<"<path>">, HelpText<"Output module interface file to <path>">;

def emit_parseable_module_interface :
Flag<["-"], "emit-parseable-module-interface">,
Flags<[NoInteractiveOption, DoesNotAffectIncrementalBuild]>,
HelpText<"Output parseable interface file">;
Alias<emit_module_interface>,
Flags<[NoInteractiveOption, HelpHidden, DoesNotAffectIncrementalBuild]>;
def emit_parseable_module_interface_path :
Separate<["-"], "emit-parseable-module-interface-path">,
Alias<emit_module_interface_path>,
Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild,
ArgumentIsPath]>,
MetaVarName<"<path>">, HelpText<"Output parseable interface file to <path>">;
HelpHidden, ArgumentIsPath]>;

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

def Onone : Flag<["-"], "Onone">, Group<O_Group>,
Flags<[FrontendOption, ParseableInterfaceOption]>,
Flags<[FrontendOption, ModuleInterfaceOption]>,
HelpText<"Compile without any optimization">;
def O : Flag<["-"], "O">, Group<O_Group>,
Flags<[FrontendOption, ParseableInterfaceOption]>,
Flags<[FrontendOption, ModuleInterfaceOption]>,
HelpText<"Compile with optimizations">;
def Osize : Flag<["-"], "Osize">, Group<O_Group>,
Flags<[FrontendOption, ParseableInterfaceOption]>,
Flags<[FrontendOption, ModuleInterfaceOption]>,
HelpText<"Compile with optimizations and target small code size">;
def Ounchecked : Flag<["-"], "Ounchecked">, Group<O_Group>,
Flags<[FrontendOption, ParseableInterfaceOption]>,
Flags<[FrontendOption, ModuleInterfaceOption]>,
HelpText<"Compile with optimizations and remove runtime safety checks">;
def Oplayground : Flag<["-"], "Oplayground">, Group<O_Group>,
Flags<[HelpHidden, FrontendOption, ParseableInterfaceOption]>,
Flags<[HelpHidden, FrontendOption, ModuleInterfaceOption]>,
HelpText<"Compile with optimizations appropriate for a playground">;

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

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

def target : Separate<["-"], "target">,
Flags<[FrontendOption, ModuleWrapOption, ParseableInterfaceOption]>,
Flags<[FrontendOption, ModuleWrapOption, ModuleInterfaceOption]>,
HelpText<"Generate code for the given target">;
def target_legacy_spelling : Joined<["--"], "target=">,
Flags<[FrontendOption]>, Alias<target>;

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

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

def enforce_exclusivity_EQ : Joined<["-"], "enforce-exclusivity=">,
Flags<[FrontendOption, ParseableInterfaceOption]>,
Flags<[FrontendOption, ModuleInterfaceOption]>,
MetaVarName<"<enforcement>">,
HelpText<"Enforce law of exclusivity">;

Expand Down
14 changes: 7 additions & 7 deletions lib/Driver/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ static void validateBridgingHeaderArgs(DiagnosticEngine &diags,
if (args.hasArgNoClaim(options::OPT_import_underlying_module))
diags.diagnose({}, diag::error_framework_bridging_header);

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

if (C.getArgs().hasArg(options::OPT_emit_parseable_module_interface,
options::OPT_emit_parseable_module_interface_path))
if (C.getArgs().hasArg(options::OPT_emit_module_interface,
options::OPT_emit_module_interface_path))
chooseParseableInterfacePath(C, JA, workingDirectory, Buf, Output.get());

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

StringRef outputPath = *getOutputFilenameFromPathArgOrAsTopLevel(
C.getOutputInfo(), C.getArgs(),
options::OPT_emit_parseable_module_interface_path,
options::OPT_emit_module_interface_path,
file_types::TY_SwiftParseableInterfaceFile,
/*TreatAsTopLevelOutput*/true, workingDirectory, buffer);
output->setAdditionalOutputForType(file_types::TY_SwiftParseableInterfaceFile,
Expand Down
8 changes: 4 additions & 4 deletions lib/Frontend/ArgsToFrontendOptionsConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ bool ArgsToFrontendOptionsConverter::convert(

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

Opts.SerializeParseableModuleInterfaceDependencyHashes |=
Args.hasArg(OPT_serialize_parseable_module_interface_dependency_hashes);
Opts.SerializeModuleInterfaceDependencyHashes |=
Args.hasArg(OPT_serialize_module_interface_dependency_hashes);

computePrintStatsOptions();
computeDebugTimeOptions();
Expand Down Expand Up @@ -380,8 +380,8 @@ ArgsToFrontendOptionsConverter::determineRequestedAction(const ArgList &args) {
return FrontendOptions::ActionType::REPL;
if (Opt.matches(OPT_interpret))
return FrontendOptions::ActionType::Immediate;
if (Opt.matches(OPT_build_module_from_parseable_interface))
return FrontendOptions::ActionType::BuildModuleFromParseableInterface;
if (Opt.matches(OPT_compile_module_from_interface))
return FrontendOptions::ActionType::CompileModuleFromInterface;

llvm_unreachable("Unhandled mode option");
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Frontend/ArgsToFrontendOutputsConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ SupplementaryOutputPathsComputer::getSupplementaryOutputPathsFromArguments()
options::OPT_emit_loaded_module_trace_path);
auto TBD = getSupplementaryFilenamesFromArguments(options::OPT_emit_tbd_path);
auto parseableInterfaceOutput = getSupplementaryFilenamesFromArguments(
options::OPT_emit_parseable_module_interface_path);
options::OPT_emit_module_interface_path);

if (!objCHeaderOutput || !moduleOutput || !moduleDocOutput ||
!dependenciesFile || !referenceDependenciesFile ||
Expand Down Expand Up @@ -515,7 +515,7 @@ SupplementaryOutputPathsComputer::readSupplementaryOutputFileMap() const {
options::OPT_emit_reference_dependencies_path,
options::OPT_serialize_diagnostics_path,
options::OPT_emit_loaded_module_trace_path,
options::OPT_emit_parseable_module_interface_path,
options::OPT_emit_module_interface_path,
options::OPT_emit_tbd_path)) {
Diags.diagnose(SourceLoc(),
diag::error_cannot_have_supplementary_outputs,
Expand Down
4 changes: 2 additions & 2 deletions lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ static void PrintArg(raw_ostream &OS, const char *Arg, StringRef TempDir) {
OS << '"';
}

/// Save a copy of any flags marked as ParseableInterfaceOption, if running
/// Save a copy of any flags marked as ModuleInterfaceOption, if running
/// in a mode that is going to emit a .swiftinterface file.
static void SaveParseableInterfaceArgs(ParseableInterfaceOptions &Opts,
FrontendOptions &FOpts,
Expand All @@ -187,7 +187,7 @@ static void SaveParseableInterfaceArgs(ParseableInterfaceOptions &Opts,
return;
ArgStringList RenderedArgs;
for (auto A : Args) {
if (A->getOption().hasFlag(options::ParseableInterfaceOption))
if (A->getOption().hasFlag(options::ModuleInterfaceOption))
A->render(Args, RenderedArgs);
}
llvm::raw_string_ostream OS(Opts.ParseableInterfaceFlags);
Expand Down
Loading