[PATCH] D50994: Add a new flag and attributes to control static destructor registration

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 20 15:55:19 PDT 2018


rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

Seems fine to me, once you add the test for always_destroy + no_destroy.



================
Comment at: clang/include/clang/Basic/LangOptions.def:311
 
+LANGOPT(RegisterStaticDestructors, 1, 1, "Register C++ static destructors")
+
----------------
erik.pilkington wrote:
> rsmith wrote:
> > Should be a `BENIGN_LANGOPT` because it doesn't affect AST construction, only the generated code.
> It does affect AST construction though, we don't mark a static VarDecl's type's destructor referenced in this mode, or check it's access (because we aren't actually using it). Do you think this is the wrong choice of semantics?
Ah, no, good point. This is right, then. (And I think avoiding checking the destructor is also appropriate, so that a private or deleted destructor can be used to "remind" people to use the attribute.)


https://reviews.llvm.org/D50994





More information about the cfe-commits mailing list