aaron.ballman 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;
----------------
czhang wrote:
> 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?
Oye, my eyes saw one thing and my brain saw another. :-P You're right, @czhang, 
this code is correct as-is (C only initializes statics with a constant).


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

https://reviews.llvm.org/D62829



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to