[all-commits] [llvm/llvm-project] 7a85aa: Emit const globals with constexpr destructor as co...

Hans via All-commits all-commits at lists.llvm.org
Thu Mar 16 03:02:58 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7a85aa918ccd7bba0e3be94436c62432c08d357a
      https://github.com/llvm/llvm-project/commit/7a85aa918ccd7bba0e3be94436c62432c08d357a
  Author: Hans Wennborg <hans at chromium.org>
  Date:   2023-03-16 (Thu, 16 Mar 2023)

  Changed paths:
    M clang/lib/CodeGen/CGDecl.cpp
    M clang/lib/CodeGen/CGDeclCXX.cpp
    M clang/lib/CodeGen/CGExpr.cpp
    M clang/lib/CodeGen/CGExprAgg.cpp
    M clang/lib/CodeGen/CGExprConstant.cpp
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/CodeGen/CodeGenModule.h
    M clang/lib/CodeGen/TargetInfo.cpp
    M clang/test/CodeGenCXX/const-init-cxx11.cpp
    M clang/test/CodeGenCXX/const-init-cxx2a.cpp
    M clang/test/CodeGenCXX/init-invariant.cpp
    M clang/test/CodeGenCXX/static-init.cpp

  Log Message:
  -----------
  Emit const globals with constexpr destructor as constant LLVM values

This follows 2b4fa53 which made Clang not emit destructor calls for such
objects. However, they would still not get emitted as constants since
CodeGenModule::isTypeConstant() returns false if the destructor is
constexpr. This change adds a param to make isTypeConstant() ignore the
dtor, allowing the caller to check it instead.

Fixes Issue #61212

Differential revision: https://reviews.llvm.org/D145369




More information about the All-commits mailing list