mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[frontend] Add an option called -verify-additional-prefix to add additional check prefixes to the DiagnosticVerifier.
This enables one to use varying prefixes when checking diagnostics with the
DiagnosticVerifier. So for instance, I can make a test work both with and
without send-non-sendable enabled by adding additional prefixes. As an example:
```swift
// RUN: %target-swift-frontend ... -verify-additional-prefix no-sns-
// RUN: %target-swift-frontend ... -verify-additional-prefix sns-
let x = ... // expected-error {{This is always checked no matter what prefixes I added}}
let y = ... // expected-no-sns-error {{This is only checked if send non sendable is disabled}}
let z = ... // expected-sns-error {{This is only checked if send non sendable is enabled}}
let w = ... // expected-no-sns-error {{This is checked for a specific error when sns is disabled...}}
// expected-sns-error @-1 {{and for a different error when sns is enabled}}
```
rdar://114643840
This commit is contained in:
@@ -1795,6 +1795,8 @@ static bool ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,
|
||||
|
||||
for (Arg *A : Args.filtered(OPT_verify_additional_file))
|
||||
Opts.AdditionalVerifierFiles.push_back(A->getValue());
|
||||
for (Arg *A : Args.filtered(OPT_verify_additional_prefix))
|
||||
Opts.AdditionalDiagnosticVerifierPrefixes.push_back(A->getValue());
|
||||
|
||||
Opts.UseColor |=
|
||||
Args.hasFlag(OPT_color_diagnostics,
|
||||
|
||||
Reference in New Issue
Block a user