-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update clang static analyzers per rename of member functions in CanMakeCheckedPtr. #114636
Conversation
…keCheckedPtr. The member functions that define CheckedPtr capable type is incrementCheckedPtrCount and decrementCheckedPtrCount after the rename.
@llvm/pr-subscribers-clang @llvm/pr-subscribers-clang-static-analyzer-1 Author: Ryosuke Niwa (rniwa) ChangesThe member functions that define CheckedPtr capable type is incrementCheckedPtrCount and decrementCheckedPtrCount after the rename. Full diff: https://github.com/llvm/llvm-project/pull/114636.diff 3 Files Affected:
diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
index 46819d5ca12058..3f8fa636ee99ff 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp
@@ -108,7 +108,7 @@ std::optional<bool> isRefCountable(const clang::CXXRecordDecl *R) {
}
std::optional<bool> isCheckedPtrCapable(const clang::CXXRecordDecl *R) {
- return isSmartPtrCompatible(R, "incrementPtrCount", "decrementPtrCount");
+ return isSmartPtrCompatible(R, "incrementCheckedPtrCount", "decrementCheckedPtrCount");
}
bool isRefType(const std::string &Name) {
diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp
index 1a5a7309a54f16..177c196127c7f0 100644
--- a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp
@@ -96,7 +96,8 @@ class UncountedCallArgsChecker
auto name = safeGetName(MD);
if (name == "ref" || name == "deref")
return;
- if (name == "incrementPtrCount" || name == "decrementPtrCount")
+ if (name == "incrementCheckedPtrCount" ||
+ name == "decrementCheckedPtrCount")
return;
}
auto *E = MemberCallExpr->getImplicitObjectArgument();
diff --git a/clang/test/Analysis/Checkers/WebKit/mock-types.h b/clang/test/Analysis/Checkers/WebKit/mock-types.h
index 8d95926e419beb..9c9326f0f11cfb 100644
--- a/clang/test/Analysis/Checkers/WebKit/mock-types.h
+++ b/clang/test/Analysis/Checkers/WebKit/mock-types.h
@@ -146,9 +146,9 @@ template <typename T> struct CheckedRef {
public:
CheckedRef() : t{} {};
- CheckedRef(T &t) : t(&t) { t.incrementPtrCount(); }
- CheckedRef(const CheckedRef &o) : t(o.t) { if (t) t->incrementPtrCount(); }
- ~CheckedRef() { if (t) t->decrementPtrCount(); }
+ CheckedRef(T &t) : t(&t) { t.incrementCheckedPtrCount(); }
+ CheckedRef(const CheckedRef &o) : t(o.t) { if (t) t->incrementCheckedPtrCount(); }
+ ~CheckedRef() { if (t) t->decrementCheckedPtrCount(); }
T &get() { return *t; }
T *ptr() { return t; }
T *operator->() { return t; }
@@ -165,14 +165,14 @@ template <typename T> struct CheckedPtr {
CheckedPtr(T *t)
: t(t) {
if (t)
- t->incrementPtrCount();
+ t->incrementCheckedPtrCount();
}
CheckedPtr(Ref<T> &&o)
: t(o.leakRef())
{ }
~CheckedPtr() {
if (t)
- t->decrementPtrCount();
+ t->decrementCheckedPtrCount();
}
T *get() { return t; }
T *operator->() { return t; }
@@ -184,16 +184,16 @@ template <typename T> struct CheckedPtr {
class CheckedObj {
public:
- void incrementPtrCount();
- void decrementPtrCount();
+ void incrementCheckedPtrCount();
+ void decrementCheckedPtrCount();
void method();
int trivial() { return 123; }
};
class RefCountableAndCheckable {
public:
- void incrementPtrCount() const;
- void decrementPtrCount() const;
+ void incrementCheckedPtrCount() const;
+ void decrementCheckedPtrCount() const;
void ref() const;
void deref() const;
void method();
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
There are references to llvm-project/clang/docs/analyzer/checkers.rst Line 3462 in 97b7474
I'm not sure if they are relevant to this change. Are they? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Oh, they need to be updated as well. Thanks for catching that! |
…keCheckedPtr. (llvm#114636) The member functions that define CheckedPtr capable type is incrementCheckedPtrCount and decrementCheckedPtrCount after the rename.
…keCheckedPtr. (llvm#114636) The member functions that define CheckedPtr capable type is incrementCheckedPtrCount and decrementCheckedPtrCount after the rename.
The member functions that define CheckedPtr capable type is incrementCheckedPtrCount and decrementCheckedPtrCount after the rename.