[all-commits] [llvm/llvm-project] 2d8044: Recommit [ABI] [C++20] [Modules] Don't generate vt...

Chuanqi Xu via All-commits all-commits at lists.llvm.org
Sun Jun 18 19:41:30 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2d8044ee8b19f23e0a7fe5cd35876515d0d1d72e
      https://github.com/llvm/llvm-project/commit/2d8044ee8b19f23e0a7fe5cd35876515d0d1d72e
  Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
  Date:   2023-06-19 (Mon, 19 Jun 2023)

  Changed paths:
    M clang/lib/CodeGen/CGVTables.cpp
    A clang/test/CodeGenCXX/modules-vtable.cppm

  Log Message:
  -----------
  Recommit [ABI] [C++20] [Modules] Don't generate vtable if the class is defined in other module unit

Close https://github.com/llvm/llvm-project/issues/61940.

The root cause is that clang will generate vtable as strong symbol now
even if the corresponding class is defined in other module units. After
I check the wording in Itanium ABI, I find this is not inconsistent.
Itanium ABI 5.2.3
(https://itanium-cxx-abi.github.io/cxx-abi/abi.html#vague-vtable) says:

> The virtual table for a class is emitted in the same object containing
> the definition of its key function, i.e. the first non-pure virtual
> function that is not inline at the point of class definition.

So the current behavior is incorrect. This patch tries to address this.
Also I think we need to do a similar change for MSVC ABI. But I don't
find the formal wording. So I don't address this in this patch.

Reviewed By: rjmccall, iains, dblaikie

Differential Revision: https://reviews.llvm.org/D150023




More information about the All-commits mailing list