@@ -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
@@ -682,6 +688,9 @@ struct SourceMgrDiagnosticVerifierHandlerImpl {
682
688
llvm::Regex expected =
683
689
llvm::Regex (" expected-(error|note|remark|warning)(-re)? "
684
690
" *(@([+-][0-9]+|above|below))? *{{(.*)}}$" );
691
+
692
+ SourceMgrDiagnosticVerifierHandler::Level level =
693
+ SourceMgrDiagnosticVerifierHandler::Level::All;
685
694
};
686
695
} // namespace detail
687
696
} // namespace mlir
@@ -797,7 +806,7 @@ SourceMgrDiagnosticVerifierHandlerImpl::computeExpectedDiags(
797
806
SourceMgrDiagnosticVerifierHandler::SourceMgrDiagnosticVerifierHandler (
798
807
llvm::SourceMgr &srcMgr, MLIRContext *ctx, raw_ostream &out, Level level)
799
808
: SourceMgrDiagnosticHandler(srcMgr, ctx, out),
800
- impl(new SourceMgrDiagnosticVerifierHandlerImpl()), level(level ) {
809
+ impl(new SourceMgrDiagnosticVerifierHandlerImpl(level) ) {
801
810
// Compute the expected diagnostics for each of the current files in the
802
811
// source manager.
803
812
for (unsigned i = 0 , e = mgr.getNumBuffers (); i != e; ++i)
@@ -886,7 +895,7 @@ void SourceMgrDiagnosticVerifierHandler::process(FileLineColLoc loc,
886
895
}
887
896
}
888
897
889
- if (level == Level::OnlyExpected)
898
+ if (impl-> getVerifyLevel () == Level::OnlyExpected)
890
899
return ;
891
900
892
901
// Otherwise, emit an error for the near miss.
0 commit comments