[PATCH] D64671: [clang-tidy] New check: misc-init-local-variables

2019-10-02 Thread Jussi Pakkanen via Phabricator via cfe-commits
jpakkane updated this revision to Diff 222850. jpakkane added a comment. Rebased against latest Git master. Didn't see any rebase conflicts, though... CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64671/new/ https://reviews.llvm.org/D64671 Files:

[PATCH] D64671: [clang-tidy] New check: misc-init-local-variables

2019-10-01 Thread Jussi Pakkanen via Phabricator via cfe-commits
jpakkane added a comment. In D64671#1688626 , @aaron.ballman wrote: > Do you need someone to commit this on your behalf (sorry for not asking that > question sooner)? Yes, please. I have no rights of any kind, this is in fact my first ever pull

[PATCH] D64671: [clang-tidy] New check: misc-init-local-variables

2019-09-29 Thread Jussi Pakkanen via Phabricator via cfe-commits
jpakkane updated this revision to Diff 222335. jpakkane added a comment. Rebased against master to fix a merge conflict in release notes. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64671/new/ https://reviews.llvm.org/D64671 Files:

[PATCH] D64671: [clang-tidy] New check: misc-init-local-variables

2019-09-23 Thread Jussi Pakkanen via Phabricator via cfe-commits
jpakkane updated this revision to Diff 221376. jpakkane added a comment. Added MathHeader documentation. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64671/new/ https://reviews.llvm.org/D64671 Files: clang-tools-extra/clang-tidy/cppcoreguidelines/CMakeLists.txt

[PATCH] D64671: [clang-tidy] New check: misc-init-local-variables

2019-09-06 Thread Jussi Pakkanen via Phabricator via cfe-commits
jpakkane updated this revision to Diff 219179. jpakkane added a comment. Ordered doc list alphabetically. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64671/new/ https://reviews.llvm.org/D64671 Files: clang-tools-extra/clang-tidy/cppcoreguidelines/CMakeLists.txt

[PATCH] D64671: [clang-tidy] New check: misc-init-local-variables

2019-09-06 Thread Jussi Pakkanen via Phabricator via cfe-commits
jpakkane marked an inline comment as done. jpakkane added a comment. > It'll be reasonable to get IncludeStyle default from .clang-format. I looked at existing checks and they all do the same thing as this one. In fact I got the code for this by directly copypasting an existing check. Grepping

[PATCH] D64671: [clang-tidy] New check: misc-init-local-variables

2019-09-06 Thread Jussi Pakkanen via Phabricator via cfe-commits
jpakkane updated this revision to Diff 219162. jpakkane added a comment. Added documentation. Well, actually just swiped it from abseil-string-find-startswith. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64671/new/ https://reviews.llvm.org/D64671 Files:

[PATCH] D64671: [clang-tidy] New check: misc-init-local-variables

2019-09-05 Thread Jussi Pakkanen via Phabricator via cfe-commits
jpakkane updated this revision to Diff 218970. jpakkane marked 2 inline comments as done. jpakkane added a comment. Fixed issues raised in review. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64671/new/ https://reviews.llvm.org/D64671 Files:

[PATCH] D64671: [clang-tidy] New check: misc-init-local-variables

2019-09-03 Thread Jussi Pakkanen via Phabricator via cfe-commits
jpakkane marked 6 inline comments as done. jpakkane added inline comments. Comment at: clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp:31-32 + + if (!MatchedDecl->isLocalVarDecl()) +return; + aaron.ballman wrote: > jpakkane wrote: > >

[PATCH] D64671: [clang-tidy] New check: misc-init-local-variables

2019-09-03 Thread Jussi Pakkanen via Phabricator via cfe-commits
jpakkane updated this revision to Diff 218511. jpakkane added a comment. Updated patch as per review comments. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64671/new/ https://reviews.llvm.org/D64671 Files: clang-tools-extra/clang-tidy/cppcoreguidelines/CMakeLists.txt

[PATCH] D64671: [clang-tidy] New check: misc-init-local-variables

