[llvm] [LowerSwitch] Implement verifyAnalysis (PR #68294)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 6 07:56:23 PDT 2023
================
@@ -569,8 +569,17 @@ class LowerSwitchLegacyPass : public FunctionPass {
initializeLowerSwitchLegacyPassPass(*PassRegistry::getPassRegistry());
}
+ // Remember the current function. Only used for verification.
+ Function *F;
+
bool runOnFunction(Function &F) override;
+ void verifyAnalysis() const override {
+ for (auto &BB : *F)
+ assert(!isa<SwitchInst>(BB.getTerminator()) &&
----------------
jayfoad wrote:
I'm just trying to follow existing patterns. They all seem to use `assert` so won't do anything in a normal Release build. I don't think most compilers warn about unused _public_ fields do they?
https://github.com/llvm/llvm-project/pull/68294
More information about the llvm-commits
mailing list