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);


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to