@@ -132,20 +132,22 @@ Migrator::performAFixItMigration(version::Version SwiftLanguageVersion) {
132
132
LLVMArgs.erase (aarch64_use_tbi);
133
133
}
134
134
135
- // SE-0160: When migrating, always use the Swift 3 @objc inference rules,
136
- // which drives warnings with the "@objc" Fix-Its.
137
- Invocation.getLangOptions ().EnableSwift3ObjCInference = true ;
138
-
139
- // The default behavior of the migrator, referred to as "minimal" migration
140
- // in SE-0160, only adds @objc Fix-Its to those cases where the Objective-C
141
- // entry point is explicitly used somewhere in the source code. The user
142
- // may also select a workflow that adds @objc for every declaration that
143
- // would infer @objc under the Swift 3 rules but would no longer infer
144
- // @objc in Swift 4.
145
- Invocation.getLangOptions ().WarnSwift3ObjCInference =
146
- getMigratorOptions ().KeepObjcVisibility
147
- ? Swift3ObjCInferenceWarnings::Complete
148
- : Swift3ObjCInferenceWarnings::Minimal;
135
+ if (StartInvocation.getLangOptions ().EffectiveLanguageVersion .isVersion3 ()) {
136
+ // SE-0160: When migrating, always use the Swift 3 @objc inference rules,
137
+ // which drives warnings with the "@objc" Fix-Its.
138
+ Invocation.getLangOptions ().EnableSwift3ObjCInference = true ;
139
+
140
+ // The default behavior of the migrator, referred to as "minimal" migration
141
+ // in SE-0160, only adds @objc Fix-Its to those cases where the Objective-C
142
+ // entry point is explicitly used somewhere in the source code. The user
143
+ // may also select a workflow that adds @objc for every declaration that
144
+ // would infer @objc under the Swift 3 rules but would no longer infer
145
+ // @objc in Swift 4.
146
+ Invocation.getLangOptions ().WarnSwift3ObjCInference =
147
+ getMigratorOptions ().KeepObjcVisibility
148
+ ? Swift3ObjCInferenceWarnings::Complete
149
+ : Swift3ObjCInferenceWarnings::Minimal;
150
+ }
149
151
150
152
const auto &OrigFrontendOpts = StartInvocation.getFrontendOptions ();
151
153
0 commit comments