llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-static-analyzer-1

Author: Ryosuke Niwa (rniwa)

<details>
<summary>Changes</summary>

The 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:

- (modified) clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp 
(+1-1) 
- (modified) 
clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedCallArgsChecker.cpp (+2-1) 
- (modified) clang/test/Analysis/Checkers/WebKit/mock-types.h (+9-9) 


``````````diff
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();

``````````

</details>


https://github.com/llvm/llvm-project/pull/114636
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to