mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[SE-0160] Make deprecated @objc inference warnings opt-in.
The warnings about deprecated @objc inference in Swift 3 mode can be a bit annoying; and are mostly relevant to the migration workflow. Make the warning emission a three-state switch: * None (the default): don't warn about these issues. * Minimal (-warn-swift3-objc-inference-minimal): warn about direct uses of @objc entrypoints and provide "@objc" Fix-Its for them. * Complete (-warn-swift3-objc-inference-complete): warn about all cases where Swift 3 infers @objc but Swift 4 will not. Fixes rdar://problem/31922278.
This commit is contained in:
@@ -1011,13 +1011,23 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
|
||||
}
|
||||
|
||||
Opts.EnableAppExtensionRestrictions |= Args.hasArg(OPT_enable_app_extension);
|
||||
Opts.WarnSwift3ObjCInference |= Args.hasArg(OPT_warn_swift3_objc_inference);
|
||||
|
||||
Opts.EnableSwift3ObjCInference =
|
||||
Args.hasFlag(OPT_enable_swift3_objc_inference,
|
||||
OPT_disable_swift3_objc_inference,
|
||||
Opts.isSwiftVersion3());
|
||||
|
||||
if (Opts.EnableSwift3ObjCInference) {
|
||||
if (const Arg *A = Args.getLastArg(
|
||||
OPT_warn_swift3_objc_inference_minimal,
|
||||
OPT_warn_swift3_objc_inference_complete)) {
|
||||
if (A->getOption().getID() == OPT_warn_swift3_objc_inference_minimal)
|
||||
Opts.WarnSwift3ObjCInference = Swift3ObjCInferenceWarnings::Minimal;
|
||||
else
|
||||
Opts.WarnSwift3ObjCInference = Swift3ObjCInferenceWarnings::Complete;
|
||||
}
|
||||
}
|
||||
|
||||
llvm::Triple Target = Opts.Target;
|
||||
StringRef TargetArg;
|
||||
if (const Arg *A = Args.getLastArg(OPT_target)) {
|
||||
|
||||
Reference in New Issue
Block a user