[PATCH] D62829: [clang-tidy] Check for dynamically initialized statics in headers.
Eugene Zelenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 3 17:14:33 PDT 2019
Eugene.Zelenko added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp:37
+void DynamicStaticInitializersCheck::registerMatchers(MatchFinder *Finder) {
+ // FIXME: Add matchers.
+ if (!getLangOpts().CPlusPlus)
----------------
Will be good idea to address FIXME or remove if it's irrelevant.
================
Comment at: clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp:54
+void DynamicStaticInitializersCheck::check(const MatchFinder::MatchResult &Result) {
+ // FIXME: Add callback implementation.
+ auto *Var = Result.Nodes.getNodeAs<VarDecl>("var");
----------------
Will be good idea to address FIXME or remove if it's irrelevant.
================
Comment at: clang-tools-extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp:55
+ // FIXME: Add callback implementation.
+ auto *Var = Result.Nodes.getNodeAs<VarDecl>("var");
+ SourceLocation Loc = Var->getLocation();
----------------
Could it be const auto *?
================
Comment at: clang-tools-extra/docs/clang-tidy/checks/bugprone-dynamic-static-initializers.rst:9
+
+This can pose problems in certain multithreaded contexts.
----------------
Will be good idea to provide example.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62829/new/
https://reviews.llvm.org/D62829
More information about the cfe-commits
mailing list