[PATCH] D59540: [clang-tidy] [PR41119] readability-identifier-naming incorrectly fixes lambda capture

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 19 08:34:21 PDT 2019


alexfh added a comment.

Thanks for fixing this! Could you expand the test a bit? See the inline comment.



================
Comment at: test/clang-tidy/readability-identifier-naming.cpp:506
+bool Foo() {
+  bool Columns=false;
+// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: invalid case style for local variable 'Columns'
----------------
If the formatting is not critical for the logic of the test, please clang-format the new test code.


================
Comment at: test/clang-tidy/readability-identifier-naming.cpp:509
+// CHECK-FIXES: {{^}}  bool columns=false;
+  auto ptr=[&]{return Columns;}();
+// CHECK-FIXES: {{^}}  auto ptr=[&]{return columns;}();
----------------
Please add more tests with
  1) by value automatic captures
  2) manual captures by value
  3) manual captures by reference
  4) nested lambdas capturing the same variable

A bit more nested code inside the lambda would also be interesting (where the use of the variable would be wrapped in a couple of compound statements).


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

https://reviews.llvm.org/D59540





More information about the cfe-commits mailing list