[Analyzer][NoUncountedMembersChecker] Fix crash for C structs

Fixes https://bugs.llvm.org/show_bug.cgi?id=46177
Fixes second bug reported in https://bugs.llvm.org/show_bug.cgi?id=46142
This commit is contained in:
Jan Korous 2020-06-04 15:55:44 -07:00
parent 3d40c75189
commit a95c08db12
1 changed files with 5 additions and 1 deletions

View File

@ -109,7 +109,11 @@ public:
// Ref-counted smartpointers actually have raw-pointer to uncounted type as
// a member but we trust them to handle it correctly.
return isRefCounted(llvm::dyn_cast_or_null<CXXRecordDecl>(RD));
auto CXXRD = llvm::dyn_cast_or_null<CXXRecordDecl>(RD);
if (CXXRD)
return isRefCounted(CXXRD);
return false;
}
void reportBug(const FieldDecl *Member, const Type *MemberType,