[PATCH] D81017: [Analyzer][WebKit] Check record definition is available in NoUncountedMembers checker
Jan Korous via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 2 13:11:41 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd61ad660503d: [Analyzer][WebKit] Check record definition is available in NoUncountedMembers… (authored by jkorous).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D81017/new/
https://reviews.llvm.org/D81017
Files:
clang/lib/StaticAnalyzer/Checkers/WebKit/NoUncountedMembersChecker.cpp
clang/test/Analysis/Checkers/WebKit/uncounted-members-regression-46142.cpp
Index: clang/test/Analysis/Checkers/WebKit/uncounted-members-regression-46142.cpp
===================================================================
--- /dev/null
+++ clang/test/Analysis/Checkers/WebKit/uncounted-members-regression-46142.cpp
@@ -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;
+};
Index: clang/lib/StaticAnalyzer/Checkers/WebKit/NoUncountedMembersChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/WebKit/NoUncountedMembersChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/WebKit/NoUncountedMembersChecker.cpp
@@ -75,7 +75,8 @@
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);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81017.267964.patch
Type: text/x-patch
Size: 1205 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200602/37da3050/attachment-0001.bin>
More information about the cfe-commits
mailing list