[PATCH] D70265: [clang-tidy] Add CppCoreGuidelines I.2 "Avoid non-const global variables" check
Roman Lebedev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 31 14:17:18 PDT 2020
lebedev.ri added a comment.
Hello.
2 points:
rG512767eb3fe9c34c655a480d034147c54f1d4f85 <https://reviews.llvm.org/rG512767eb3fe9c34c655a480d034147c54f1d4f85> doesn't reference this review,
so it's a bit hard to find. Please try to reference it next time.
Is this check really intentionally complaining about function-scope static variables?
How are they global?
https://godbolt.org/z/2QMemL
void bar(int*);
void foo() {
static int a;
bar(&a);
}
<source>:4:14: warning: variable 'a' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]
static int a;
^
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