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

Erik Pilkington via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 20 13:32:26 PDT 2018


erik.pilkington created this revision.
erik.pilkington added reviewers: jfb, rsmith, aaron.ballman, rjmccall, bruno.
Herald added a subscriber: dexonsmith.

See the recent thread here: http://lists.llvm.org/pipermail/cfe-dev/2018-July/058494.html

This patch adds the flag -fno-c++-static-destructors, which disables registration of exit-time destructors of static or thread storage duration variables. This patch also adds [[clang::no_destroy]] and [[clang::always_destroy]] attributes for disabling dtors in -fc++-static-destructors mode, and enabling dtors in -fno-c++-static-destructors mode, respectively. This patch was based on @bruno's https://reviews.llvm.org/D22474.

rdar://21734598

Thanks for taking a look!
Erik


Repository:
  rC Clang

https://reviews.llvm.org/D50994

Files:
  clang/include/clang/AST/Decl.h
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/AttrDocs.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/AST/Decl.cpp
  clang/lib/CodeGen/ItaniumCXXABI.cpp
  clang/lib/CodeGen/MicrosoftCXXABI.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Sema/SemaDeclAttr.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/test/CodeGenCXX/always_destroy.cpp
  clang/test/CodeGenCXX/no_destroy.cpp
  clang/test/Misc/pragma-attribute-supported-attributes-list.test
  clang/test/SemaCXX/no_destroy.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50994.161548.patch
Type: text/x-patch
Size: 14757 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180820/3453e94d/attachment-0001.bin>


More information about the cfe-commits mailing list