Skip to content

Commit 8652ec5

Browse files
committed
move level to impl
1 parent 37c04da commit 8652ec5

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

mlir/include/mlir/IR/Diagnostics.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,8 +647,6 @@ class SourceMgrDiagnosticVerifierHandler : public SourceMgrDiagnosticHandler {
647647
void process(FileLineColLoc loc, StringRef msg, DiagnosticSeverity kind);
648648

649649
std::unique_ptr<detail::SourceMgrDiagnosticVerifierHandlerImpl> impl;
650-
651-
Level level = Level::All;
652650
};
653651

654652
//===----------------------------------------------------------------------===//

mlir/lib/IR/Diagnostics.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,9 @@ struct ExpectedDiag {
661661
};
662662

663663
struct SourceMgrDiagnosticVerifierHandlerImpl {
664-
SourceMgrDiagnosticVerifierHandlerImpl() : status(success()) {}
664+
SourceMgrDiagnosticVerifierHandlerImpl(
665+
SourceMgrDiagnosticVerifierHandler::Level level)
666+
: status(success()), level(level) {}
665667

666668
/// Returns the expected diagnostics for the given source file.
667669
std::optional<MutableArrayRef<ExpectedDiag>>
@@ -672,6 +674,10 @@ struct SourceMgrDiagnosticVerifierHandlerImpl {
672674
computeExpectedDiags(raw_ostream &os, llvm::SourceMgr &mgr,
673675
const llvm::MemoryBuffer *buf);
674676

677+
SourceMgrDiagnosticVerifierHandler::Level getVerifyLevel() const {
678+
return level;
679+
}
680+
675681
/// The current status of the verifier.
676682
LogicalResult status;
677683

@@ -682,6 +688,9 @@ struct SourceMgrDiagnosticVerifierHandlerImpl {
682688
llvm::Regex expected =
683689
llvm::Regex("expected-(error|note|remark|warning)(-re)? "
684690
"*(@([+-][0-9]+|above|below))? *{{(.*)}}$");
691+
692+
SourceMgrDiagnosticVerifierHandler::Level level =
693+
SourceMgrDiagnosticVerifierHandler::Level::All;
685694
};
686695
} // namespace detail
687696
} // namespace mlir
@@ -797,7 +806,7 @@ SourceMgrDiagnosticVerifierHandlerImpl::computeExpectedDiags(
797806
SourceMgrDiagnosticVerifierHandler::SourceMgrDiagnosticVerifierHandler(
798807
llvm::SourceMgr &srcMgr, MLIRContext *ctx, raw_ostream &out, Level level)
799808
: SourceMgrDiagnosticHandler(srcMgr, ctx, out),
800-
impl(new SourceMgrDiagnosticVerifierHandlerImpl()), level(level) {
809+
impl(new SourceMgrDiagnosticVerifierHandlerImpl(level)) {
801810
// Compute the expected diagnostics for each of the current files in the
802811
// source manager.
803812
for (unsigned i = 0, e = mgr.getNumBuffers(); i != e; ++i)
@@ -886,7 +895,7 @@ void SourceMgrDiagnosticVerifierHandler::process(FileLineColLoc loc,
886895
}
887896
}
888897

889-
if (level == Level::OnlyExpected)
898+
if (impl->getVerifyLevel() == Level::OnlyExpected)
890899
return;
891900

892901
// Otherwise, emit an error for the near miss.

0 commit comments

Comments
 (0)