[PATCH] D72411: [CodeGen] partially revert 2b4fa5348ee157b6b1a1af44d0137ca8c7a71573 to fix Objective-C static variable initialization

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 10 15:20:55 PST 2020


rsmith added inline comments.


================
Comment at: clang/lib/CodeGen/CGDecl.cpp:377
 
-  if (D.needsDestruction(getContext()) && HaveInsertPoint()) {
+  if (hasNontrivialDestruction(D.getType()) && HaveInsertPoint()) {
     // We have a constant initializer, but a nontrivial destructor. We still
----------------
rjmccall wrote:
> rsmith wrote:
> > arphaman wrote:
> > > rjmccall wrote:
> > > > The long-term fix here is probably for `needsDestruction` to say that variables of static storage duration of non-trivial ARC type and/or non-trivial C struct type don't need destruction.
> > > I don't have time to fix it properly right now, but I filed https://github.com/llvm/llvm-project/issues/93 to keep track of the issue. Can this be committed now before the branch next week to avoid shipping this bug in the release?
> > A correct fix looks to be pretty trivial and this patch appears to break C++20 semantics, so let's fix it properly.
> I agree.
Done in llvmorg-10-init-17084-g7a38468e34e.  Thanks for the report and the testcase :)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D72411/new/

https://reviews.llvm.org/D72411





More information about the cfe-commits mailing list