File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -622,10 +622,14 @@ static DiagnosticKind toDiagnosticKind(DiagnosticState::Behavior behavior) {
622
622
llvm_unreachable (" Unhandled DiagnosticKind in switch." );
623
623
}
624
624
625
- // / A special option only for compiler writers that causes Diagnostics to assert
626
- // / when a failure diagnostic is emitted. Intended for use in the debugger.
625
+ // A special option only for compiler writers that causes Diagnostics to assert
626
+ // when a failure diagnostic is emitted. Intended for use in the debugger.
627
627
llvm::cl::opt<bool > AssertOnError (" swift-diagnostics-assert-on-error" ,
628
628
llvm::cl::init (false ));
629
+ // A special option only for compiler writers that causes Diagnostics to assert
630
+ // when a warning diagnostic is emitted. Intended for use in the debugger.
631
+ llvm::cl::opt<bool > AssertOnWarning (" swift-diagnostics-assert-on-warning" ,
632
+ llvm::cl::init (false ));
629
633
630
634
DiagnosticState::Behavior DiagnosticState::determineBehavior (DiagID id) {
631
635
auto set = [this ](DiagnosticState::Behavior lvl) {
@@ -637,6 +641,8 @@ DiagnosticState::Behavior DiagnosticState::determineBehavior(DiagID id) {
637
641
}
638
642
639
643
assert ((!AssertOnError || !anyErrorOccurred) && " We emitted an error?!" );
644
+ assert ((!AssertOnWarning || (lvl != Behavior::Warning)) &&
645
+ " We emitted a warning?!" );
640
646
previousBehavior = lvl;
641
647
return lvl;
642
648
};
You can’t perform that action at this time.
0 commit comments