aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/Compiler.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-05-08 05:22:11 +0200
committerGitHub <noreply@github.com>2025-05-08 05:22:11 +0200
commitdc28f9d087324f77db81e7192648a17ebf036125 (patch)
treed3e24af08c37a4c90a76306f45df51e988055ceb /clang/lib/AST/ByteCode/Compiler.cpp
parenteebb50afaf27961b21847950179febdd20a98866 (diff)
downloadllvm-dc28f9d087324f77db81e7192648a17ebf036125.zip
llvm-dc28f9d087324f77db81e7192648a17ebf036125.tar.gz
llvm-dc28f9d087324f77db81e7192648a17ebf036125.tar.bz2
[clang][ExprConstant] Bail out on invalid lambda capture inits (#138832)
Fixes https://github.com/llvm/llvm-project/issues/138824
Diffstat (limited to 'clang/lib/AST/ByteCode/Compiler.cpp')
-rw-r--r--clang/lib/AST/ByteCode/Compiler.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index ae6574c..3cc55c7 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -2932,10 +2932,9 @@ bool Compiler<Emitter>::VisitLambdaExpr(const LambdaExpr *E) {
// record with their initializers.
for (const Record::Field &F : R->fields()) {
const Expr *Init = *CaptureInitIt;
- ++CaptureInitIt;
-
- if (!Init)
+ if (!Init || Init->containsErrors())
continue;
+ ++CaptureInitIt;
if (std::optional<PrimType> T = classify(Init)) {
if (!this->visit(Init))