[all-commits] [llvm/llvm-project] 08f957: [C++20] [Modules] Don't generate global ctors/dtor...

Chuanqi Xu via All-commits all-commits at lists.llvm.org
Sun Jan 8 18:49:54 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 08f957808e5f7e44b11d5e9015925955fe1e9d32
      https://github.com/llvm/llvm-project/commit/08f957808e5f7e44b11d5e9015925955fe1e9d32
  Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
  Date:   2023-01-09 (Mon, 09 Jan 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/CodeGen/CodeGenModule.cpp
    A clang/test/CodeGenCXX/pr59765-modules-global-ctor-dtor.cppm

  Log Message:
  -----------
  [C++20] [Modules] Don't generate global ctors/dtors for variables which are available externally

Closes https://github.com/llvm/llvm-project/issues/59765.

Currently we will generate the global ctor/dtor for variables in
importing modules. It will cause multiple initialization/destructions.
It makes no sense. This patch tries to not generate global ctor/dtor for
variables which are available externally. Note that the variables in
header units and clang modules won't be available externally by default.

Reviewed By: iains

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




More information about the All-commits mailing list