[PATCH] D61749: [clang-tidy] initial version of readability-static-const-method

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat May 11 03:04:46 PDT 2019


JonasToth added inline comments.


================
Comment at: clang-tools-extra/test/clang-tidy/readability-static-const-method.cpp:209
+void KeepLambdas() {
+  auto F = +[]() { return 0; };
+  auto F2 = []() { return 0; };
----------------
Does it pass here?
I looks a bit weird, shouldnt the lambda be called for this to work (this is the unary + right?)?


================
Comment at: clang-tools-extra/test/clang-tidy/readability-static-const-method.cpp:312
+    return const_cast<DataPattern *>(this)->get();
+  }
+
----------------
I think more template tests wouldn't hurt. From the other checks experience I can safely say we got burned a few times :)
Instantiating the templates with builtin arrays, pointers, references and different qualifiers usually produces interesting test cases as well, that need to be handled properly.

Another thing that comes to mind with templates are overloaded operators.
```
template <class Foo>
void bar() {
     Foo x1, x2;
     Foo y = x1 + x2;
}
```
Builtins are not changed by `operator+` but that can not be said about other types in general (maybe with concepts used properly).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61749





More information about the cfe-commits mailing list