[clang] [alpha.webkit.RetainPtrCtorAdoptChecker] Check nullity before calling IgnoreParenCasts. (PR #137556)

2025-04-27 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/137556 None >From 46d5c45c4c7a6abe0255aa31e2c7435d7f3e8289 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Sun, 27 Apr 2025 15:16:40 -0700 Subject: [PATCH] [alpha.webkit.RetainPtrCtorAdoptChecker] Check nullity before

[clang] [alpha.webkit.RetainPtrCtorAdoptChecker] An assortment of small enhancements (PR #135329)

2025-04-27 Thread Ryosuke Niwa via cfe-commits
rniwa wrote: Thanks for the review! https://github.com/llvm/llvm-project/pull/135329 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.RetainPtrCtorAdoptChecker] An assortment of small enhancements (PR #135329)

2025-04-27 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/135329 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Support ptr to ptr and union in webkit member checker (PR #137565)

2025-04-27 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/137565 None >From 9d6c807a5d7b853876132be0668357f6945978af Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Sun, 20 Apr 2025 18:38:31 -0700 Subject: [PATCH 1/2] [RawPtrRefMemberChecker] Make RawPtrRefMemberChecker con

[clang] [RawPtrRefMemberChecker] Make RawPtrRefMemberChecker consistent with other checkers (PR #137559)

2025-04-27 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/137559 >From 9d6c807a5d7b853876132be0668357f6945978af Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Sun, 20 Apr 2025 18:38:31 -0700 Subject: [PATCH 1/2] [RawPtrRefMemberChecker] Make RawPtrRefMemberChecker consisten

[clang] [WebKit checkers] Treat std::bit_cast as a pointer conversion (PR #137476)

2025-04-26 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/137476 WebKit repalced its use of WTF::bitwise_cast with std::bit_cast. Add the support for recognizing it as a pointer conversion. >From c76e86105b5ba03cc2a3c8399670b2b38eb8e6ea Mon Sep 17 00:00:00 2001 From: Ryosuke N

[clang] [RawPtrRefMemberChecker] Add the support for union and pointers to unsafe pointers. (PR #138042)

2025-04-30 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/138042 This PR adds support for detecting unsafe union members and pointers to unsafe pointers (e.g. T** where T* is an unsafe pointer type). Rate limit · GitHub body { ba

[clang] Support ptr to ptr and union in webkit member checker (PR #137566)

2025-04-30 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/137566 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Support ptr to ptr and union in webkit member checker (PR #137566)

2025-04-30 Thread Ryosuke Niwa via cfe-commits
rniwa wrote: Closing this in favor of https://github.com/llvm/llvm-project/pull/138042. https://github.com/llvm/llvm-project/pull/137566 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [WebKit checkers] Treat std::bit_cast as a pointer conversion (PR #137476)

2025-04-30 Thread Ryosuke Niwa via cfe-commits
@@ -462,7 +462,7 @@ bool isPtrConversion(const FunctionDecl *F) { const auto FunctionName = safeGetName(F); if (FunctionName == "getPtr" || FunctionName == "WeakPtr" || FunctionName == "dynamicDowncast" || FunctionName == "downcast" || - FunctionName == "checkedD

[clang] [WebKit checkers] Treat std::bit_cast as a pointer conversion (PR #137476)

2025-04-30 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/137476 >From c76e86105b5ba03cc2a3c8399670b2b38eb8e6ea Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Sat, 26 Apr 2025 14:03:13 -0700 Subject: [PATCH 1/2] [WebKit checkers] Treat std::bit_cast as a pointer conversion

[clang] Remove the redundant check for "WeakPtr" in isSmartPtrClass to fix the issue 135612. (PR #135629)

2025-04-14 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/135629 None >From 928db4c6ac01b96bbe65a9c3aec05c84c97a1040 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Mon, 14 Apr 2025 07:49:07 -0700 Subject: [PATCH] Remove the redundant check for "WeakPtr" in isSmartPtrClass

[clang] [alpha.webkit.UnretainedCallArgsChecker] Add the support for RetainPtrArc (PR #135532)

2025-04-14 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/135532 >From efd914e66352fdf7e9fac3355d0a06159e880987 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Sun, 13 Apr 2025 01:30:26 -0700 Subject: [PATCH 1/3] [alpha.webkit.UnretainedCallArgsChecker] Add the support for R

[clang] Remove the redundant check for "WeakPtr" in isSmartPtrClass to fix the issue 135612. (PR #135629)

2025-04-14 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/135629 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UnretainedCallArgsChecker] Add the support for RetainPtrArc (PR #135532)

2025-04-14 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/135532 >From efd914e66352fdf7e9fac3355d0a06159e880987 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Sun, 13 Apr 2025 01:30:26 -0700 Subject: [PATCH 1/2] [alpha.webkit.UnretainedCallArgsChecker] Add the support for R

[clang] [alpha.webkit.UnretainedCallArgsChecker] Add the support for RetainPtrArc (PR #135532)

2025-04-15 Thread Ryosuke Niwa via cfe-commits
rniwa wrote: Thanks for the review! https://github.com/llvm/llvm-project/pull/135532 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UnretainedCallArgsChecker] Add the support for RetainPtrArc (PR #135532)

2025-04-15 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/135532 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [RawPtrRefMemberChecker] Make RawPtrRefMemberChecker consistent with other checkers (PR #137559)

2025-04-30 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/137559 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [RawPtrRefMemberChecker] Make RawPtrRefMemberChecker consistent with other checkers (PR #137559)

2025-04-30 Thread Ryosuke Niwa via cfe-commits
rniwa wrote: Thanks for the review! https://github.com/llvm/llvm-project/pull/137559 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [WebKit checkers] Treat std::bit_cast as a pointer conversion (PR #137476)

2025-04-30 Thread Ryosuke Niwa via cfe-commits
@@ -462,7 +462,7 @@ bool isPtrConversion(const FunctionDecl *F) { const auto FunctionName = safeGetName(F); if (FunctionName == "getPtr" || FunctionName == "WeakPtr" || FunctionName == "dynamicDowncast" || FunctionName == "downcast" || - FunctionName == "checkedD

[clang] [webkit.UncountedLambdaCapturesChecker] Treat a copy capture of a CheckedPtr object as safe (PR #138068)

2025-04-30 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/138068 Allow copy capture of a reference to a CheckedPtr capable object since such a capture will copy the said object instead of keeping a dangling reference to the object. Rate limit · GitHub

[clang] [WebKit checkers] Treat std::bit_cast as a pointer conversion (PR #137476)

2025-04-30 Thread Ryosuke Niwa via cfe-commits
rniwa wrote: Thanks for the review! https://github.com/llvm/llvm-project/pull/137476 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [webkit.UncountedLambdaCapturesChecker] Treat a call to lambda function via a variable as safe. (PR #135688)

2025-04-24 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/135688 >From 41992e5ffb43f7db7704b93c7ad5fe2135e86e26 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Mon, 14 Apr 2025 15:12:10 -0700 Subject: [PATCH 1/2] [webkit.UncountedLambdaCapturesChecker] Treat a call to lambda

[clang] [webkit.UncountedLambdaCapturesChecker] Treat a call to lambda function via a variable as safe. (PR #135688)

2025-04-24 Thread Ryosuke Niwa via cfe-commits
@@ -372,6 +372,14 @@ void trivial_lambda() { trivial_lambda(); } +bool call_lambda_var_decl() { + RefCountable* ref_countable = make_obj(); + auto lambda = [&]() -> bool { +return ref_countable->next(); + }; + return lambda(); +} + rniwa wrote: Sure

[clang] [webkit.UncountedLambdaCapturesChecker] Treat a call to lambda function via a variable as safe. (PR #135688)

2025-04-24 Thread Ryosuke Niwa via cfe-commits
rniwa wrote: Thanks for the review! https://github.com/llvm/llvm-project/pull/135688 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [webkit.UncountedLambdaCapturesChecker] Treat a call to lambda function via a variable as safe. (PR #135688)

2025-04-24 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/135688 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UncheckedCallArgsChecker] Checker fails to recognize CanMakeCheckedPtrBase (PR #136500)

2025-04-24 Thread Ryosuke Niwa via cfe-commits
rniwa wrote: Thank you for the review! https://github.com/llvm/llvm-project/pull/136500 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UncheckedCallArgsChecker] Checker fails to recognize CanMakeCheckedPtrBase (PR #136500)

2025-04-24 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/136500 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [WebKit checkers] Treat global const variables as safe (PR #136170)

2025-04-22 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/136170 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [WebKit checkers] Treat global const variables as safe (PR #136170)

2025-04-22 Thread Ryosuke Niwa via cfe-commits
rniwa wrote: Thank you for the review! https://github.com/llvm/llvm-project/pull/136170 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.ForwardDeclChecker] Recognize a forward declared template specialization (PR #134545)

2025-04-10 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/134545 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.ForwardDeclChecker] Recognize a forward declared template specialization (PR #134545)

2025-04-10 Thread Ryosuke Niwa via cfe-commits
rniwa wrote: Thanks for the review! https://github.com/llvm/llvm-project/pull/134545 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.RetainPtrCtorAdoptChecker] Support adopt(cast(copy(~)) (PR #132316)

2025-04-10 Thread Ryosuke Niwa via cfe-commits
rniwa wrote: Thanks for the review! https://github.com/llvm/llvm-project/pull/132316 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.RetainPtrCtorAdoptChecker] Support adopt(cast(copy(~)) (PR #132316)

2025-04-10 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/132316 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UnretainedCallArgsChecker] Add the support for RetainPtrArc (PR #135532)

2025-04-13 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/135532 WebKit uses #define to rename RetainPtr to RetainPtrArc so add the support for it. >From efd914e66352fdf7e9fac3355d0a06159e880987 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Sun, 13 Apr 2025 01:30:26 -0700

[clang] [alpha.webkit.UnretainedCallArgsChecker] Don't emit a warning for RetainPtr::operator= (PR #135526)

2025-04-13 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/135526 Generalize the check for operator= so that it works for RetainPtr and CheckedPtr instead of just RefPtr. >From 6ca0049fdbc74a9f408b17d62260d6ff7d511ae4 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Sun, 13 A

[clang] [alpha.webkit.UnretainedCallArgsChecker] Don't emit a warning for RetainPtr::operator= (PR #135526)

2025-04-15 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/135526 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Support ptr to ptr and union in webkit member checker (PR #137565)

2025-04-27 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/137565 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Support ptr to ptr and union in webkit member checker (PR #137566)

2025-04-27 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/137566 None >From a04f65339530bea920c80dc1b2b0f3c9bab488c3 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Sun, 20 Apr 2025 18:38:31 -0700 Subject: [PATCH 1/2] [RawPtrRefMemberChecker] Make RawPtrRefMemberChecker con

[clang] [alpha.webkit.RetainPtrCtorAdoptChecker] Check nullity before calling IgnoreParenCasts. (PR #137556)

2025-04-27 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/137556 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [RawPtrRefMemberChecker] Make RawPtrRefMemberChecker consistent with other checkers (PR #137559)

2025-04-27 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/137559 Refactor RawPtrRefMemberChecker so that each subclass override isUnsafePtr like other WebKit checkers instead of overriding isPtrCompatible. >From 9d6c807a5d7b853876132be0668357f6945978af Mon Sep 17 00:00:00 2001

[clang] Check the type of Objective-C++ instance variables in WebKit member variable checkers. (PR #127570)

2025-02-18 Thread Ryosuke Niwa via cfe-commits
@@ -87,6 +92,31 @@ class RawPtrRefMemberChecker } } + void visitObjCDecl(const ObjCContainerDecl *CD) const { +if (auto *ID = dyn_cast(CD)) { rniwa wrote: oh, but this if statement does that already, right? as in, this if will only evaluate to tru

[clang] Check the type of Objective-C++ instance variables in WebKit member variable checkers. (PR #127570)

2025-02-18 Thread Ryosuke Niwa via cfe-commits
@@ -87,6 +92,31 @@ class RawPtrRefMemberChecker } } + void visitObjCDecl(const ObjCContainerDecl *CD) const { +if (auto *ID = dyn_cast(CD)) { + for (auto *Ivar : ID->ivars()) +visitIvarDecl(CD, Ivar); + return; +} +if (auto *ID = dyn_cast(C

[clang] Check the type of Objective-C++ instance variables in WebKit member variable checkers. (PR #127570)

2025-02-18 Thread Ryosuke Niwa via cfe-commits
@@ -87,6 +92,31 @@ class RawPtrRefMemberChecker } } + void visitObjCDecl(const ObjCContainerDecl *CD) const { +if (auto *ID = dyn_cast(CD)) { rniwa wrote: I don't think so. `ObjCContainerDecl` could be `ObjCCategoryDecl` or `ObjCProtocolDecl` as w

[clang] Check the type of Objective-C++ instance variables in WebKit member variable checkers. (PR #127570)

2025-02-18 Thread Ryosuke Niwa via cfe-commits
@@ -87,6 +92,31 @@ class RawPtrRefMemberChecker } } + void visitObjCDecl(const ObjCContainerDecl *CD) const { +if (auto *ID = dyn_cast(CD)) { + for (auto *Ivar : ID->ivars()) +visitIvarDecl(CD, Ivar); + return; +} +if (auto *ID = dyn_cast(C

[clang] [alpha.webkit.UnretainedLocalVarsChecker] Add a checker for local variables to NS and CF types. (PR #127554)

2025-02-17 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/127554 >From d6c4e1a23dc0cc6850c5cfdceecc2e1be8943592 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Mon, 17 Feb 2025 18:18:09 -0800 Subject: [PATCH 1/3] [alpha.webkit.UnretainedLocalVarsChecker] Add a checker for lo

[clang] [alpha.webkit.UnretainedLocalVarsChecker] Add a checker for local variables to NS and CF types. (PR #127554)

2025-02-17 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/127554 This PR adds alpha.webkit.UnretainedLocalVarsChecker by generalizing RawPtrRefLocalVarsChecker. It checks local variables to NS or CF types are guarded with a RetainPtr or not. The new checker is effective for NS

[clang] Check the type of Objective-C++ instance variables in WebKit member variable checkers. (PR #127570)

2025-02-17 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/127570 Like a C++ member variable, every Objective-C++ instance variable must be a RefPtr, Ref CheckedPtr, or CheckedRef to an object, not a raw pointer or reference. >From f93a95fc02a9389fda9597c6dffe0f16d8bc2bf1 Mon

[clang] [alpha.webkit.UnretainedLocalVarsChecker] Add a checker for local variables to NS and CF types. (PR #127554)

2025-02-17 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/127554 >From d6c4e1a23dc0cc6850c5cfdceecc2e1be8943592 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Mon, 17 Feb 2025 18:18:09 -0800 Subject: [PATCH 1/2] [alpha.webkit.UnretainedLocalVarsChecker] Add a checker for lo

[clang] [alpha.webkit.webkit.RetainPtrCtorAdoptChecker] Add a new WebKit checker for correct use of RetainPtr, adoptNS, and adoptCF (PR #128679)

2025-03-07 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/128679 >From b4001f95cf6d35f59ef8af6df8f2bdbe043da380 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Tue, 25 Feb 2025 00:47:45 -0800 Subject: [PATCH 1/6] [alpha.webkit.webkit.RetainPtrCtorAdoptChecker] Add a new WebK

[clang] [alpha.webkit.webkit.RetainPtrCtorAdoptChecker] Add a new WebKit checker for correct use of RetainPtr, adoptNS, and adoptCF (PR #128679)

2025-03-07 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/128679 >From b4001f95cf6d35f59ef8af6df8f2bdbe043da380 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Tue, 25 Feb 2025 00:47:45 -0800 Subject: [PATCH 1/5] [alpha.webkit.webkit.RetainPtrCtorAdoptChecker] Add a new WebK

[clang] [alpha.webkit.webkit.RetainPtrCtorAdoptChecker] Add a new WebKit checker for correct use of RetainPtr, adoptNS, and adoptCF (PR #128679)

2025-03-07 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/128679 >From b4001f95cf6d35f59ef8af6df8f2bdbe043da380 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Tue, 25 Feb 2025 00:47:45 -0800 Subject: [PATCH 1/4] [alpha.webkit.webkit.RetainPtrCtorAdoptChecker] Add a new WebK

[clang] [alpha.webkit.UncountedCallArgsChecker] Recognize CXXUnresolvedConstructExpr as a safe origin. (PR #130258)

2025-03-07 Thread Ryosuke Niwa via cfe-commits
rniwa wrote: Thanks for the review! https://github.com/llvm/llvm-project/pull/130258 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UncountedCallArgsChecker] Fix a false negative when a call argument is a local variable. (PR #129974)

2025-03-07 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/129974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UncountedCallArgsChecker] Recognize CXXUnresolvedConstructExpr as a safe origin. (PR #130258)

2025-03-06 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/130258 Handle CXXUnresolvedConstructExpr in tryToFindPtrOrigin so that constructing Ref, RefPtr, CheckedRef, CheckedPtr, ... constructed in such a way that its type is unresolved at AST level will be still treated as a

[clang] [alpha.webkit.UncountedCallArgsChecker] Recognize CXXUnresolvedConstructExpr as a safe origin. (PR #130258)

2025-03-07 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/130258 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [alpha.webkit.UnretainedLambdaCapturesChecker] Add a WebKit checker for lambda capturing NS or CF types. (PR #128651)

2025-03-09 Thread Ryosuke Niwa via cfe-commits
@@ -3487,6 +3487,18 @@ Raw pointers and references to an object which supports CheckedPtr or CheckedRef See `WebKit Guidelines for Safer C++ Programming `_ for details. +alpha.webkit.UnretainedLambdaCapturesChecker

[clang] [llvm] [alpha.webkit.UnretainedLambdaCapturesChecker] Add a WebKit checker for lambda capturing NS or CF types. (PR #128651)

2025-03-09 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/128651 >From dc53e0602fcec63bdd1bc84325ecc16a3f3e293b Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Mon, 24 Feb 2025 23:39:13 -0800 Subject: [PATCH 1/3] [alpha.webkit.UnretainedLambdaCapturesChecker] Add a WebKit ch

[clang] [alpha.webkit.NoUnretainedMemberChecker] Add a new WebKit checker for unretained member variables and ivars. (PR #128641)

2025-03-09 Thread Ryosuke Niwa via cfe-commits
@@ -0,0 +1,57 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.NoUnretainedMemberChecker -verify %s + +#include "objc-mock-types.h" + +namespace members { + + struct Foo { + private: +SomeObj* a = nullptr; +// expected-warning@-1{{Member variable 'a' in 'member

[clang] [alpha.webkit.NoUnretainedMemberChecker] Add a new WebKit checker for unretained member variables and ivars. (PR #128641)

2025-03-09 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/128641 >From a4cd301d6176a8ee3441d0c74f6d2c4e32a50cdd Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Mon, 24 Feb 2025 23:01:31 -0800 Subject: [PATCH 1/3] [alpha.webkit.NoUnretainedMemberChecker] Add a new WebKit chec

[clang] [alpha.webkit.NoUnretainedMemberChecker] Add a new WebKit checker for unretained member variables and ivars. (PR #128641)

2025-03-09 Thread Ryosuke Niwa via cfe-commits
@@ -3487,6 +3487,19 @@ Raw pointers and references to an object which supports CheckedPtr or CheckedRef See `WebKit Guidelines for Safer C++ Programming `_ for details. +alpha.webkit.NoUnretainedMemberChecker +

[clang] [llvm] [alpha.webkit.UnretainedLambdaCapturesChecker] Add a WebKit checker for lambda capturing NS or CF types. (PR #128651)

2025-03-09 Thread Ryosuke Niwa via cfe-commits
rniwa wrote: Thanks for the review! https://github.com/llvm/llvm-project/pull/128651 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [alpha.webkit.UnretainedLambdaCapturesChecker] Add a WebKit checker for lambda capturing NS or CF types. (PR #128651)

2025-03-09 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/128651 >From dc53e0602fcec63bdd1bc84325ecc16a3f3e293b Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Mon, 24 Feb 2025 23:39:13 -0800 Subject: [PATCH 1/3] [alpha.webkit.UnretainedLambdaCapturesChecker] Add a WebKit ch

[clang] [alpha.webkit.UncountedCallArgsChecker] Fix a false negative when a call argument is a local variable. (PR #129974)

2025-03-05 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/129974 isASafeCallArg erroneously returns true when a call argument is a local variable regardless of its type. This is incorrect. We should only allow any local variable of a safe pointer type. Fix the bug by moving t

[clang] [alpha.webkit.UnretainedCallArgsChecker] Add a checker for NS or CF type call arguments. (PR #128586)

2025-03-10 Thread Ryosuke Niwa via cfe-commits
@@ -141,6 +158,42 @@ class RawPtrRefCallArgsChecker } } + void visitObjCMessageExpr(const ObjCMessageExpr *E, const Decl *D) const { +if (BR->getSourceManager().isInSystemHeader(E->getExprLoc())) + return; + +auto Selector = E->getSelector(); +if (auto

[clang] [alpha.webkit.UnretainedCallArgsChecker] Add a checker for NS or CF type call arguments. (PR #128586)

2025-03-10 Thread Ryosuke Niwa via cfe-commits
rniwa wrote: Let me close this and create a new PR with the corrected commit message. https://github.com/llvm/llvm-project/pull/128586 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UnretainedCallArgsChecker] Add a checker for NS or CF type call arguments. (PR #128586)

2025-03-10 Thread Ryosuke Niwa via cfe-commits
@@ -28,6 +29,15 @@ bool tryToFindPtrOrigin( std::function isSafePtrType, std::function callback) { while (E) { +if (auto *DRE = dyn_cast(E)) { + auto *ValDecl = DRE->getDecl(); + auto QT = ValDecl->getType(); + auto ValName = ValDecl->getName(); +

[clang] [alpha.webkit.UnretainedCallArgsChecker] Add a checker for NS or CF type call arguments. (PR #128586)

2025-03-11 Thread Ryosuke Niwa via cfe-commits
rniwa wrote: > This PR adds alpha.webkit.UnretainedCallArgsChecker by generalizing > RawPtrRefLocalVarsChecker. Do you mean RawPtrRefCallArgsChecker? Oh yeah, not sure how I'm gonna fix the typo in a commit message other than force pushing it though. https://github.com/llvm/llvm-project/pull/

[clang] [WebKit checkers] Don't treat virtual functions as safe. (PR #129632)

2025-03-10 Thread Ryosuke Niwa via cfe-commits
rniwa wrote: Thanks for the review! https://github.com/llvm/llvm-project/pull/129632 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UnretainedCallArgsChecker] Add a checker for NS or CF type call arguments. (PR #130729)

2025-03-11 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/130729 This PR adds alpha.webkit.UnretainedCallArgsChecker by generalizing RawPtrRefCallArgsChecker. It checks call arguments of NS or CF types are backed by a RetainPtr or not. The new checker emits warnings for CF typ

[clang] [WebKit checkers] Don't treat virtual functions as safe. (PR #129632)

2025-03-11 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/129632 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [alpha.webkit.UnretainedLambdaCapturesChecker] Add a WebKit checker for lambda capturing NS or CF types. (PR #128651)

2025-03-09 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/128651 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UnretainedCallArgsChecker] Add a checker for NS or CF type call arguments. (PR #128586)

2025-03-09 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/128586 >From 90403f77295c0b3e4415263754e22b3c66f31876 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Mon, 24 Feb 2025 13:43:04 -0800 Subject: [PATCH 1/6] [alpha.webkit.UnretainedCallArgsChecker] Add a checker for NS

[clang] [alpha.webkit.ForwardDeclChecker] Add a new WebKit checker for forward declarations (PR #130554)

2025-03-09 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/130554 Add a new static analyzer which emits warnings for function call arguments, local variables, and member variables that are only forward declared. These forward declaration prevents other WebKit checkers from chec

[clang] [alpha.webkit.NoUnretainedMemberChecker] Add a new WebKit checker for unretained member variables and ivars. (PR #128641)

2025-03-09 Thread Ryosuke Niwa via cfe-commits
rniwa wrote: Thanks for the review! https://github.com/llvm/llvm-project/pull/128641 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.ForwardDeclChecker] Add a new WebKit checker for forward declarations (PR #130554)

2025-03-09 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/130554 >From d2edd9b5fd188476e59790c333497516933532bb Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Sun, 9 Mar 2025 23:06:33 -0700 Subject: [PATCH 1/2] [alpha.webkit.ForwardDeclChecker] Add a new WebKit checker for

[clang] [alpha.webkit.ForwardDeclChecker] Add a new WebKit checker for forward declarations (PR #130554)

2025-03-09 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/130554 >From d2edd9b5fd188476e59790c333497516933532bb Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Sun, 9 Mar 2025 23:06:33 -0700 Subject: [PATCH] [alpha.webkit.ForwardDeclChecker] Add a new WebKit checker for forw

[clang] [alpha.webkit.NoUnretainedMemberChecker] Add a new WebKit checker for unretained member variables and ivars. (PR #128641)

2025-03-09 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/128641 >From a4cd301d6176a8ee3441d0c74f6d2c4e32a50cdd Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Mon, 24 Feb 2025 23:01:31 -0800 Subject: [PATCH 1/3] [alpha.webkit.NoUnretainedMemberChecker] Add a new WebKit chec

[clang] [alpha.webkit.UnretainedCallArgsChecker] Add a checker for NS or CF type call arguments. (PR #128586)

2025-03-11 Thread Ryosuke Niwa via cfe-commits
rniwa wrote: Fixed all the issues and posted a new PR at https://github.com/llvm/llvm-project/pull/130729 https://github.com/llvm/llvm-project/pull/128586 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/l

[clang] [alpha.webkit.UnretainedCallArgsChecker] Add a checker for NS or CF type call arguments. (PR #128586)

2025-03-11 Thread Ryosuke Niwa via cfe-commits
@@ -141,6 +158,42 @@ class RawPtrRefCallArgsChecker } } + void visitObjCMessageExpr(const ObjCMessageExpr *E, const Decl *D) const { +if (BR->getSourceManager().isInSystemHeader(E->getExprLoc())) + return; + +auto Selector = E->getSelector(); +if (auto

[clang] [alpha.webkit.webkit.RetainPtrCtorAdoptChecker] Add a new WebKit checker for correct use of RetainPtr, adoptNS, and adoptCF (PR #128679)

2025-03-11 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/128679 >From b4001f95cf6d35f59ef8af6df8f2bdbe043da380 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Tue, 25 Feb 2025 00:47:45 -0800 Subject: [PATCH 1/6] [alpha.webkit.webkit.RetainPtrCtorAdoptChecker] Add a new WebK

[clang] [alpha.webkit.UnretainedCallArgsChecker] Add a checker for NS or CF type call arguments. (PR #128586)

2025-03-11 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/128586 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.ForwardDeclChecker] Add a new WebKit checker for forward declarations (PR #130554)

2025-03-12 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/130554 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [webkit.NoUncountedMemberChecker] Fix a regression that every class is treated as if it's ref countable. (PR #131249)

2025-03-13 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/131249 This PR fixes a regression that webkit.NoUncountedMemberChecker and alpha.webkit.NoUncheckedMemberChecker emits warnings for every class as if they supported ref counting and checked ptr because we were erroneous

[clang] Skip unretained-call-args.mm on platforms where builtin is not supported. (PR #131252)

2025-03-13 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/131252 None >From ac2c87d6d5787b7d68487f97e6b00dc208ade79a Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Thu, 13 Mar 2025 18:56:32 -0700 Subject: [PATCH] Skip unretained-call-args.mm on platforms where builtin is n

[clang] Add unretained call args checker (PR #130901)

2025-03-12 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/130901 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UnretainedCallArgsChecker] Add a checker for NS or CF type call arguments. (PR #130729)

2025-03-11 Thread Ryosuke Niwa via cfe-commits
rniwa wrote: Thanks for the review! https://github.com/llvm/llvm-project/pull/130729 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UnretainedCallArgsChecker] Add a checker for NS or CF type call arguments. (PR #130729)

2025-03-11 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/130729 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.NoUnretainedMemberChecker] Add a new WebKit checker for unretained member variables and ivars. (PR #128641)

2025-03-11 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/128641 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [webkit.UncountedLambdaCapturesChecker] Recognize std::move(protectedThis) (PR #130925)

2025-03-12 Thread Ryosuke Niwa via cfe-commits
rniwa wrote: Thanks for the review! https://github.com/llvm/llvm-project/pull/130925 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [webkit.UncountedLambdaCapturesChecker] Recognize std::move(protectedThis) (PR #130925)

2025-03-12 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/130925 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UncountedCallArgsChecker] Treat an explicit construction of Ref from a Ref return value safe. (PR #130911)

2025-03-12 Thread Ryosuke Niwa via cfe-commits
@@ -70,6 +70,8 @@ bool tryToFindPtrOrigin( if (isCtorOfSafePtr(ConversionFunc)) return callback(E, true); } +if (isa(E) && isSafePtrType(cast->getType())) + return callback(E, true); rniwa wrote: Added https://gi

[clang] [alpha.webkit.UncountedCallArgsChecker] Treat an explicit construction of Ref from a Ref return value safe. (PR #130911)

2025-03-12 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/130911 Fix a bug that an explicit construction of Ref out of a Ref return value would not be treated as safe. It is definitely safe albit redundant. >From 6eefb934996532201cc3f137931e3cb140bf25c1 Mon Sep 17 00:00:00 200

[clang] [alpha.webkit.ForwardDeclChecker] Add a new WebKit checker for forward declarations (PR #130554)

2025-03-12 Thread Ryosuke Niwa via cfe-commits
@@ -0,0 +1,335 @@ +//===- ForwardDeclChecker.cpp *- C++ -*-==// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [alpha.webkit.webkit.RetainPtrCtorAdoptChecker] Add a new WebKit checker for correct use of RetainPtr, adoptNS, and adoptCF (PR #128679)

2025-03-12 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/128679 >From b4001f95cf6d35f59ef8af6df8f2bdbe043da380 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Tue, 25 Feb 2025 00:47:45 -0800 Subject: [PATCH 1/8] [alpha.webkit.webkit.RetainPtrCtorAdoptChecker] Add a new WebK

[clang] [alpha.webkit.ForwardDeclChecker] Add a new WebKit checker for forward declarations (PR #130554)

2025-03-12 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/130554 >From d2edd9b5fd188476e59790c333497516933532bb Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Sun, 9 Mar 2025 23:06:33 -0700 Subject: [PATCH 1/3] [alpha.webkit.ForwardDeclChecker] Add a new WebKit checker for

[clang] [alpha.webkit.webkit.RetainPtrCtorAdoptChecker] Add a new WebKit checker for correct use of RetainPtr, adoptNS, and adoptCF (PR #128679)

2025-03-12 Thread Ryosuke Niwa via cfe-commits
@@ -3760,6 +3760,26 @@ Here are some examples of situations that we warn about as they *might* be poten NSObject* unretained = retained.get(); // warn } +webkit.RetainPtrCtorAdoptChecker + +The goal of this rule is to make sure the co

[clang] [alpha.webkit.webkit.RetainPtrCtorAdoptChecker] Add a new WebKit checker for correct use of RetainPtr, adoptNS, and adoptCF (PR #128679)

2025-03-12 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa closed https://github.com/llvm/llvm-project/pull/128679 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [alpha.webkit.UncountedCallArgsChecker] Treat an explicit construction of Ref from a Ref return value safe. (PR #130911)

2025-03-12 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/130911 >From 6eefb934996532201cc3f137931e3cb140bf25c1 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Wed, 12 Mar 2025 00:11:14 -0700 Subject: [PATCH 1/2] [alpha.webkit.UncountedCallArgsChecker] Treat an explicit cons

[clang] [alpha.webkit.ForwardDeclChecker] Add a new WebKit checker for forward declarations (PR #130554)

2025-03-12 Thread Ryosuke Niwa via cfe-commits
rniwa wrote: Thanks for all the reviews! https://github.com/llvm/llvm-project/pull/130554 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

<    2   3   4   5   6   7   8   >