forked from OSchip/llvm-project
[Analyzer][WebKit] Check record definition is available in NoUncountedMembers checker
isRefCountable asserts that the record passed as an argument has a definition available. Fixes: https://bugs.llvm.org/show_bug.cgi?id=46142 Differential Revision: https://reviews.llvm.org/D81017
This commit is contained in:
parent
e31ccee1b0
commit
d61ad66050
|
@ -75,7 +75,8 @@ public:
|
|||
continue;
|
||||
|
||||
if (auto *MemberCXXRD = MemberType->getPointeeCXXRecordDecl()) {
|
||||
if (isRefCountable(MemberCXXRD))
|
||||
// If we don't see the definition we just don't know.
|
||||
if (MemberCXXRD->hasDefinition() && isRefCountable(MemberCXXRD))
|
||||
reportBug(Member, MemberType, MemberCXXRD, RD);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
// regression test for https://bugs.llvm.org/show_bug.cgi?id=46142
|
||||
|
||||
// RUN: %clang_analyze_cc1 -analyzer-checker=webkit.WebKitNoUncountedMemberChecker -verify %s
|
||||
// expected-no-diagnostics
|
||||
|
||||
class ClassWithoutADefinition;
|
||||
class Foo {
|
||||
const ClassWithoutADefinition *foo;
|
||||
};
|
Loading…
Reference in New Issue