[PATCH] D70265: [clang-tidy] Add clang tidy check I.2 to cppcoreguidelines

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 30 06:10:16 PST 2019


JonasToth added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/cppcoreguidelines/AvoidNonConstGlobalVariablesCheck.cpp:110
+           "making it const")
+          << MemberVariable; // FIXME: Add fix-it hint to MemberVariable
+    }
----------------
missing `return`?


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-avoid-non-const-global-variables.rst:6
+
+Finds non-const global variables as described in check I.2 of C++ Core
+Guidelines.
----------------
I would prefer if the `I.2 of C++ Core Guidelines` is a link and to remove the link-string below this paragraph.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-avoid-non-const-global-variables.rst:29
+  char * e_ptr1 = &e;  // Warns!
+  char *const e_const_ptr  // Warns!
+  char & e_reference = e;  // Warns!
----------------
This is technically not valid code, as the pointer needs to be initialized and a `;` is missing. I think that should be fixed to not mislead inexperienced programmers.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70265





More information about the cfe-commits mailing list