[PATCH] D62829: [clang-tidy] Check for dynamically initialized statics in headers.

Charles Zhang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 6 16:55:53 PDT 2019


czhang added a comment.

In D62829#1533345 <https://reviews.llvm.org/D62829#1533345>, @lebedev.ri wrote:

> Hmm, but there already is clang's `-Wglobal-constructors`, that fires on some of these:
>  https://godbolt.org/z/rSnNuu
>  You are sure those extra warning this check produces ontop of `-Wglobal-constructors` are correct?
>  If so, maybe `-Wglobal-constructors` should be extended instead?


Yes, this change is for variables with static lifetimes that are not necessarily globally scoped. The name -global-constructors would be a misnomer. In addition, this check is intended purely for header files, for reasons documented in the .rst file. Although similar, I do not believe this check would make sense as an extension to -global-constructors.


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

https://reviews.llvm.org/D62829





More information about the cfe-commits mailing list