Skip to content

Commit a396fcc

Browse files
committed
LangOptions: tie NoncopyableGenerics to build
There were a handful of different places trying to enable the feature-flag when the stdlib has been built with the feature enabled. This change cleans that up and unifies it in one spot for all sub-tools like sil-opt and sil-func-extractor to pick-up.
1 parent 3dda59f commit a396fcc

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

lib/Basic/LangOptions.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ LangOptions::LangOptions() {
4747
#endif
4848

4949
// Note: Introduce default-on language options here.
50+
51+
// Default-on NoncopyableGenerics when the build-script setting is enabled.
52+
if (SWIFT_ENABLE_EXPERIMENTAL_NONCOPYABLE_GENERICS) {
53+
Features.insert(Feature::NoncopyableGenerics);
54+
EnableExperimentalAssociatedTypeInference = true;
55+
}
56+
5057
// Enable any playground options that are enabled by default.
5158
#define PLAYGROUND_OPTION(OptionName, Description, DefaultOn, HighPerfOn) \
5259
if (DefaultOn) \

lib/DriverTool/sil_opt_main.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -645,8 +645,6 @@ int sil_opt_main(ArrayRef<const char *> argv, void *MainAddr) {
645645
Invocation.getLangOptions().enableFeature(
646646
Feature::OldOwnershipOperatorSpellings);
647647
}
648-
if (SWIFT_ENABLE_EXPERIMENTAL_NONCOPYABLE_GENERICS)
649-
Invocation.getLangOptions().enableFeature(Feature::NoncopyableGenerics);
650648

651649
Invocation.getLangOptions().BypassResilienceChecks =
652650
options.BypassResilienceChecks;

lib/Frontend/CompilerInvocation.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -895,11 +895,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
895895

896896
Opts.enableFeature(Feature::LayoutPrespecialization);
897897

898-
if (SWIFT_ENABLE_EXPERIMENTAL_NONCOPYABLE_GENERICS) {
899-
Opts.enableFeature(Feature::NoncopyableGenerics);
900-
Opts.EnableExperimentalAssociatedTypeInference = true;
901-
}
902-
903898
Opts.EnableAppExtensionLibraryRestrictions |= Args.hasArg(OPT_enable_app_extension_library);
904899
Opts.EnableAppExtensionRestrictions |= Args.hasArg(OPT_enable_app_extension);
905900
Opts.EnableAppExtensionRestrictions |= Opts.EnableAppExtensionLibraryRestrictions;

tools/swift-ide-test/swift-ide-test.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4426,9 +4426,6 @@ int main(int argc, char *argv[]) {
44264426
InitInvok.getLangOptions().EnableExperimentalStringProcessing = true;
44274427
}
44284428

4429-
if (SWIFT_ENABLE_EXPERIMENTAL_NONCOPYABLE_GENERICS)
4430-
InitInvok.getLangOptions().enableFeature(Feature::NoncopyableGenerics);
4431-
44324429
if (!options::Triple.empty())
44334430
InitInvok.setTargetTriple(options::Triple);
44344431
if (!options::SwiftVersion.empty()) {

0 commit comments

Comments
 (0)