[clang-tidy] Handle anonymous structs/unions in member init checks.
authorMalcolm Parsons <malcolm.parsons@gmail.com>
Tue, 1 Aug 2017 09:54:05 +0000 (09:54 +0000)
committerMalcolm Parsons <malcolm.parsons@gmail.com>
Tue, 1 Aug 2017 09:54:05 +0000 (09:54 +0000)
commit2f968433960782f9397cd6c42aea45763c8fa64a
tree5bf3e93b4139a9d0c322133ab7c95dc8938ea1d4
parent31d08b6e51f25e97cc9de9e8f1c26773c33eee1c
[clang-tidy] Handle anonymous structs/unions in member init checks.

Use getAnyMember() instead of getMember() to avoid crash on anonymous
structs/unions.
Don't warn about initializing members of an anonymous union.

Fixes PR32966.

Reviewed by alexfh.

llvm-svn: 309668
clang-tools-extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp
clang-tools-extra/clang-tidy/readability/RedundantMemberInitCheck.cpp
clang-tools-extra/test/clang-tidy/modernize-use-default-member-init.cpp
clang-tools-extra/test/clang-tidy/readability-redundant-member-init.cpp