[clang] [clang][bytecode] Remove base casts in builtin_object_size (PR #176111)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 15 09:06:44 PST 2026


================
@@ -2332,6 +2332,13 @@ static bool interp__builtin_object_size(InterpState &S, CodePtr OpPC,
     }
   }
 
+  // The "closest surrounding subobject" is NOT a base class,
+  // so strip the base class casts.
+  if (UseFieldDesc && Ptr.isBaseClass()) {
+    while (Ptr.isBaseClass())
+      Ptr = Ptr.getBase();
----------------
shafik wrote:

The name of `getBase` is particularly unfortunate for readability, especially given the the comment above. While `getBase` makes sense in isolation of the `Pointer` type, in the wider context of C++ the name is quite overloaded.

https://github.com/llvm/llvm-project/pull/176111


More information about the cfe-commits mailing list