[PATCH] D64671: [clang-tidy] New check: misc-init-local-variables
Alexander Kornienko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 15 06:49:26 PDT 2019
alexfh added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/misc/InitLocalVariablesCheck.cpp:21
+ Finder->addMatcher(
+ varDecl(unless(hasInitializer(anything()))).bind("vardecl"), this);
+}
----------------
I believe, this should skip matches within template instantiations. Consider this code:
```
template<typename T>
void f(T) { T t; }
void g() {
f(0);
f(0.0);
}
```
What will the fix be?
================
Comment at: clang-tools-extra/clang-tidy/misc/InitLocalVariablesCheck.cpp:32
+ StringRef VarName = MatchedDecl->getName();
+ if (VarName.empty() || VarName.front() == '_') {
+ // Some standard library methods such as "be64toh" are implemented
----------------
Should this just disallow all fixes within macros? Maybe warnings as well.
Repository:
rCTE Clang Tools Extra
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64671/new/
https://reviews.llvm.org/D64671
More information about the cfe-commits
mailing list