2019-09-02 Thread Jussi Pakkanen via Phabricator via cfe-commits
jpakkane marked 9 inline comments as done. jpakkane added inline comments. Comment at: clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp:21 + Finder->addMatcher( + varDecl(unless(hasInitializer(anything())), unless(isInstantiated())) +

[PATCH] D64671: [clang-tidy] New check: misc-init-local-variables

2019-09-02 Thread Jussi Pakkanen via Phabricator via cfe-commits
jpakkane updated this revision to Diff 218392. jpakkane added a comment. Updated to fix review comments. NOTE: detecting the include fix is broken because I could not get it to work. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64671/new/ https://reviews.llvm.org/D64671 Files:

[PATCH] D64671: [clang-tidy] New check: misc-init-local-variables

2019-08-29 Thread Jussi Pakkanen via Phabricator via cfe-commits
jpakkane updated this revision to Diff 217958. jpakkane added a comment. Updated patch to remove #include and the corresponding uint32_t test code snippet. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64671/new/ https://reviews.llvm.org/D64671 Files:

[PATCH] D64671: [clang-tidy] New check: misc-init-local-variables

2019-08-25 Thread Jussi Pakkanen via Phabricator via cfe-commits
jpakkane added a comment. I used stdint to replicate a real world use case as I'd imagine those types would match this search quite heavily. The tests already have one test for a typedeffed integer and one that is defined with a macro. If those are deemed sufficient, the stdint type can be

[PATCH] D64671: [clang-tidy] New check: misc-init-local-variables

2019-08-24 Thread Jussi Pakkanen via Phabricator via cfe-commits
jpakkane added a comment. Herald added a subscriber: wuzish. Does this still need work? FWICT all issues raised have been fixed. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64671/new/ https://reviews.llvm.org/D64671 ___ cfe-commits

[PATCH] D64671: [clang-tidy] New check: misc-init-local-variables

2019-07-31 Thread Jussi Pakkanen via Phabricator via cfe-commits
jpakkane updated this revision to Diff 212664. jpakkane added a comment. Herald added subscribers: kbarton, nemanjai. Renamed to cppcoreguidelines-init-variables. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64671/new/ https://reviews.llvm.org/D64671 Files:

[PATCH] D64671: [clang-tidy] New check: misc-init-local-variables

2019-07-30 Thread Jussi Pakkanen via Phabricator via cfe-commits
jpakkane marked 2 inline comments as done. jpakkane added a comment. In D64671#1603427 , @alexfh wrote: > A general comment: "misc" is a sort of a heap of checks that otherwise don't > have a good home. This one would probably better go to bugprone (or

[PATCH] D64671: [clang-tidy] New check: misc-init-local-variables

2019-07-19 Thread Jussi Pakkanen via Phabricator via cfe-commits
jpakkane marked 4 inline comments as done. jpakkane added inline comments. Comment at: clang-tools-extra/clang-tidy/misc/InitLocalVariablesCheck.cpp:21 + Finder->addMatcher( + varDecl(unless(hasInitializer(anything(.bind("vardecl"), this); +} alexfh

[PATCH] D64671: [clang-tidy] New check: misc-init-local-variables

2019-07-19 Thread Jussi Pakkanen via Phabricator via cfe-commits
jpakkane updated this revision to Diff 210868. jpakkane added a comment. Now properly deals with template instantiations and macros. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64671/new/ https://reviews.llvm.org/D64671 Files: clang-tools-extra/clang-tidy/misc/CMakeLists.txt

[PATCH] D64671: [clang-tidy] New check: misc-init-local-variables

2019-07-17 Thread Jussi Pakkanen via Phabricator via cfe-commits
jpakkane marked an inline comment as done. jpakkane added inline comments. Comment at: clang-tools-extra/clang-tidy/misc/InitLocalVariablesCheck.cpp:21 + Finder->addMatcher( + varDecl(unless(hasInitializer(anything(.bind("vardecl"), this); +} alexfh

[PATCH] D64671: [clang-tidy] New check: misc-init-local-variables

2019-07-16 Thread Jussi Pakkanen via Phabricator via cfe-commits
jpakkane marked an inline comment as done. jpakkane added inline comments. Comment at: clang-tools-extra/clang-tidy/misc/InitLocalVariablesCheck.cpp:21 + Finder->addMatcher( + varDecl(unless(hasInitializer(anything(.bind("vardecl"), this); +} alexfh

[PATCH] D64671: [clang-tidy] New check: misc-init-local-variables

2019-07-15 Thread Jussi Pakkanen via Phabricator via cfe-commits
jpakkane marked 2 inline comments as done. jpakkane added inline comments. Comment at: clang-tools-extra/clang-tidy/misc/InitLocalVariablesCheck.cpp:21 + Finder->addMatcher( + varDecl(unless(hasInitializer(anything(.bind("vardecl"), this); +} alexfh

[PATCH] D64671: [clang-tidy] New check: misc-init-local-variables

2019-07-13 Thread Jussi Pakkanen via Phabricator via cfe-commits
jpakkane updated this revision to Diff 209706. jpakkane marked an inline comment as done. jpakkane added a comment. Fix missing spaces in documentation. Repository: rCTE Clang Tools Extra CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64671/new/ https://reviews.llvm.org/D64671

[PATCH] D64671: [clang-tidy] New check: misc-init-local-variables

2019-07-13 Thread Jussi Pakkanen via Phabricator via cfe-commits
jpakkane marked 10 inline comments as done. jpakkane added inline comments. Comment at: clang-tools-extra/clang-tidy/misc/InitLocalVariablesCheck.cpp:26-29 + if(!MatchedDecl->isLocalVarDecl()) +return; + if(MatchedDecl->hasInit()) +return; lebedev.ri

[PATCH] D64671: [clang-tidy] New check: misc-init-local-variables

2019-07-13 Thread Jussi Pakkanen via Phabricator via cfe-commits
jpakkane updated this revision to Diff 209705. jpakkane added a comment. Fixed issues found in code review. Repository: rCTE Clang Tools Extra CHANGES SINCE LAST ACTION https://reviews.llvm.org/D64671/new/ https://reviews.llvm.org/D64671 Files:

[PATCH] D64671: New clang-tidy check: misc-init-local-variables

2019-07-12 Thread Jussi Pakkanen via Phabricator via cfe-commits
jpakkane created this revision. jpakkane added a reviewer: alexfh. Herald added subscribers: cfe-commits, mgorny. Herald added a project: clang. This checks finds all primitive type local variables (integers, doubles, pointers) that are declared without an initial value. Includes fixit