[clang] WebKit Checkers should set DeclWithIssue. (PR #109389)

2024-09-27 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/109389 >From b8f95b5b809cbeb8199de6cd24e18a605189f722 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Thu, 19 Sep 2024 23:41:10 -0700 Subject: [PATCH 1/5] WebKit Checkers should set DeclWithIssue. Set DeclWithIssue in

[clang] WebKit Checkers should set DeclWithIssue. (PR #109389)

2024-09-20 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/109389 >From b8f95b5b809cbeb8199de6cd24e18a605189f722 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Thu, 19 Sep 2024 23:41:10 -0700 Subject: [PATCH 1/2] WebKit Checkers should set DeclWithIssue. Set DeclWithIssue in

[clang] WebKit Checkers should set DeclWithIssue. (PR #109389)

2024-09-20 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/109389 Set DeclWithIssue in alpha.webkit.UncountedCallArgsChecker and alpha.webkit.UncountedLocalVarsChecker. >From b8f95b5b809cbeb8199de6cd24e18a605189f722 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Thu, 19 Sep

[clang] WebKit Checkers should set DeclWithIssue. (PR #109389)

2024-09-20 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/109389 >From b8f95b5b809cbeb8199de6cd24e18a605189f722 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Thu, 19 Sep 2024 23:41:10 -0700 Subject: [PATCH 1/3] WebKit Checkers should set DeclWithIssue. Set DeclWithIssue in

[clang] [alpha.webkit.UncountedCallArgsChecker] Use canonical type (PR #109393)

2024-09-20 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/109393 This PR fixes a bug in UncountedCallArgsChecker that calling a function with a member variable which is Ref/RefPtr is erroneously treated as safe by canoniclizing the type before checking whether it's ref counted

[clang] [alpha.webkit.UncountedLocalVarsChecker] Recursive functions are erroneously treated as non-trivial (PR #110973)

2024-10-03 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/110973 This PR fixes the bug that alpha.webkit.UncountedLocalVarsChecker erroneously treats a trivial recursive function as non-trivial. This was caused by TrivialFunctionAnalysis::isTrivialImpl which takes a statement

[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] [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
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
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 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.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-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] [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] [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] [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.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-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] 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] 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
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
@@ -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
@@ -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
@@ -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] [alpha.webkit.UncountedCallArgsChecker] Add support for Objective-C++ property access (PR #108669)

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

[clang] [alpha.webkit.UncountedCallArgsChecker] Add support for Objective-C++ property access (PR #108669)

2024-09-17 Thread Ryosuke Niwa via cfe-commits
rniwa wrote: > I'm also somewhat terrified of returning C++ objects from ObjC methods by > value, ever since I learned that when you call an ObjC method on a nil it > returns a _zero-initialized_ object without calling a constructor on it. Yikes. I didn't know that! https://github.com/llvm/ll

[clang] [webkit.RefCntblBaseVirtualDtor] ThreadSafeRefCounted still generates warnings (PR #108656)

2024-09-17 Thread Ryosuke Niwa via cfe-commits
@@ -84,13 +84,22 @@ class DerefFuncDeleteExprVisitor E = E->IgnoreParenCasts(); if (auto *TempE = dyn_cast(E)) E = TempE->getSubExpr(); +E = E->IgnoreParenCasts(); +if (auto *Ref = dyn_cast(E)) { + if (auto *Decl = Ref->getDecl()) { +if (auto

[clang] [webkit.RefCntblBaseVirtualDtor] ThreadSafeRefCounted still generates warnings (PR #108656)

2024-09-17 Thread Ryosuke Niwa via cfe-commits
@@ -84,13 +84,22 @@ class DerefFuncDeleteExprVisitor E = E->IgnoreParenCasts(); if (auto *TempE = dyn_cast(E)) E = TempE->getSubExpr(); +E = E->IgnoreParenCasts(); +if (auto *Ref = dyn_cast(E)) { + if (auto *Decl = Ref->getDecl()) { +if (auto

[clang] [webkit.RefCntblBaseVirtualDtor] ThreadSafeRefCounted still generates warnings (PR #108656)

2024-09-17 Thread Ryosuke Niwa via cfe-commits
@@ -119,6 +119,11 @@ template ensureOnMainThread([this] { delete static_cast(this); }); +} else if constexpr (destructionThread == DestructionThread::MainRunLoop) { +auto deleteThis = [this] { rniwa w

[clang] [webkit.RefCntblBaseVirtualDtor] ThreadSafeRefCounted still generates warnings (PR #108656)

2024-09-17 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/108656 >From e86f101c5cd87db597c5fc8ab017b20adba98284 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Fri, 13 Sep 2024 15:19:45 -0700 Subject: [PATCH 1/2] [webkit.RefCntblBaseVirtualDtor] ThreadSafeRefCounted still ge

[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 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.UncountedLambdaCapturesChecker] Fix a bug that the checker didn't take the object pointer into account. (PR #125662)

2025-02-04 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/125662 >From f44963f8bd1012ba877d363c9683bb2b03e8eb86 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Tue, 4 Feb 2025 02:02:19 -0800 Subject: [PATCH 1/2] [webkit.UncountedLambdaCapturesChecker] Fix a bug that the chec

[clang] [webkit.UncountedLambdaCapturesChecker] Fix a bug that the checker didn't take the object pointer into account. (PR #125662)

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

[clang] [webkit.UncountedLambdaCapturesChecker] Fix a bug that the checker didn't take the object pointer into account. (PR #125662)

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

[clang] [webkit.UncountedLambdaCapturesChecker] Fix a bug that the checker didn't take the object pointer into account. (PR #125662)

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

[clang] [webkit.UncountedLambdaCapturesChecker] Fix a bug that the checker didn't take the object pointer into acccount. (PR #125662)

2025-02-04 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/125662 When a callee is a method call (e.g. calling a lambda), we need to skip the object pointer to match the parameter list with the call arguments. This manifests as a bug that the checker erroneously generate a warn

[clang] [webkit.UncountedLambdaCapturesChecker] Fix a regression that [[noescape]] on a member function no longer works. (PR #126016)

2025-02-05 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/126016 We should skip the first argument for CXXOperatorCallExpr, not other kinds of calls. >From b4c9048f3f28bd0522338ef7e4498926b66db571 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Wed, 5 Feb 2025 22:48:30 -080

[clang] [webkit.UncountedLambdaCapturesChecker] Recognize nested protectedThis pattern (PR #126443)

2025-02-09 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/126443 In WebKit, it's pretty common to capture "this" and "protectedThis" where "protectedThis" is a guardian variable of type Ref or RefPtr for "this". Furthermore, it's common for this "protectedThis" variable from b

[clang] [webkit.UncountedLambdaCapturesChecker] Recognize nested protectedThis pattern (PR #126443)

2025-02-09 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/126443 >From a40e782b866ec4756ddf3f04cc09caff31845ebf Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Sun, 9 Feb 2025 13:50:26 -0800 Subject: [PATCH 1/2] [webkit.UncountedLambdaCapturesChecker] Recognize nested protec

[clang] [WebKit checkers] Treat an implicit value initialization as trivial (PR #126203)

2025-02-07 Thread Ryosuke Niwa via cfe-commits
@@ -368,6 +368,11 @@ class RefCounted { } RefPtr trivial66() { return children[0]; } Ref trivial67() { return *children[0]; } + struct point { +double x; +double y; + }; + void trivial68() { point pt = { 1.0 }; } rniwa wrote: It implicitly ini

[clang] [WebKit Checkers] Treat const Objective-C ivar as a safe origin (PR #126353)

2025-02-07 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/126353 Like const C++ member variables, treat const Ref, RefPtr, CheckedRef, CheckedPtr Objective-C ivars as a safe pointer origin in WebKit checkers. >From b3d79dd62e88afa0e83101165ea878f12176e0f2 Mon Sep 17 00:00:00 2

[clang] [WebKit Checkers] Treat const Objective-C ivar as a safe origin (PR #126353)

2025-02-07 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/126353 >From b3d79dd62e88afa0e83101165ea878f12176e0f2 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Fri, 7 Feb 2025 23:21:06 -0800 Subject: [PATCH 1/2] [WebKit Checkers] Treat const Objective-C ivar as a safe origin

[clang] [WebKit Checkers] Allow operator T&() in a const member function (PR #126470)

2025-02-09 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/126470 Allow operator T&() in a member function which returns a const member variable. In particular, this will allow UniqueRef::operator T&() and Ref::operator T&() to be treated as a safe pointer origin when they're c

[clang] [WebKit checkers] Treat an implicit value initialization as trivial (PR #126203)

2025-02-07 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa created https://github.com/llvm/llvm-project/pull/126203 Implicit value initialization is trivial for our purposes. >From 717eca92439705bd9f152631a0602fdb7df9413a Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Fri, 7 Feb 2025 00:29:41 -0800 Subject: [PATCH] [WebKit

[clang] [webkit.UncountedLambdaCapturesChecker] Fix a regression that [[noescape]] on a member function no longer works. (PR #126016)

2025-02-06 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa updated https://github.com/llvm/llvm-project/pull/126016 >From b4c9048f3f28bd0522338ef7e4498926b66db571 Mon Sep 17 00:00:00 2001 From: Ryosuke Niwa Date: Wed, 5 Feb 2025 22:48:30 -0800 Subject: [PATCH 1/2] [webkit.UncountedLambdaCapturesChecker] Fix a regression that [

[clang] [webkit.UncountedLambdaCapturesChecker] Fix a regression that [[noescape]] on a member function no longer works. (PR #126016)

2025-02-06 Thread Ryosuke Niwa via cfe-commits
@@ -63,6 +63,18 @@ template Function adopt(Detail::Callab return Function(impl, Function::Adopt); } +template +class HashMap { +public: + HashMap(); + HashMap([[clang::noescape]] const Function&); rniwa wrote: A good point! Added a test case for stati

[clang] [webkit.UncountedLambdaCapturesChecker] Fix a regression that [[noescape]] on a member function no longer works. (PR #126016)

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

[clang] [NFC] [clang] fix unused variable warning (PR #126796)

2025-02-11 Thread Ryosuke Niwa via cfe-commits
https://github.com/rniwa commented: Oh oops, thank you for the fix. It's odd that the checks didn't catch this before the merge... https://github.com/llvm/llvm-project/pull/126796 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.l

[clang] [WebKit Checkers] Treat const Objective-C ivar as a safe origin (PR #126353)

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

[clang] [WebKit Checkers] Treat const Objective-C ivar as a safe origin (PR #126353)

2025-02-11 Thread Ryosuke Niwa via cfe-commits
rniwa wrote: Thank you for the review! https://github.com/llvm/llvm-project/pull/126353 ___ 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] 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-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] [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] [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] [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] 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] [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] [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] 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] [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] [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.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 #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 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 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 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/3] [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
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] 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] [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] [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-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 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 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 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.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.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] 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 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] 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] 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 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] 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] [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.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] 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] [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

<    1   2   3   4   5   6   7   8   >