rework the custom op verifier hooks to use the diagnostic emission
infrastructure, instead of returning a const char*. This allows custom
formatting and more interesting diagnostics.
This patch regresses the error message quality from the control flow
lowering pass, I'll address this in a subsequent patch.
PiperOrigin-RevId: 212210681
diff --git a/lib/Parser/Parser.cpp b/lib/Parser/Parser.cpp
index b9b903c..a2a45e7 100644
--- a/lib/Parser/Parser.cpp
+++ b/lib/Parser/Parser.cpp
@@ -1618,8 +1618,8 @@
// is structurally as we expect. If not, produce an error with a reasonable
// source location.
if (auto *opInfo = op->getAbstractOperation()) {
- if (auto error = opInfo->verifyInvariants(op))
- return emitError(loc, Twine("'") + op->getName().str() + "' op " + error);
+ if (opInfo->verifyInvariants(op))
+ return ParseFailure;
}
// If the instruction had a name, register it.