@@ -49,6 +49,7 @@ public struct Driver {
49
49
case relativeFrontendPath( String )
50
50
case subcommandPassedToDriver
51
51
case integratedReplRemoved
52
+ case conflictingOptions( Option , Option )
52
53
53
54
public var description : String {
54
55
switch self {
@@ -65,6 +66,8 @@ public struct Driver {
65
66
return " subcommand passed to driver "
66
67
case . integratedReplRemoved:
67
68
return " Compiler-internal integrated REPL has been removed; use the LLDB-enhanced REPL instead. "
69
+ case . conflictingOptions( let one, let two) :
70
+ return " conflicting options ' \( one. spelling) ' and ' \( two. spelling) ' "
68
71
}
69
72
}
70
73
}
@@ -307,6 +310,8 @@ public struct Driver {
307
310
self . numThreads = Self . determineNumThreads ( & parsedOptions, compilerMode: compilerMode, diagnosticsEngine: diagnosticEngine)
308
311
self . numParallelJobs = Self . determineNumParallelJobs ( & parsedOptions, diagnosticsEngine: diagnosticEngine, env: env)
309
312
313
+ try Self . validateWarningControlArgs ( & parsedOptions)
314
+
310
315
// Compute debug information output.
311
316
( self . debugInfoLevel, self . debugInfoFormat, shouldVerifyDebugInfo: self . shouldVerifyDebugInfo) =
312
317
Self . computeDebugInfo ( & parsedOptions, diagnosticsEngine: diagnosticEngine)
@@ -1457,6 +1462,16 @@ extension Diagnostic.Message {
1457
1462
}
1458
1463
}
1459
1464
1465
+ // MARK: Miscellaneous Argument Validation
1466
+ extension Driver {
1467
+ static func validateWarningControlArgs( _ parsedOptions: inout ParsedOptions ) throws {
1468
+ if parsedOptions. hasArgument ( . suppressWarnings) &&
1469
+ parsedOptions. hasFlag ( positive: . warningsAsErrors, negative: . noWarningsAsErrors, default: false ) {
1470
+ throw Error . conflictingOptions ( . warningsAsErrors, . suppressWarnings)
1471
+ }
1472
+ }
1473
+ }
1474
+
1460
1475
extension Triple {
1461
1476
func toolchainType( _ diagnosticsEngine: DiagnosticsEngine ) throws -> Toolchain . Type {
1462
1477
switch os {
0 commit comments