@@ -661,7 +661,9 @@ struct ExpectedDiag {
661
661
};
662
662
663
663
struct SourceMgrDiagnosticVerifierHandlerImpl {
664
- SourceMgrDiagnosticVerifierHandlerImpl () : status(success()) {}
664
+ SourceMgrDiagnosticVerifierHandlerImpl (
665
+ SourceMgrDiagnosticVerifierHandler::Level level)
666
+ : status(success()), level(level) {}
665
667
666
668
// / Returns the expected diagnostics for the given source file.
667
669
std::optional<MutableArrayRef<ExpectedDiag>>
@@ -672,6 +674,10 @@ struct SourceMgrDiagnosticVerifierHandlerImpl {
672
674
computeExpectedDiags (raw_ostream &os, llvm::SourceMgr &mgr,
673
675
const llvm::MemoryBuffer *buf);
674
676
677
+ SourceMgrDiagnosticVerifierHandler::Level getVerifyLevel () const {
678
+ return level;
679
+ }
680
+
675
681
// / The current status of the verifier.
676
682
LogicalResult status;
677
683
@@ -685,6 +691,10 @@ struct SourceMgrDiagnosticVerifierHandlerImpl {
685
691
llvm::Regex expected =
686
692
llvm::Regex (" expected-(error|note|remark|warning)(-re)? "
687
693
" *(@([+-][0-9]+|above|below|unknown))? *{{(.*)}}$" );
694
+
695
+ // / Verification level.
696
+ SourceMgrDiagnosticVerifierHandler::Level level =
697
+ SourceMgrDiagnosticVerifierHandler::Level::All;
688
698
};
689
699
} // namespace detail
690
700
} // namespace mlir
@@ -805,7 +815,7 @@ SourceMgrDiagnosticVerifierHandlerImpl::computeExpectedDiags(
805
815
SourceMgrDiagnosticVerifierHandler::SourceMgrDiagnosticVerifierHandler (
806
816
llvm::SourceMgr &srcMgr, MLIRContext *ctx, raw_ostream &out, Level level)
807
817
: SourceMgrDiagnosticHandler(srcMgr, ctx, out),
808
- impl(new SourceMgrDiagnosticVerifierHandlerImpl()), level(level ) {
818
+ impl(new SourceMgrDiagnosticVerifierHandlerImpl(level) ) {
809
819
// Compute the expected diagnostics for each of the current files in the
810
820
// source manager.
811
821
for (unsigned i = 0 , e = mgr.getNumBuffers (); i != e; ++i)
@@ -898,7 +908,7 @@ void SourceMgrDiagnosticVerifierHandler::process(LocationAttr loc,
898
908
}
899
909
}
900
910
901
- if (level == Level::OnlyExpected)
911
+ if (impl-> getVerifyLevel () == Level::OnlyExpected)
902
912
return ;
903
913
904
914
// Otherwise, emit an error for the near miss.
0 commit comments