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
There is no need to check VarDecl here -- that's already done for you by the subject.