aaron.ballman added inline comments.

================
Comment at: 
clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp:39
+    return;
+  Finder->addMatcher(varDecl(hasGlobalStorage()).bind("var"), this);
+}
----------------
czhang wrote:
> aaron.ballman wrote:
> > Do you want to restrict this matcher to only variable declarations that 
> > have initializers, or are you also intending for this check to cover cases 
> > like:
> > ```
> > // At file scope.
> > struct S { S(); } s;
> > ```
> I think only variables with static storage are relevant to the stated goal of 
> the checker.
Variables declared at file scope have static storage duration by default.


================
Comment at: 
clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp:55
+  SourceLocation Loc = Var->getLocation();
+  if (!Loc.isValid() || !utils::isPresumedLocInHeaderFile(Loc, 
*Result.SourceManager,
+                                                          
HeaderFileExtensions))
----------------
czhang wrote:
> aaron.ballman wrote:
> > We have an AST matcher for this (`isExpansionInSystemHeader()`).
> Isn't this for system headers only, not just included 'user' headers?
Ahh, good point! Still, this should be trivial to make a local AST matcher for.


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