[llvm] [WinEH] Emit unreachable on malformed catchpad (PR #222181)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 22 09:46:49 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- llvm/lib/CodeGen/WinEHPrepare.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp
index acbe2687c..1ecbc4205 100644
--- a/llvm/lib/CodeGen/WinEHPrepare.cpp
+++ b/llvm/lib/CodeGen/WinEHPrepare.cpp
@@ -23,10 +23,10 @@
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/WinEHFuncInfo.h"
-#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/EHPersonalities.h"
+#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Verifier.h"
@@ -384,7 +384,8 @@ void llvm::calculateSEHStateForAsynchEH(const BasicBlock *BB, int State,
EHInfo.BlockToStateMap[BB] = State; // Record state
if (isa<CatchPadInst>(It) && isa<CatchReturnInst>(TI)) {
- assert(!isMalformedCatchpad(cast<CatchPadInst>(It), EHPersonality::MSVC_X86SEH) &&
+ assert(!isMalformedCatchpad(cast<CatchPadInst>(It),
+ EHPersonality::MSVC_X86SEH) &&
"Malformed CatchPadInst not caught by win-eh-prepare");
const Constant *FilterOrNull = cast<Constant>(
cast<CatchPadInst>(It)->getArgOperand(0)->stripPointerCasts());
@@ -979,7 +980,6 @@ bool WinEHPrepareImpl::demotePHIsOnFunclets(Function &F,
return Changed;
}
-
bool WinEHPrepareImpl::removeMalformedCatchswitch(BasicBlock *FuncletPadBB) {
// If a catchpad is malformed, the whole catchswitch is invalidated
// therefore, make all of its catchpads unreachable
@@ -1021,7 +1021,8 @@ bool WinEHPrepareImpl::removeMalformedCatchswitch(BasicBlock *FuncletPadBB) {
default:
llvm_unreachable("Unsupported Personality for WinEH");
};
- Value *NewCatchPad = Builder.CreateCatchPad(CPI->getParentPad(), args, CPI->getName());
+ Value *NewCatchPad =
+ Builder.CreateCatchPad(CPI->getParentPad(), args, CPI->getName());
CPI->replaceAllUsesWith(NewCatchPad);
changeToUnreachable(CPI);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/222181
More information about the llvm-commits
mailing list