[clang] [Static analysis] Encodes a filename before inserting it into a URL. (PR #120810)

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

[clang] [Static analysis] Encodes a filename before inserting it into a URL. (PR #120810)

2024-12-20 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/120810 This fixes a bug where report links generated from files such as StylePrimitiveNumericTypes+Conversions.h in WebKit result in an error. >From 7da85184e77da5a6d44a8f14ebd3d38d7af493bb Mon Sep 17 00:00:00 2001 From

[clang] [webkit.UncountedLambdaCapturesChecker] Fix a nullptr deference. (PR #120702)

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

[clang] [webkit.UncountedLambdaCapturesChecker] Fix a nullptr deference. (PR #120702)

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

[clang] [webkit.UncountedLambdaCapturesChecker] Fix a nullptr deference. (PR #120702)

2024-12-20 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/120702 Added a nullptr check. >From 527fd23a6bd58cada036fe4a47c13ca93eabf507 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Fri, 20 Dec 2024 01:32:40 -0800 Subject: [PATCH] [webkit.UncountedLambdaCapturesChecker] Fix

[clang] [webkit.UncountedLambdaCapturesChecker] Detect protectedThis pattern. (PR #120528)

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

[clang] [webkit.UncountedLambdaCapturesChecker] Detect protectedThis pattern. (PR #120528)

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

[clang] [WebKit checkers] Recognize adoptRef as a safe function (PR #120629)

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

[clang] [webkit.UncountedLambdaCapturesChecker] Detect protectedThis pattern. (PR #120528)

2024-12-19 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/120528 >From 97a721c8358d48333e0f8ab4177906135a2e2364 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Fri, 13 Dec 2024 14:34:39 -0800 Subject: [PATCH 1/4] [webkit.UncountedLambdaCapturesChecker] Detect protectedThis p

[clang] [webkit.UncountedLambdaCapturesChecker] Detect protectedThis pattern. (PR #120528)

2024-12-19 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/120528 >From 97a721c8358d48333e0f8ab4177906135a2e2364 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Fri, 13 Dec 2024 14:34:39 -0800 Subject: [PATCH 1/3] [webkit.UncountedLambdaCapturesChecker] Detect protectedThis p

[clang] [webkit.UncountedLambdaCapturesChecker] Detect protectedThis pattern. (PR #120528)

2024-12-19 Thread Ryosuke Niwa via cfe-commits
@@ -207,6 +207,58 @@ struct RefCountableWithLambdaCapturingThis { }; call(lambda); } + + void method_captures_this_unsafe_capture_local_var_explicitly() { +RefCountable* x = make_obj(); +call([this, protectedThis = RefPtr { this }, x]() { + // expected-w

[clang] [WebKit checkers] Recognize adoptRef as a safe function (PR #120629)

2024-12-19 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/120629 adoptRef in WebKit constructs Ref/RefPtr so treat it as such in isCtorOfRefCounted. Also removed the support for makeRef and makeRefPtr as they don't exist any more. >From 6b4a6b832f61efc26396f60309744c2e726415

[clang] Revert "[WebKit checkers] Recognize adoptRef as a safe function" (PR #120626)

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

[clang] Revert "[WebKit checkers] Recognize adoptRef as a safe function" (PR #120626)

2024-12-19 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/120626 Reverts llvm/llvm-project#119846. Introduced a failing test. >From 274a82ba5fa84333f29d9612deadf53021ee8d8a Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Thu, 19 Dec 2024 11:25:52 -0800 Subject: [PATCH] Rever

[clang] [WebKit checkers] Recognize adoptRef as a safe function (PR #119846)

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

[clang] [WebKit checkers] Recognize adoptRef as a safe function (PR #119846)

2024-12-19 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/119846 >From 6b4a6b832f61efc26396f60309744c2e7264156d Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Fri, 13 Dec 2024 01:49:21 -0800 Subject: [PATCH 1/4] [WebKit checkers] Recognize adoptRef as a safe function adoptR

[clang] [webkit.UncountedLambdaCapturesChecker] Detect protectedThis pattern. (PR #120528)

2024-12-18 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/120528 >From 97a721c8358d48333e0f8ab4177906135a2e2364 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Fri, 13 Dec 2024 14:34:39 -0800 Subject: [PATCH 1/2] [webkit.UncountedLambdaCapturesChecker] Detect protectedThis p

[clang] [webkit.UncountedLambdaCapturesChecker] Detect protectedThis pattern. (PR #120528)

2024-12-18 Thread Ryosuke Niwa via cfe-commits
@@ -180,11 +212,51 @@ class UncountedLambdaCapturesChecker } else if (C.capturesThis() && shouldCheckThis) { if (ignoreParamVarDecl) // this is always a parameter to this function. continue; -reportBugOnThisPtr(C); +bool hasProtectThis =

[clang] [webkit.UncountedLambdaCapturesChecker] Detect protectedThis pattern. (PR #120528)

2024-12-18 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/120528 In WebKit, we often capture this as Ref or RefPtr in addition to this itself so that the object lives as long as a capturing lambda stays alive. Detect this pattern and treat it as safe. This PR also makes the ch

[clang] [webkit.UncountedLambdaCapturesChecker] Detect protectedThis pattern. (PR #119932)

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

[clang] [WebKit checkers] Recognize adoptRef as a safe function (PR #119846)

2024-12-18 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/119846 >From 6b4a6b832f61efc26396f60309744c2e7264156d Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Fri, 13 Dec 2024 01:49:21 -0800 Subject: [PATCH 1/3] [WebKit checkers] Recognize adoptRef as a safe function adoptR

[clang] [WebKit checkers] Recognize adoptRef as a safe function (PR #119846)

2024-12-18 Thread Ryosuke Niwa via cfe-commits
@@ -365,3 +365,20 @@ namespace call_with_explicit_temporary_obj { RefPtr { provide() }->method(); } } + +namespace call_with_adopt_ref { + class Obj { + public: +void ref() const; +void deref() const; +void method(); + }; + + struct dummy { +RefPtr any

[clang] Revert "[Static analysis] Encodes a filename before inserting it into a URL." (PR #120195)

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

[clang] Revert "[Static analysis] Encodes a filename before inserting it into a URL." (PR #120195)

2024-12-16 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/120195 Reverts llvm/llvm-project#120123 Broke some tests. >From b2b261c406108390117e1b6c3fdbe5e9d53a7111 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Mon, 16 Dec 2024 23:35:54 -0800 Subject: [PATCH] =?UTF-8?q?Rever

[clang] [Static analysis] Encodes a filename before inserting it into a URL. (PR #120123)

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

[clang] [Static analysis] Encodes a filename before inserting it into a URL. (PR #120123)

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

[clang] [Static analysis] Encodes a filename before inserting it into a URL. (PR #120123)

2024-12-16 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/120123 This fixes a bug where report links generated from files such as StylePrimitiveNumericTypes+Conversions.h in WebKit result in an error. >From ac1fd2653d009760b5cb46a2bf6c5d1c3f52fc41 Mon Sep 17 00:00:00 2001 From

[clang] [NFC][webkit.UncountedLambdaCapturesChecker] Remove unnecessary check (PR #120069)

2024-12-16 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa approved this pull request. https://github.com/llvm/llvm-project/pull/120069 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [webkit.UncountedLambdaCapturesChecker] Add a fallback for checking lambda captures (PR #119800)

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

[clang] [webkit.UncountedLambdaCapturesChecker] Add a fallback for checking lambda captures (PR #119800)

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

[clang] [webkit.UncountedLambdaCapturesChecker] Detect protectedThis pattern. (PR #119932)

2024-12-13 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/119932 >From 5c032267f263fb6b7f10d25745d14e63b2f7af59 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Fri, 13 Dec 2024 14:34:39 -0800 Subject: [PATCH 1/3] [webkit.UncountedLambdaCapturesChecker] Detect protectedThis p

[clang] [webkit.UncountedLambdaCapturesChecker] Detect protectedThis pattern. (PR #119932)

2024-12-13 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/119932 >From 5c032267f263fb6b7f10d25745d14e63b2f7af59 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Fri, 13 Dec 2024 14:34:39 -0800 Subject: [PATCH 1/2] [webkit.UncountedLambdaCapturesChecker] Detect protectedThis p

[clang] [webkit.UncountedLambdaCapturesChecker] Detect protectedThis pattern. (PR #119932)

2024-12-13 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/119932 In WebKit, we often capture this as Ref or RefPtr in addition to this itself so that the object lives as long as a capturing lambda stays alive. Detect this pattern and treat it as safe. This PR also makes the ch

[clang] [webkit.UncountedLambdaCapturesChecker] Add a fallback for checking lambda captures (PR #119800)

2024-12-13 Thread Ryosuke Niwa via cfe-commits
@@ -61,6 +62,24 @@ class UncountedLambdaCapturesChecker return result && *result; } + bool VisitLambdaExpr(LambdaExpr *L) override { +if (LambdasToIgnore.contains(L)) + return true; +Checker->visitLambdaExpr(L, shouldCheckThis()); +

[clang] [WebKit checkers] Recognize adoptRef as a safe function (PR #119846)

2024-12-13 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/119846 >From 6b4a6b832f61efc26396f60309744c2e7264156d Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Fri, 13 Dec 2024 01:49:21 -0800 Subject: [PATCH 1/2] [WebKit checkers] Recognize adoptRef as a safe function adoptR

[clang] [WebKit checkers] Recognize adoptRef as a safe function (PR #119846)

2024-12-13 Thread Ryosuke Niwa via cfe-commits
@@ -365,3 +365,20 @@ namespace call_with_explicit_temporary_obj { RefPtr { provide() }->method(); } } + +namespace call_with_adopt_ref { + class Obj { + public: +void ref() const; +void deref() const; +void method(); + }; + + struct dummy { +RefPtr any

[clang] [WebKit checkers] Recognize adoptRef as a safe function (PR #119846)

2024-12-13 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/119846 adoptRef in WebKit constructs Ref/RefPtr so treat it as such in isCtorOfRefCounted. Also removed the support for makeRef and makeRefPtr as they don't exist any more. >From 6b4a6b832f61efc26396f60309744c2e7264156

[clang] [WebKit checkers] Recognize ensureFoo functions (PR #119681)

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

[clang] [webkit.UncountedLambdaCapturesChecker] Add a fallback for checking lambda captures (PR #119800)

2024-12-12 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/119800 This PR reintroduces VisitLambdaExpr in LocalVisitor so that lambdas used to constrcut WTF::Function, for example, would get checked for its lambda captures. We explicitly ignore lambda used in initializing a Var

[clang] [WebKit checkers] Recognize ensureFoo functions (PR #119681)

2024-12-12 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/119681 >From 0982f5ca3f9d1ea713b1e34b6e6b9d08ff65e6f1 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Thu, 12 Dec 2024 01:31:42 -0800 Subject: [PATCH 1/3] [WebKit checkers] Recognize ensureFoo functions In WebKit, we

[clang] [WebKit checkers] Recognize ensureFoo functions (PR #119681)

2024-12-12 Thread Ryosuke Niwa via cfe-commits
@@ -169,4 +173,42 @@ bool isConstOwnerPtrMemberExpr(const clang::Expr *E) { return isOwnerPtrType(T) && T.isConstQualified(); } +class EnsureFunctionVisitor +: public ConstStmtVisitor { +public: + bool VisitStmt(const Stmt *S) { +for (const Stmt *Child : S->children

[clang] [WebKit checkers] Recognize ensureFoo functions (PR #119681)

2024-12-12 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/119681 >From 0982f5ca3f9d1ea713b1e34b6e6b9d08ff65e6f1 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Thu, 12 Dec 2024 01:31:42 -0800 Subject: [PATCH 1/2] [WebKit checkers] Recognize ensureFoo functions In WebKit, we

[clang] Fix a bug that CXXConstructExpr wasn't recognized by tryToFindPtrOrigin (PR #119336)

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

[clang] Fix a bug that CXXConstructExpr wasn't recognized by tryToFindPtrOrigin (PR #119336)

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

[clang] [WebKit checkers] Recognize ensureFoo functions (PR #119681)

2024-12-12 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/119681 In WebKit, we often write Foo::ensureBar function which lazily initializes m_bar and returns a raw pointer or a raw reference to m_bar. Such a return value is safe to use for the duration of a member function cal

[clang] Fix a bug that CXXConstructExpr wasn't recognized by tryToFindPtrOrigin (PR #119336)

2024-12-11 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/119336 >From a3c97276a15af0324b4436d85fa06e22650dfb57 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Mon, 9 Dec 2024 23:03:46 -0800 Subject: [PATCH 1/2] Fix a bug that CXXConstructExpr wasn't recognized by tryToFindP

[clang] UncountedLocalVarsChecker and UncheckedLocalVarsChecker should recognize signletons. (PR #119339)

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

[clang] Fix a bug that CXXConstructExpr wasn't recognized by tryToFindPtrOrigin (PR #119336)

2024-12-09 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/119336 Prior to this PR, only CXXTemporaryObjectExpr, not CXXConstructExpr was recognized in tryToFindPtrOrigin. >From a3c97276a15af0324b4436d85fa06e22650dfb57 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Mon, 9 D

[clang] [webkit.UncountedLambdaCapturesChecker] Ignore lambda invocation with arguments (PR #117394)

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

[clang] [webkit.UncountedLambdaCapturesChecker] Ignore lambda invocation with arguments (PR #117394)

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

[clang] [webkit.UncountedLambdaCapturesChecker] Ignore lambda invocation with arguments (PR #117394)

2024-11-22 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/117394 Fixed a bug that UncountedLambdaCapturesChecker would emit a warning on a lambda capture when the lambda is invoked with arguments. LocalVisitor::VisitCallExpr was not tolerating a lambda invocation with more th

[clang] [Webkit Checkers] Introduce a Webkit checker for memory unsafe casts (PR #114606)

2024-11-21 Thread Ryosuke Niwa via cfe-commits
@@ -0,0 +1,185 @@ +//===- MemoryUnsafeCastChecker.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: Apach

[clang] [Webkit Checkers] Introduce a Webkit checker for memory unsafe casts (PR #114606)

2024-11-21 Thread Ryosuke Niwa via cfe-commits
@@ -0,0 +1,185 @@ +//===- MemoryUnsafeCastChecker.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: Apach

[clang] [webkit.UncountedLambdaCapturesChecker] Fix debug assertion failure. (PR #117090)

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

[clang] [webkit.UncountedLambdaCapturesChecker] Fix debug assertion failure. (PR #117090)

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

[clang] [webkit.UncountedLambdaCapturesChecker] Fix debug assertion failure. (PR #117090)

2024-11-20 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/117090 Only call getThisType() on an instance method. >From 31481cda425206408eb3aeef844503b110dfaa4d Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Wed, 20 Nov 2024 17:23:18 -0800 Subject: [PATCH] [webkit.UncountedLa

[clang] [Webkit Checkers] Introduce a Webkit checker for memory unsafe casts (PR #114606)

2024-11-20 Thread Ryosuke Niwa via cfe-commits
@@ -0,0 +1,176 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.MemoryUnsafeCastChecker -verify %s + +class Base { }; rniwa wrote: Can we add tests for static_cast non-pointer types and make sure they don't emit warnings? https://github.com/llvm/l

[clang] [Webkit Checkers] Introduce a Webkit checker for memory unsafe casts (PR #114606)

2024-11-19 Thread Ryosuke Niwa via cfe-commits
@@ -0,0 +1,132 @@ +//===- MemoryUnsafeCastChecker.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: Apach

[clang] [Webkit Checkers] Treat const member variables as a safe origin (PR #115594)

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

[clang] [Webkit Checkers] Treat const member variables as a safe origin (PR #115594)

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

[clang] [Webkit Checkers] Treat const member variables as a safe origin (PR #115594)

2024-11-14 Thread Ryosuke Niwa via cfe-commits
@@ -0,0 +1,66 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UncountedCallArgsChecker -verify %s + +#include "mock-types.h" + +namespace std { +} + +namespace call_args_const_refptr_member { + +class Foo { +public: + Foo(); + void bar(); + +private: + const RefP

[clang] [Webkit Checkers] Treat const member variables as a safe origin (PR #115594)

2024-11-14 Thread Ryosuke Niwa via cfe-commits
@@ -145,25 +145,36 @@ bool isCtorOfSafePtr(const clang::FunctionDecl *F) { return isCtorOfRefCounted(F) || isCtorOfCheckedPtr(F); } -bool isSafePtrType(const clang::QualType T) { +template +static bool isPtrOfType(const clang::QualType T, Predicate Pred) { QualType type

[clang] [Webkit Checkers] Treat const member variables as a safe origin (PR #115594)

2024-11-14 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/115594 >From 28ee8321eb6e405fd1ebae9043c3ffafe20a4b35 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Sat, 9 Nov 2024 00:14:36 -0800 Subject: [PATCH 1/5] [Webkit Checkers] Treat const member variables as a safe origin

[clang] [Webkit Checkers] Treat const member variables as a safe origin (PR #115594)

2024-11-14 Thread Ryosuke Niwa via cfe-commits
@@ -145,25 +145,36 @@ bool isCtorOfSafePtr(const clang::FunctionDecl *F) { return isCtorOfRefCounted(F) || isCtorOfCheckedPtr(F); } -bool isSafePtrType(const clang::QualType T) { +template +static bool isPtrOfType(const clang::QualType T, Predicate Pred) { QualType type

[clang] [Webkit Checkers] Treat const member variables as a safe origin (PR #115594)

2024-11-14 Thread Ryosuke Niwa via cfe-commits
@@ -145,25 +145,36 @@ bool isCtorOfSafePtr(const clang::FunctionDecl *F) { return isCtorOfRefCounted(F) || isCtorOfCheckedPtr(F); } -bool isSafePtrType(const clang::QualType T) { +template +static bool isPtrOfType(const clang::QualType T, Predicate Pred) { QualType type

[clang] [Webkit Checkers] Treat const member variables as a safe origin (PR #115594)

2024-11-14 Thread Ryosuke Niwa via cfe-commits
@@ -0,0 +1,66 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UncountedCallArgsChecker -verify %s + +#include "mock-types.h" + +namespace std { +} + +namespace call_args_const_refptr_member { + +class Foo { +public: + Foo(); + void bar(); + +private: + const RefP

[clang] [WebKit checkers] Treat ref() and incrementCheckedPtrCount() as trivial (PR #115695)

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

[clang] [WebKit checkers] Treat ref() and incrementCheckedPtrCount() as trivial (PR #115695)

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

[clang] [Webkit Checkers] Treat const member variables as a safe origin (PR #115594)

2024-11-13 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/115594 >From 28ee8321eb6e405fd1ebae9043c3ffafe20a4b35 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Sat, 9 Nov 2024 00:14:36 -0800 Subject: [PATCH 1/4] [Webkit Checkers] Treat const member variables as a safe origin

[clang] [Webkit Checkers] Treat const member variables as a safe origin (PR #115594)

2024-11-12 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/115594 >From 28ee8321eb6e405fd1ebae9043c3ffafe20a4b35 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Sat, 9 Nov 2024 00:14:36 -0800 Subject: [PATCH 1/3] [Webkit Checkers] Treat const member variables as a safe origin

[clang] [Webkit Checkers] Treat const member variables as a safe origin (PR #115594)

2024-11-12 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/115594 >From 28ee8321eb6e405fd1ebae9043c3ffafe20a4b35 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Sat, 9 Nov 2024 00:14:36 -0800 Subject: [PATCH 1/2] [Webkit Checkers] Treat const member variables as a safe origin

[clang] [webkit.UncountedLambdaCapturesChecker] Ignore trivial functions and [[clang::noescape]]. (PR #114897)

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

[clang] [webkit.UncountedLambdaCapturesChecker] Ignore trivial functions and [[clang::noescape]]. (PR #114897)

2024-11-11 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/114897 >From d08c1b364c392aa42b7ef71528a52ab6a7d9c548 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Mon, 4 Nov 2024 16:01:49 -0800 Subject: [PATCH 1/3] [webkit.UncountedLambdaCapturesChecker] Ignore trivial function

[clang] [webkit.UncountedLambdaCapturesChecker] Ignore trivial functions and [[clang::noescape]]. (PR #114897)

2024-11-11 Thread Ryosuke Niwa via cfe-commits
@@ -89,7 +182,25 @@ class UncountedLambdaCapturesChecker } printQuotedQualifiedName(Os, Capture.getCapturedVar()); -Os << " to uncounted type is unsafe."; +Os << " to ref-counted / CheckedPtr capable type is unsafe."; + +PathDiagnosticLocation BSLoc(Capture

[clang] [webkit.UncountedLambdaCapturesChecker] Ignore trivial functions and [[clang::noescape]]. (PR #114897)

2024-11-11 Thread Ryosuke Niwa via cfe-commits
@@ -45,32 +52,118 @@ class UncountedLambdaCapturesChecker bool shouldVisitTemplateInstantiations() const { return true; } bool shouldVisitImplicitCode() const { return false; } - bool VisitLambdaExpr(LambdaExpr *L) { -Checker->visitLambdaExpr(L); +

[clang] [WebKit checkers] Treat ref() and incrementCheckedPtrCount() as trivial (PR #115695)

2024-11-11 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/115695 Treat member function calls to ref() and incrementCheckedPtrCount() as trivial so that a function which returns RefPtr/Ref out of a raw reference / pointer is also considered trivial. >From 7b4aaedcf86d583c1cf86

[clang] [webkit.UncountedLambdaCapturesChecker] Ignore trivial functions and [[clang::noescape]]. (PR #114897)

2024-11-10 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/114897 >From d08c1b364c392aa42b7ef71528a52ab6a7d9c548 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Mon, 4 Nov 2024 16:01:49 -0800 Subject: [PATCH 1/2] [webkit.UncountedLambdaCapturesChecker] Ignore trivial function

[clang] [Webkit Checkers] Treat const member variables as a safe origin (PR #115594)

2024-11-09 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/115594 Treat const Ref, RefPtr, CheckedRef, CheckedPtr member variables as safe pointer origin in WebKit's local variable and call arguments checkers. >From 28ee8321eb6e405fd1ebae9043c3ffafe20a4b35 Mon Sep 17 00:00:00 2

[clang] [Webkit Checkers] Introduce a Webkit checker for memory unsafe casts (PR #114606)

2024-11-07 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa approved this pull request. https://github.com/llvm/llvm-project/pull/114606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Webkit Checkers] Introduce a Webkit checker for memory unsafe casts (PR #114606)

2024-11-07 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa edited https://github.com/llvm/llvm-project/pull/114606 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Webkit Checkers] Introduce a Webkit checker for memory unsafe casts (PR #114606)

2024-11-07 Thread Ryosuke Niwa via cfe-commits
@@ -0,0 +1,117 @@ +//===- MemoryUnsafeCastChecker.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: Apach

[clang] [Webkit Checkers] Introduce a Webkit checker for memory unsafe casts (PR #114606)

2024-11-07 Thread Ryosuke Niwa via cfe-commits
rniwa wrote: Hm... I'm still hitting a crash. In debug builds, we hit this assertion: ``` Assertion failed: (DD && "queried property of class with no definition"), function data, file DeclCXX.h, line 452. PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the

[clang] [Webkit Checkers] Introduce a Webkit checker for memory unsafe casts (PR #114606)

2024-11-07 Thread Ryosuke Niwa via cfe-commits
rniwa wrote: I'm hitting this crash in the checker when I try to compile WebKit with this patch applied: ``` Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it): 0 clang-17 0x00010fb

[clang] [llvm] Introduce a new WebKit checker for a unchecked call arguments (#113708) (PR #114522)

2024-11-07 Thread Ryosuke Niwa via cfe-commits
@@ -1,4 +1,4 @@ -//===- UncountedCallArgsChecker.cpp --*- C++ -*-==// +//===- RawPtrRefCallArgsChecker.cpp --*- C++ -*-==// rniwa wrote: I don't think so. I could imagine `UncountedCallArgsChecker` and `U

[clang] [Webkit Checkers] Introduce a Webkit checker for memory unsafe casts (PR #114606)

2024-11-07 Thread Ryosuke Niwa via cfe-commits
@@ -0,0 +1,117 @@ +//===- MemoryUnsafeCastChecker.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: Apach

[clang] [llvm] Introduce a new WebKit checker for a unchecked call arguments (#113708) (PR #114522)

2024-11-07 Thread Ryosuke Niwa via cfe-commits
@@ -55,10 +55,18 @@ bool isCheckedPtr(const clang::CXXRecordDecl *Class); /// not, std::nullopt if inconclusive. std::optional isUncounted(const clang::QualType T); +/// \returns true if \p Class is CheckedPtr capable AND not checked, false if +/// not, std::nullopt if inconcl

[clang] [Webkit Checkers] Introduce a Webkit checker for memory unsafe casts (PR #114606)

2024-11-07 Thread Ryosuke Niwa via cfe-commits
@@ -0,0 +1,117 @@ +//===- MemoryUnsafeCastChecker.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: Apach

[clang] [llvm] Introduce a new WebKit checker for a unchecked call arguments (#113708) (PR #114522)

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

[clang] [llvm] Introduce a new WebKit checker for a unchecked call arguments (#113708) (PR #114522)

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

[clang] [webkit.UncountedLambdaCapturesChecker] Ignore trivial functions and [[clang::noescape]]. (PR #114897)

2024-11-05 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/114897 >From d08c1b364c392aa42b7ef71528a52ab6a7d9c548 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Mon, 4 Nov 2024 16:01:49 -0800 Subject: [PATCH 1/2] [webkit.UncountedLambdaCapturesChecker] Ignore trivial function

[clang] [Webkit Checkers] Introduce a Webkit checker for memory unsafe casts (PR #114606)

2024-11-05 Thread Ryosuke Niwa via cfe-commits
@@ -0,0 +1,154 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.MemoryUnsafeCastChecker -verify %s + +class Base { }; +class Derived : public Base { }; + +void test_pointers(Base *base) { + Derived *derived_static = static_cast(base); + // expected-warning@-1{{Unsa

[clang] Update clang static analyzers per rename of member functions in CanMakeCheckedPtr. (PR #114636)

2024-11-01 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/114636 >From 5675106782f0226297ea3e53fe7bca9137f710c4 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Fri, 1 Nov 2024 20:39:10 -0700 Subject: [PATCH 1/2] Update clang static analyzers per rename of member functions in

[clang] Update clang static analyzers per rename of member functions in CanMakeCheckedPtr. (PR #114636)

2024-11-01 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/114636 The member functions that define CheckedPtr capable type is incrementCheckedPtrCount and decrementCheckedPtrCount after the rename. >From 5675106782f0226297ea3e53fe7bca9137f710c4 Mon Sep 17 00:00:00 2001 From: Ry

[clang] [Webkit Checkers] Introduce a Webkit checker for memory unsafe casts (PR #114606)

2024-11-01 Thread Ryosuke Niwa via cfe-commits
@@ -0,0 +1,86 @@ +//===- MemoryUnsafeCastChecker.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: Apache

[clang] [Webkit Checkers] Introduce a Webkit checker for memory unsafe casts (PR #114606)

2024-11-01 Thread Ryosuke Niwa via cfe-commits
@@ -0,0 +1,151 @@ +// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.MemoryUnsafeCastChecker -verify %s + +class Base { }; +class Derived : public Base { }; + +void test_pointers(Base *base) { + Derived *derived_static = static_cast(base); + // expected-warning@-1{{Memo

[clang] [webkit.UncountedLambdaCapturesChecker] Ignore trivial functions and [[clang::noescape]]. (PR #114374)

2024-11-01 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/114374 >From 474490de53c029ab59008bed9fc33f61db4cb1d7 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Thu, 31 Oct 2024 01:12:35 -0700 Subject: [PATCH] [webkit.UncountedLambdaCapturesChecker] Ignore trivial functions a

[clang] [llvm] Introduce a new WebKit checker for a unchecked call arguments (#113708) (PR #114522)

2024-11-01 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/114522 >From 6d45647a0c0452f9132531a654492b73405fba78 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Fri, 1 Nov 2024 01:08:35 -0700 Subject: [PATCH] Introduce a new WebKit checker for a unchecked call arguments (#113

[clang] [llvm] Introduce a new WebKit checker for a unchecked call arguments (#113708) (PR #114522)

2024-11-01 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/114522 This PR introduces alpha.webkit.UncheckedCallArgsChecker which detects a function argument which is a raw reference or a raw pointer to a CheckedPtr capable object. >From 0f32df43d91145c43331b9afb705449bae729523

[clang] [llvm] Introduce a new WebKit checker for a unchecked local variable (PR #113708)

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

[clang] [llvm] Introduce a new WebKit checker for a unchecked local variable (PR #113708)

2024-10-31 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/113708 >From cf5ca301bc9ed2c65eed92e7299bf598d5f88103 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Sat, 14 Sep 2024 01:46:23 -0700 Subject: [PATCH 1/2] Introduce a new WebKit checker for a unchecked local variable

  1   2   3   4   5   >