Page MenuHomePhabricator

[CodeGen] partially revert 2b4fa5348ee157b6b1a1af44d0137ca8c7a71573 to fix Objective-C static variable initialization
Needs ReviewPublic

Authored by arphaman on Jan 8 2020, 1:14 PM.



The following commit:

commit 2b4fa5348ee157b6b1a1af44d0137ca8c7a71573
Author: Richard Smith <>
Date:   Sun Sep 29 05:08:46 2019 +0000

    For P0784R7: compute whether a variable has constant destruction if it
    has a constexpr destructor.

started emitting static variables in Objective-C with C++ acquire/release checks. This is not supported for Objective-C. I can't revert the commit right now, so this is a partial revert of the change, to make sure next week's release branch isn't broken.

Diff Detail

Event Timeline

arphaman created this revision.Jan 8 2020, 1:14 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 8 2020, 1:14 PM
rjmccall added inline comments.Jan 8 2020, 1:29 PM

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.

arphaman marked an inline comment as done.Jan 10 2020, 2:31 PM
arphaman added inline comments.

I don't have time to fix it properly right now, but I filed to keep track of the issue. Can this be committed now before the branch next week to avoid shipping this bug in the release?

rsmith added inline comments.Jan 10 2020, 2:56 PM

A correct fix looks to be pretty trivial and this patch appears to break C++20 semantics, so let's fix it properly.

rjmccall added inline comments.Jan 10 2020, 3:10 PM

I agree.

rsmith added inline comments.Jan 10 2020, 3:19 PM

Done in llvmorg-10-init-17084-g7a38468e34e. Thanks for the report and the testcase :)