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

Charles Zhang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 5 10:10:46 PDT 2019


czhang marked an inline comment as done.
czhang added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp:47
+void DynamicStaticInitializersCheck::registerMatchers(MatchFinder *Finder) {
+  if (!getLangOpts().CPlusPlus || getLangOpts().ThreadsafeStatics)
+    return;
----------------
lebedev.ri wrote:
> czhang wrote:
> > aaron.ballman wrote:
> > > Why is this check disabled for C++? I would expect dynamic init of a static in a C++ header file would be flagged by this check.
> > I'm confused now. If the language is not C++, we do an early return; that is, the check is run if we are on C++. Perhaps the early return is too confusing?
> Then the question is opposite, is this meaningless for C?
C can only initialize statics with constants, right?


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

https://reviews.llvm.org/D62829





More information about the cfe-commits mailing list