[clang-tidy] Fix `cppcoreguidelines-init-variables` for invalid vardecl
authorSockke <liuke.gehry@bytedance.com>
Tue, 7 Feb 2023 11:30:05 +0000 (19:30 +0800)
committerSockke <liuke.gehry@bytedance.com>
Tue, 7 Feb 2023 11:34:54 +0000 (19:34 +0800)
commitce6de98b80ada8efbff93766b5303db5ab052efc
tree3763eebbc6a8a7d07994e55345c8756c54097e77
parentf3188b98d05dc17417d6783265f38fe012a5b548
[clang-tidy] Fix `cppcoreguidelines-init-variables` for invalid vardecl

https://godbolt.org/z/n4cK4fo3o
The checker missed a check for invalid vardecl and this could cause a false positive.

Reviewed By: carlosgalvezp

Differential Revision: https://reviews.llvm.org/D138655
clang-tools-extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/init-variables.cpp