[clang] a1cdfeb - [clang][bytecode] Work around virtual bases being present in APValues (#205553)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 24 08:00:33 PDT 2026
Author: Timm Baeder
Date: 2026-06-24T17:00:28+02:00
New Revision: a1cdfebb72880cb1b5039611cafee7ca3af7a368
URL: https://github.com/llvm/llvm-project/commit/a1cdfebb72880cb1b5039611cafee7ca3af7a368
DIFF: https://github.com/llvm/llvm-project/commit/a1cdfebb72880cb1b5039611cafee7ca3af7a368.diff
LOG: [clang][bytecode] Work around virtual bases being present in APValues (#205553)
This happens in code called via `evaluateDestruction()`, where we
consume an `APValue` created by the current interpreter. APValues don't
have a notion of virtual bases right now, so the virtual bases simply
appear as regular ones.
Added:
Modified:
clang/lib/AST/ByteCode/Compiler.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 960b2c5cfca23..a74bea26f5c28 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -5531,6 +5531,11 @@ bool Compiler<Emitter>::visitAPValueInitializer(const APValue &Val,
// Bases.
for (unsigned I = 0, N = Val.getStructNumBases(); I != N; ++I) {
+ // FIXME: APValue doesn't know about virtual bases.
+ // We simply assume that if the APValue has more bases than the Record,
+ // those additional bases must be virtual.
+ if (I >= R->getNumBases())
+ break;
const APValue &B = Val.getStructBase(I);
const Record::Base *RB = R->getBase(I);
QualType BaseType = Ctx.getASTContext().getCanonicalTagType(RB->Decl);
More information about the cfe-commits
mailing list