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

2019-07-09 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 208785. mgehre added a comment. Move checks into AST matchers Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61749/new/ https://reviews.llvm.org/D61749 Files: clang-tools-extra/clang-tidy/readability/CMakeList

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

2019-07-08 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre marked 2 inline comments as done. mgehre added inline comments. Comment at: clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp:96 +CheckFactories.registerCheck( +"readability-static-method"); CheckFactories.registerCheck(

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

2019-07-08 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 208505. mgehre marked 11 inline comments as done. mgehre added a comment. - Address review comments Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61749/new/ https://reviews.llvm.org/D61749 Files: clang-tools-

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

2019-07-03 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp:96 +CheckFactories.registerCheck( +"readability-static-method"); CheckFactories.registerCheck( I'm not super keen on the check na

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

2019-07-02 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment. Friendly ping. Are there outstanding concerns that I could address? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61749/new/ https://reviews.llvm.org/D61749 ___ cfe-commits mail

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

2019-06-10 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment. Ping Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61749/new/ https://reviews.llvm.org/D61749 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-

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

2019-05-13 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre updated this revision to Diff 199329. mgehre marked an inline comment as done. mgehre added a comment. Remove ``const`` part from this PR. Address comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61749/new/ https://reviews.llvm.org/D6

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

2019-05-13 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre marked 17 inline comments as done. mgehre added inline comments. Comment at: clang-tools-extra/test/clang-tidy/readability-static-const-method.cpp:312 +return const_cast(this)->get(); + } + JonasToth wrote: > mgehre wrote: > > JonasToth wrote: > > >

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

2019-05-13 Thread Jonas Toth via Phabricator via cfe-commits
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; }; mgehre wrote: > JonasToth wrote: > > Does it pass here?

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

2019-05-12 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre marked 2 inline comments as done. mgehre 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; }; JonasToth wrote:

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

2019-05-11 Thread Jonas Toth via Phabricator via cfe-commits
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 la

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

2019-05-11 Thread Jonas Toth via Phabricator via cfe-commits
JonasToth added a subscriber: shuaiwang. JonasToth added a comment. Hey, I do like your check! I think it would be great to implement this analysis in `utils/` as roman suggested. Then we have bigger flexibility. The `ExprMutAnalyzer` was requested to be moved to `clang/Analysis/` as the CSA fo

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

2019-05-10 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a comment. In D61749#1498541 , @mgehre wrote: > ... Still, this is two separate checks, logically. You can put the `FindUsageOfThis` e.g. into a new file in `clang-tidy/utils`. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST

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

2019-05-10 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre added a comment. I have thought about splitting the check into separate `static` & `const`, but kept it together because the analysis for both cases is very similar, i.e. finding the usage of `this`. Also, both checks share many preconditions, e.g. not applying them to virtual methods or

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

2019-05-10 Thread Roman Lebedev via Phabricator via cfe-commits
lebedev.ri added a reviewer: lebedev.ri. lebedev.ri added a comment. In D61749#1497162 , @Eugene.Zelenko wrote: > @JonasToth tried to implement const check, so probably const and static part > should be split. I agree, there is D54943

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

2019-05-09 Thread Eugene Zelenko via Phabricator via cfe-commits
Eugene.Zelenko added subscribers: JonasToth, Eugene.Zelenko. Eugene.Zelenko added a comment. @JonasToth tried to implement const check, so probably const and static part should be split. It's hard to tell about state of existing implementation, but you could continue it or at least borrow ideas

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

2019-05-09 Thread Matthias Gehre via Phabricator via cfe-commits
mgehre created this revision. mgehre added reviewers: alexfh, aaron.ballman. Herald added subscribers: xazax.hun, mgorny. Herald added a project: clang. Finds non-static member functions that can be made ``const`` or ``static``. The check conservatively tries to preserve logical costness in favor