[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 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 Rashmi Mudduluru via cfe-commits
https://github.com/t-rasmud approved this pull request. LGTM! 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 ensureFoo functions (PR #119681)

2024-12-12 Thread Rashmi Mudduluru 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] [WebKit checkers] Recognize ensureFoo functions (PR #119681)

2024-12-12 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff dd8d85dba6e8f74a55fb5053107797e21894a0c6 0982f5ca3f9d1ea713b1e34b6e6b9d08ff65e6f1 --e

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

2024-12-12 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-static-analyzer-1 Author: Ryosuke Niwa (rniwa) Changes 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

[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