[all-commits] [llvm/llvm-project] 710d64: [CIR] Implement 'null' function-pointer vtable ent...

Erich Keane via All-commits all-commits at lists.llvm.org
Thu Apr 2 06:00:45 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 710d647586a4accef82a72c32c45a9cc77bbef53
      https://github.com/llvm/llvm-project/commit/710d647586a4accef82a72c32c45a9cc77bbef53
  Author: Erich Keane <ekeane at nvidia.com>
  Date:   2026-04-02 (Thu, 02 Apr 2026)

  Changed paths:
    M clang/lib/CIR/CodeGen/CIRGenVTables.cpp
    A clang/test/CIR/CodeGen/vtable-null-func-ptr.cpp

  Log Message:
  -----------
  [CIR] Implement 'null' function-pointer vtable entries (#190013)

This functionality is described in the Itanium C++ABI 2.5.2 (and is also
where the test comes from). See also VTableBuilder.cpp's documentation
on the declaration of IsOverriderUsed for further details.

However, the explaination is:
When B and C are declared, A is a primary base in each case, so although
vcall offsets are allocated in the A-in-B and A-in-C vtables, no this
adjustment is required and no thunk is generated. However, inside D
objects, A is no longer a primary base of C, so if we allowed calls to
C::f() to use the copy of A's vtable in the C subobject, we would need
to adjust this from C* to B::A*, which would require a third-party
thunk. Since we require that a call to C::f() first convert to A*,
C-in-D's copy of A's vtable is never referenced, so this is not
necessary.

The short of that is: there is no way to call these, so we just emit a
nullptr rather than the required thunk.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list