aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/Compiler.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-07-08 17:14:02 +0200
committerGitHub <noreply@github.com>2025-07-08 17:14:02 +0200
commit65f94d75187bdab5c853e31fbf35267258f0be67 (patch)
treeb66c2b9c2aeb4c6e84fa1863a3cffcc0254d97cc /clang/lib/AST/ByteCode/Compiler.cpp
parentacdf1c75269b6c55cf1a994a289595a3a3f41caf (diff)
downloadllvm-65f94d75187bdab5c853e31fbf35267258f0be67.zip
llvm-65f94d75187bdab5c853e31fbf35267258f0be67.tar.gz
llvm-65f94d75187bdab5c853e31fbf35267258f0be67.tar.bz2
[clang][bytecode] Don't crash on erroneous switch conditions (#147533)
Not attaching a test since I've only seen this when compiling a large c++26 test case as c++17.
Diffstat (limited to 'clang/lib/AST/ByteCode/Compiler.cpp')
-rw-r--r--clang/lib/AST/ByteCode/Compiler.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 51c234d..ee9c389 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -5629,6 +5629,9 @@ bool Compiler<Emitter>::visitContinueStmt(const ContinueStmt *S) {
template <class Emitter>
bool Compiler<Emitter>::visitSwitchStmt(const SwitchStmt *S) {
const Expr *Cond = S->getCond();
+ if (Cond->containsErrors())
+ return false;
+
PrimType CondT = this->classifyPrim(Cond->getType());
LocalScope<Emitter> LS(this);