[clang-tools-extra] [clang-tidy] unnecessary-value-param: Allow moving of value arguments. (PR #145871)

2025-06-27 Thread Clement Courbet via cfe-commits
legrosbuffle wrote: Note that in the test I wrote I called a ctor for simplicity, but in general I want to avoid warning on anything that looks like this: ``` template void Eat(Args&&...); void NegativeMoved(ExpensiveToCopyType A) { Eat(std::move(A)); } ``` The move ctor just happens to be

[clang-tools-extra] [clang-tidy] unnecessary-value-param: Allow moving of value arguments. (PR #145871)

2025-06-26 Thread Clement Courbet via cfe-commits
legrosbuffle wrote: > Shouldn't this case be already covered by No, this case is different: note that the `std::move` is already present. With ``` void NegativeMoved(ExpensiveToCopyType A) { ExpensiveToCopyType Copy = std::move(A); } ``` If the caller passes an lvalue (case L), there is one

[clang-tools-extra] [clang-tidy] unnecessary-value-param: Allow moving of value arguments. (PR #145871)

2025-06-26 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/145871 >From 8ffb4e7f1c3855917ccc5197bb3ecea7c716ab8a Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Thu, 26 Jun 2025 11:22:28 + Subject: [PATCH 1/3] [clang-tidy] unnecessary-value-param: Allow moving of

[clang-tools-extra] [clang-tidy] unnecessary-value-param: Allow moving of value arguments. (PR #145871)

2025-06-26 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle converted_to_draft https://github.com/llvm/llvm-project/pull/145871 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] unnecessary-value-param: Allow moving of value arguments. (PR #145871)

2025-06-26 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle created https://github.com/llvm/llvm-project/pull/145871 Some functions take an argument by value because it allows efficiently moving them to a function that takes by value. Do not pessimize that case. >From 8ffb4e7f1c3855917ccc5197bb3ecea7c716ab8a Mon Sep 17 0

[clang-tools-extra] [clang-reorder-fields] Support designated initializers (PR #142150)

2025-06-26 Thread Clement Courbet via cfe-commits
@@ -81,18 +83,52 @@ getNewFieldsOrder(const RecordDecl *Definition, return NewFieldsOrder; } +struct ReorderedStruct { legrosbuffle wrote: If you can pull out this refactoring (`ReorderedStruct` + `addRepacement`) to a separate commit that'd be great. htt

[clang-tools-extra] [clang-reorder-fields] Support designated initializers (PR #142150)

2025-06-26 Thread Clement Courbet via cfe-commits
@@ -0,0 +1,256 @@ +//===-- tools/extra/clang-reorder-fields/utils/Designator.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-tools-extra] [clang-reorder-fields] Support designated initializers (PR #142150)

2025-06-26 Thread Clement Courbet via cfe-commits
@@ -289,35 +321,213 @@ static void reorderFieldsInConstructor( Replacements); } +/// Replacement for broken InitListExpr::isExplicit function. +/// TODO: Remove when InitListExpr::isExplicit is fixed. legrosbuffle wrote: s/TODO/FIXME/ If

[clang-tools-extra] [clang-reorder-fields] Support designated initializers (PR #142150)

2025-06-26 Thread Clement Courbet via cfe-commits
@@ -0,0 +1,256 @@ +//===-- tools/extra/clang-reorder-fields/utils/Designator.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-tools-extra] [clang-reorder-fields] Support designated initializers (PR #142150)

2025-06-26 Thread Clement Courbet via cfe-commits
legrosbuffle wrote: I would put this in the parent directory, the `utils/` subdir does not bring that much IMO. https://github.com/llvm/llvm-project/pull/142150 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang-tools-extra] [clang-reorder-fields] Support designated initializers (PR #142150)

2025-06-26 Thread Clement Courbet via cfe-commits
@@ -289,35 +321,213 @@ static void reorderFieldsInConstructor( Replacements); } +/// Replacement for broken InitListExpr::isExplicit function. +/// TODO: Remove when InitListExpr::isExplicit is fixed. +static bool isImplicitILE(const InitListExpr *ILE, con

[clang-tools-extra] [clang-reorder-fields] Support designated initializers (PR #142150)

2025-06-26 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle commented: Nice ! Conceptually this looks good, only stylistic comments. https://github.com/llvm/llvm-project/pull/142150 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/lis

[clang-tools-extra] [clang-reorder-fields] Support designated initializers (PR #142150)

2025-06-26 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle edited https://github.com/llvm/llvm-project/pull/142150 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-reorder-fields] Prevent rewriting unsupported cases (PR #142149)

2025-06-13 Thread Clement Courbet via cfe-commits
legrosbuffle wrote: Not a big deal, but note for next time: we don't do force push to avoid losing context (https://llvm.org/docs/GitHub.html#rebasing-pull-requests-and-force-pushes) https://github.com/llvm/llvm-project/pull/142149 ___ cfe-commits m

[clang-tools-extra] [clang-reorder-fields] Prevent rewriting unsupported cases (PR #142149)

2025-06-13 Thread Clement Courbet via cfe-commits
@@ -0,0 +1,15 @@ +// RUN: clang-reorder-fields -record-name ::bar::Foo -fields-order y,x %s -- | FileCheck %s + +namespace bar { + +#define DEFINE_FIELDS + +// This is okay to reorder. +struct Foo { +#ifdef DEFINE_FIELDS // CHECK: {{^#ifdef DEFINE_FIELDS}} + int y;

[clang-tools-extra] [clang-reorder-fields] Use expanded location for macros (PR #142147)

2025-06-04 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle approved this pull request. https://github.com/llvm/llvm-project/pull/142147 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] ExprSequence: Handle ternary operators. (PR #132913)

2025-04-08 Thread Clement Courbet via cfe-commits
legrosbuffle wrote: ping https://github.com/llvm/llvm-project/pull/132913 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] ExprSequence: Handle ternary operators. (PR #132913)

2025-04-08 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/132913 >From dcb97b74e78148e03f7749f436f01d5488c11ae1 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Tue, 25 Mar 2025 09:42:53 + Subject: [PATCH 1/3] [clang-tidy] ExprSequence: Handle ternary operators.

[clang-tools-extra] [clang-tidy] ExprSequence: Handle ternary operators. (PR #132913)

2025-03-25 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/132913 >From dcb97b74e78148e03f7749f436f01d5488c11ae1 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Tue, 25 Mar 2025 09:42:53 + Subject: [PATCH] [clang-tidy] ExprSequence: Handle ternary operators. The

[clang-tools-extra] [clang-tidy] ExprSequence: Handle ternary operators. (PR #132913)

2025-03-25 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle created https://github.com/llvm/llvm-project/pull/132913 The first operand in the conditional operator `?:` is sequenced before the second or third operand. This was probably not implemented because it did not fit in the "single successor" model of `getSuccesso

[clang] [clang-tools-extra] [clang-reorder-fields] Reorder leading comments (PR #123740)

2025-01-22 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle closed https://github.com/llvm/llvm-project/pull/123740 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clang-reorder-fields] Reorder leading comments (PR #123740)

2025-01-21 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle created https://github.com/llvm/llvm-project/pull/123740 Similarly to https://github.com/llvm/llvm-project/pull/122918, leading comments are currently not being moved. ``` struct Foo { // This one is the cool field. int a; int b; }; ``` becomes: ``` struc

[clang] [clang-tools-extra] [clang][refactor] Refactor `findNextTokenIncludingComments` (PR #123060)

2025-01-17 Thread Clement Courbet via cfe-commits
@@ -118,47 +118,19 @@ findMembersUsedInInitExpr(const CXXCtorInitializer *Initializer, return Results; } -/// Returns the next token after `Loc` (including comment tokens). -static std::optional getTokenAfter(SourceLocation Loc, legrosbuffle wrote: Yes, th

[clang] [clang-tools-extra] [clang][refactor] Refactor `findNextTokenIncludingComments` (PR #123060)

2025-01-17 Thread Clement Courbet via cfe-commits
legrosbuffle wrote: > `Lexer::findNextToken` has an additional check: > > `if (!Lexer::isAtEndOfMacroExpansion(Loc, SM, LangOpts, &Loc))` > > Does this not change behavior in the case we are replacing? I imagine folks > just copied from `Lexer::findNextToken` and purposely left this out, is th

[clang] [clang-tools-extra] [clang][refactor] Refactor `findNextTokenIncludingComments` (PR #123060)

2025-01-16 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle closed https://github.com/llvm/llvm-project/pull/123060 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-tools-extra] [clang][refactor] Refactor `findNextTokenIncludingComments` (PR #123060)

2025-01-16 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/123060 >From 005a730b72be1305c67f886d9a473273d7318d99 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Wed, 15 Jan 2025 12:19:58 + Subject: [PATCH 1/5] [clang][refactor] Refactor `findNextTokenIncludingCo

[clang] [clang-tools-extra] [clang][refactor] Refactor `findNextTokenIncludingComments` (PR #123060)

2025-01-16 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/123060 >From 005a730b72be1305c67f886d9a473273d7318d99 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Wed, 15 Jan 2025 12:19:58 + Subject: [PATCH 1/4] [clang][refactor] Refactor `findNextTokenIncludingCo

[clang] [clang-tools-extra] [clang][refactor] Refactor `findNextTokenIncludingComments` (PR #123060)

2025-01-16 Thread Clement Courbet via cfe-commits
@@ -118,47 +118,19 @@ findMembersUsedInInitExpr(const CXXCtorInitializer *Initializer, return Results; } -/// Returns the next token after `Loc` (including comment tokens). -static std::optional getTokenAfter(SourceLocation Loc, - co

[clang] [clang-tools-extra] [clang][refactor] Refactor `findNextTokenIncludingComments` (PR #123060)

2025-01-15 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/123060 >From 005a730b72be1305c67f886d9a473273d7318d99 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Wed, 15 Jan 2025 12:19:58 + Subject: [PATCH 1/3] [clang][refactor] Refactor `findNextTokenIncludingCo

[clang] [clang-tools-extra] [clang][refactor] Refactor `findNextTokenIncludingComments` (PR #123060)

2025-01-15 Thread Clement Courbet via cfe-commits
legrosbuffle wrote: Thanks, and sorry I had to force-push because github would not refresh the PR (https://github.com/orgs/community/discussions/78775) https://github.com/llvm/llvm-project/pull/123060 ___ cfe-commits mailing list cfe-commits@lists.llv

[clang] [clang-tools-extra] [clang][refactor] Refactor `findNextTokenIncludingComments` (PR #123060)

2025-01-15 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/123060 >From 005a730b72be1305c67f886d9a473273d7318d99 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Wed, 15 Jan 2025 12:19:58 + Subject: [PATCH 1/2] [clang][refactor] Refactor `findNextTokenIncludingCo

[clang] [clang-tools-extra] [clang][refactor] Refactor `findNextTokenIncludingComments` (PR #123060)

2025-01-15 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle created https://github.com/llvm/llvm-project/pull/123060 We have two copies of the same code in clang-tidy and clang-reorder-fields, and those are extremenly similar to `Lexer::findNextToken`, so just add an extra agument to the latter. >From cb9d5e978474b0a5ca

[clang-tools-extra] [clang-reorder-fields] Move trailing comments. (PR #122918)

2025-01-15 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle closed https://github.com/llvm/llvm-project/pull/122918 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-reorder-fields] Move trailing comments. (PR #122918)

2025-01-15 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/122918 >From 5180e6ee06531623adc35ac418d2dddbe58586c3 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Tue, 14 Jan 2025 13:38:00 + Subject: [PATCH] [clang-reorder-fields] Move trailing comments. Currently

[clang-tools-extra] [clang-reorder-fields] Move trailing comments. (PR #122918)

2025-01-15 Thread Clement Courbet via cfe-commits
@@ -116,26 +118,78 @@ findMembersUsedInInitExpr(const CXXCtorInitializer *Initializer, return Results; } -/// Returns the full source range for the field declaration up to (not -/// including) the trailing semicolumn, including potential macro invocations, -/// e.g. `int a

[clang-tools-extra] [clang-reorder-fields] Move trailing comments. (PR #122918)

2025-01-14 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/122918 >From 86e4fb91c31a38fb133e86ac64034d1386d6bd39 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Tue, 14 Jan 2025 13:38:00 + Subject: [PATCH] [clang-reorder-fields] Move trailing comments. Currently

[clang-tools-extra] [clang-reorder-fields] Move trailing comments. (PR #122918)

2025-01-14 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle created https://github.com/llvm/llvm-project/pull/122918 Currently, trailing comments get mixed up: ``` struct Foo { int a; // This one is the cool field // within the struct. int b; }; ``` becomes: ``` struct Foo { int b; // This one is the cool

[clang-tools-extra] [clang-reorder-fields] Do not reorder macro expansions. (PR #122877)

2025-01-14 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle created https://github.com/llvm/llvm-project/pull/122877 When a field definition comes from a macro expansion, reordering completely messes up the file. There is no good way to fix this, since we can't modify the macro itself. Emit a warning instead. >From 54df

[clang] [clang][ASTVisitor] Visit `HoldingVar` from `BindingDecl`. (PR #117858)

2024-12-12 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle closed https://github.com/llvm/llvm-project/pull/117858 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][ASTVisitor] Visit `HoldingVar` from `BindingDecl`. (PR #117858)

2024-12-12 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/117858 >From f388f19e26bdd7e45e874e4574e7d9196c2eaf0b Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Mon, 25 Nov 2024 15:52:18 + Subject: [PATCH 1/4] [clang][ASTVisitor] Visit `HoldingVar` from `Binding

[clang] [clang][ASTVisitor] Visit `HoldingVar` from `BindingDecl`. (PR #117858)

2024-12-12 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/117858 >From f388f19e26bdd7e45e874e4574e7d9196c2eaf0b Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Mon, 25 Nov 2024 15:52:18 + Subject: [PATCH 1/3] [clang][ASTVisitor] Visit `HoldingVar` from `Binding

[clang] [clang][ASTVisitor] Visit `HoldingVar` from `BindingDecl`. (PR #117858)

2024-12-12 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/117858 >From f388f19e26bdd7e45e874e4574e7d9196c2eaf0b Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Mon, 25 Nov 2024 15:52:18 + Subject: [PATCH 1/2] [clang][ASTVisitor] Visit `HoldingVar` from `Binding

[clang] [clang][ASTVisitor] Visit `HoldingVar` from `BindingDecl`. (PR #117858)

2024-12-12 Thread Clement Courbet via cfe-commits
@@ -143,6 +143,15 @@ const Formula &getFormula(const ValueDecl &D, const Environment &Env) { return cast(Env.getValue(D))->formula(); } +const BindingDecl *findBindingDecl(const char *Name, ASTContext &ASTCtx) { legrosbuffle wrote: Not quite sure why I did

[clang] [clang][ASTVisitor] Visit `HoldingVar` from `BindingDecl`. (PR #117858)

2024-12-12 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/117858 >From f388f19e26bdd7e45e874e4574e7d9196c2eaf0b Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Mon, 25 Nov 2024 15:52:18 + Subject: [PATCH 1/2] [clang][ASTVisitor] Visit `HoldingVar` from `Binding

[clang] [clang][ASTVisitor] Visit `HoldingVar` from `BindingDecl`. (PR #117858)

2024-12-12 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/117858 >From f388f19e26bdd7e45e874e4574e7d9196c2eaf0b Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Mon, 25 Nov 2024 15:52:18 + Subject: [PATCH] [clang][ASTVisitor] Visit `HoldingVar` from `BindingDecl`

[clang-tools-extra] [clang-reorder-fields] Handle macros fields declarations. (PR #118005)

2024-11-28 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle closed https://github.com/llvm/llvm-project/pull/118005 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-reorder-fields] Handle macros fields declarations. (PR #118005)

2024-11-28 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle edited https://github.com/llvm/llvm-project/pull/118005 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-reorder-fields] Handle macros fields declarations. (PR #118005)

2024-11-28 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle created https://github.com/llvm/llvm-project/pull/118005 Right now field with macro declarations break the tool: ``` struct Foo { Mutex mu; int x GUARDED_BY(mu); int y; }; ``` reordered by mu,y,x yields: ``` struct Foo { Mutex mu; int y GUARDED_BY(mu

[clang] [clang][ASTVisitor] Visit `HoldingVar` from `BindingDecl`. (PR #117858)

2024-11-27 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle created https://github.com/llvm/llvm-project/pull/117858 Tuple-like types introduce `VarDecl`s in the AST for their "holding vars", but AST visitors do not visit those. As a result the `VarDecl` for the holding var is orphaned when trying to retreive its parents

[clang] [clang][transformer] Make `describe()` terser for `NamedDecl`s. (PR #108215)

2024-09-11 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle closed https://github.com/llvm/llvm-project/pull/108215 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][transformer] Make `describe()` terser for `NamedDecl`s. (PR #108215)

2024-09-11 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle created https://github.com/llvm/llvm-project/pull/108215 Right now `describe()`ing a `FunctionDecl` dups the whole code of the function. Dump only its name. >From 42f1e67d2186fd90b8fc08206b33e077912039a1 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Wed,

[clang] [clang][transformer] Add `join` stencil. (PR #107366)

2024-09-05 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle created https://github.com/llvm/llvm-project/pull/107366 `join(",", a, b, c)` is the same as `cat(a, ",", b, ",", c)`. >From 0c9d87c0e25e598f40ecf3f4977cd5ed2e205636 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Thu, 5 Sep 2024 06:53:07 + Subject: [PA

[clang-tools-extra] [clang-tidy][cppcoreguidelines-missing-std-forward] Do not warn when the parameter is used in a `static_cast`. (PR #99477)

2024-08-28 Thread Clement Courbet via cfe-commits
legrosbuffle wrote: Sorry for the delay (vacations). https://github.com/llvm/llvm-project/pull/99477 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy][cppcoreguidelines-missing-std-forward] Do not warn when the parameter is used in a `static_cast`. (PR #99477)

2024-08-28 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/99477 >From d64268021d53e05fb64a4788e99fcd966d7b559a Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Thu, 18 Jul 2024 11:47:56 + Subject: [PATCH 1/9] [clang-tidy][cppcoreguidelines-missing-std-forward] Do

[clang-tools-extra] [clang-tidy][cppcoreguidelines-missing-std-forward] Do not warn when the parameter is used in a `static_cast`. (PR #99477)

2024-08-28 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/99477 >From d64268021d53e05fb64a4788e99fcd966d7b559a Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Thu, 18 Jul 2024 11:47:56 + Subject: [PATCH 1/8] [clang-tidy][cppcoreguidelines-missing-std-forward] Do

[clang-tools-extra] [clang-tidy][performance-unnecessary-value-param] Make `handleMoveFix` virtual (PR #99867)

2024-07-23 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle closed https://github.com/llvm/llvm-project/pull/99867 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy][performance-unnecessary-value-param] Make `handleMoveFix` virtual (PR #99867)

2024-07-22 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle created https://github.com/llvm/llvm-project/pull/99867 ... so that downstream checks can override behaviour to do additional processing. Refactor the rest of the logic to `handleConstRefFix` (which is also `virtual`). This is otherwise and NFC. This is simila

[clang-tools-extra] [clang-tidy][cppcoreguidelines-missing-std-forward] Do not warn when the parameter is used in a `static_cast`. (PR #99477)

2024-07-22 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle edited https://github.com/llvm/llvm-project/pull/99477 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy][cppcoreguidelines-missing-std-forward] Do not warn when the parameter is used in a `static_cast`. (PR #99477)

2024-07-22 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/99477 >From b423b26cba90288912b3377c39ab4207c9fc95dc Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Thu, 18 Jul 2024 11:47:56 + Subject: [PATCH 1/4] [clang-tidy][cppcoreguidelines-missing-std-forward] Do

[clang-tools-extra] [clang-tidy][cppcoreguidelines-missing-std-forward] Do not warn when the parameter is used in a `static_cast`. (PR #99477)

2024-07-22 Thread Clement Courbet via cfe-commits
@@ -129,15 +129,19 @@ void MissingStdForwardCheck::registerMatchers(MatchFinder *Finder) { unless(anyOf(hasAncestor(typeLoc()), hasAncestor(expr(hasUnevaluatedContext()); + auto StaticCast = cxxStaticCastExpr( + hasSourceExpression(declRefEx

[clang-tools-extra] [clang-tidy][cppcoreguidelines-missing-std-forward] Do not warn when the parameter is used in a `static_cast`. (PR #99477)

2024-07-22 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/99477 >From b423b26cba90288912b3377c39ab4207c9fc95dc Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Thu, 18 Jul 2024 11:47:56 + Subject: [PATCH 1/3] [clang-tidy][cppcoreguidelines-missing-std-forward] Do

[clang-tools-extra] [clang-tidy][cppcoreguidelines-missing-std-forward] Do not warn when the parameter is used in a `static_cast`. (PR #99477)

2024-07-19 Thread Clement Courbet via cfe-commits
@@ -129,15 +129,19 @@ void MissingStdForwardCheck::registerMatchers(MatchFinder *Finder) { unless(anyOf(hasAncestor(typeLoc()), hasAncestor(expr(hasUnevaluatedContext()); + auto StaticCast = cxxStaticCastExpr( + hasSourceExpression(declRefEx

[clang-tools-extra] [clang-tidy][cppcoreguidelines-missing-std-forward] Do not warn when the parameter is used in a `static_cast`. (PR #99477)

2024-07-19 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/99477 >From b423b26cba90288912b3377c39ab4207c9fc95dc Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Thu, 18 Jul 2024 11:47:56 + Subject: [PATCH 1/2] [clang-tidy][cppcoreguidelines-missing-std-forward] Do

[clang-tools-extra] [clang-tidy][cppcoreguidelines-missing-std-forward] Do not warn when the parameter is used in a `static_cast`. (PR #99477)

2024-07-19 Thread Clement Courbet via cfe-commits
legrosbuffle wrote: Thanks for the comments. I went for a disabled-by-default option as that seems to be the consensus. https://github.com/llvm/llvm-project/pull/99477 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-

[clang-tools-extra] [clang-tidy][cppcoreguidelines-missing-std-forward] Do not warn when the parameter is used in a `static_cast`. (PR #99477)

2024-07-18 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle created https://github.com/llvm/llvm-project/pull/99477 This provides a way to inform the check that we're intending to use an the forwarding reference as a specific reference category Fixes #99474. >From b423b26cba90288912b3377c39ab4207c9fc95dc Mon Sep 17 00:0

[clang-tools-extra] Allow unnecessary-value-param to match templated functions including lambdas with auto. (PR #97767)

2024-07-05 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle approved this pull request. https://github.com/llvm/llvm-project/pull/97767 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] Allow unnecessary-value-param to match templated functions including lambdas with auto. (PR #97767)

2024-07-04 Thread Clement Courbet via cfe-commits
@@ -0,0 +1,92 @@ +// RUN: %check_clang_tidy -std=c++14-or-later %s performance-unnecessary-value-param %t + +struct ExpensiveToCopyType { + virtual ~ExpensiveToCopyType(); +}; + +template void templateWithNonTemplatizedParameter(const ExpensiveToCopyType S, T V) { + // CHECK

[clang-tools-extra] Allow unnecessary-value-param to match templated functions including lambdas with auto. (PR #97767)

2024-07-04 Thread Clement Courbet via cfe-commits
legrosbuffle wrote: There seems to be failing tests (see "buildkite" above). Can you please update the release notes too (`clang-tools-extra/docs/ReleaseNotes.rst`) ? https://github.com/llvm/llvm-project/pull/97767 ___ cfe-commits mailing list cfe-co

[clang] [clang][transformer] Introduce a `constructExprArgs` range selector. (PR #95901)

2024-06-26 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle closed https://github.com/llvm/llvm-project/pull/95901 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][transformer] Introduce a `constructExprArgs` range selector. (PR #95901)

2024-06-26 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/95901 >From 8f6ff99ddb035d63e99910f873a8d9938bd0b3e4 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Mon, 17 Jun 2024 15:33:34 + Subject: [PATCH 1/2] [clang][transformer] Introduce a `constructExprArgs`

[clang] [clang][transformer] Introduce a `constructExprArgs` range selector. (PR #95901)

2024-06-26 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/95901 >From 8f6ff99ddb035d63e99910f873a8d9938bd0b3e4 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Mon, 17 Jun 2024 15:33:34 + Subject: [PATCH] [clang][transformer] Introduce a `constructExprArgs` range

[clang-tools-extra] [clang-tidy] Fix assert in performance-unnecessary-copy-init. (PR #96506)

2024-06-24 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle closed https://github.com/llvm/llvm-project/pull/96506 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Fix assert in performance-unnecessary-copy-init. (PR #96506)

2024-06-24 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/96506 >From 834b63adeea098ec2d815a85fe47e7577ff3baa9 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Mon, 24 Jun 2024 15:05:48 + Subject: [PATCH] [clang-tidy] Fix assert in performance-unnecessary-copy-in

[clang-tools-extra] [clang-tidy] Fix assert in performance-unnecessary-copy-init. (PR #96506)

2024-06-24 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle created https://github.com/llvm/llvm-project/pull/96506 `GetDirectCallee` can be null. Fixes #96498. >From 5034dc92f9098874471b3f035fceb8275629b37a Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Mon, 24 Jun 2024 15:05:48 + Subject: [PATCH] [clang-tidy

[clang-tools-extra] [clang-tidy] `doesNotMutateObject`: Handle calls to member functions … (PR #94362)

2024-06-10 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle closed https://github.com/llvm/llvm-project/pull/94362 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] `doesNotMutateObject`: Handle calls to member functions … (PR #94362)

2024-06-06 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/94362 >From 8a7e3ee49295b55193440da6b796c9ada43ee5ef Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Tue, 4 Jun 2024 12:49:39 + Subject: [PATCH 1/4] [clang-tidy] `doesNotMutateObject`: Handle calls to me

[clang-tools-extra] [clang-tidy] `doesNotMutateObject`: Handle calls to member functions … (PR #94362)

2024-06-06 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/94362 >From 8a7e3ee49295b55193440da6b796c9ada43ee5ef Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Tue, 4 Jun 2024 12:49:39 + Subject: [PATCH 1/3] [clang-tidy] `doesNotMutateObject`: Handle calls to me

[clang-tools-extra] [clang-tidy] `doesNotMutateObject`: Handle calls to member functions … (PR #94362)

2024-06-06 Thread Clement Courbet via cfe-commits
@@ -259,9 +258,9 @@ void UnnecessaryCopyInitialization::registerMatchers(MatchFinder *Finder) { .bind("blockStmt"); }; - Finder->addMatcher(LocalVarCopiedFrom(anyOf(isConstRefReturningFunctionCall(), - isConstRefReturni

[clang-tools-extra] [clang-tidy] `doesNotMutateObject`: Handle calls to member functions … (PR #94362)

2024-06-06 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/94362 >From 8a7e3ee49295b55193440da6b796c9ada43ee5ef Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Tue, 4 Jun 2024 12:49:39 + Subject: [PATCH 1/2] [clang-tidy] `doesNotMutateObject`: Handle calls to me

[clang-tools-extra] [clang-tidy] `doesNotMutateObject`: Handle calls to member functions … (PR #94362)

2024-06-06 Thread Clement Courbet via cfe-commits
@@ -36,6 +36,111 @@ void extractNodesByIdTo(ArrayRef Matches, StringRef ID, Nodes.insert(Match.getNodeAs(ID)); } +// If `D` has a const-qualified overload with otherwise identical +// ref-qualifiers, returns that overload. +const CXXMethodDecl *findConstOverload(const CXX

[clang-tools-extra] [clang-tidy] `doesNotMutateObject`: Handle calls to member functions … (PR #94362)

2024-06-06 Thread Clement Courbet via cfe-commits
@@ -36,6 +36,111 @@ void extractNodesByIdTo(ArrayRef Matches, StringRef ID, Nodes.insert(Match.getNodeAs(ID)); } +// If `D` has a const-qualified overload with otherwise identical +// ref-qualifiers, returns that overload. +const CXXMethodDecl *findConstOverload(const CXX

[clang-tools-extra] [clang-tidy] `doesNotMutateObject`: Handle calls to member functions … (PR #94362)

2024-06-05 Thread Clement Courbet via cfe-commits
legrosbuffle wrote: > Could this also be applied for > https://github.com/llvm/llvm-project/issues/69577? Weirdly, those two checks are using distinct methods to infer whether the underlying container is mutated. `unnecessary-copy-initialization` uses `doesNotMutateObject` while `performance-

[clang-tools-extra] [clang-tidy] `doesNotMutateObject`: Handle calls to member functions … (PR #94362)

2024-06-04 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle created https://github.com/llvm/llvm-project/pull/94362 …and operators that have non-const overloads. This allows `unnecessary-copy-initialization` to warn on more cases. The common case is a class with a a set of const/non-sconst overloads (e.g. std::vector::

[clang] [clang analysis][thread safety] Warn when returning rvalue references. (PR #91229)

2024-05-06 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle created https://github.com/llvm/llvm-project/pull/91229 We're missing `T&& Consume() && { return std::move(member); }`. >From 86733474a1bf1486b807c95792781aa2d869c2ca Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Mon, 6 May 2024 14:15:47 + Subject: [P

[clang-tools-extra] [clang-tidy] `isOnlyUsedAsConst`: Handle static method calls. (PR #84005)

2024-03-06 Thread Clement Courbet via cfe-commits
legrosbuffle wrote: > LGTM, verify if some release notes shouldn't be updated. This is very minor, I've only seen a few instances in the Google codebase, but it was trivial enough to include. https://github.com/llvm/llvm-project/pull/84005 ___ cfe-co

[clang-tools-extra] [llvm] [clang-tidy] Add support for determining constness of more expressions. (PR #82617)

2024-02-26 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle closed https://github.com/llvm/llvm-project/pull/82617 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [llvm] [clang-tidy] Add support for determining constness of more expressions. (PR #82617)

2024-02-26 Thread Clement Courbet via cfe-commits
legrosbuffle wrote: Thanks all. Comments addressed. > Overall looking fine, but this check need to be run on bigger code-base to > verify if there are no false positives or crashes. Sorry, this was not very clear. By "our codebase" I meant the whole of Google code :) This also ran on numerous

[clang-tools-extra] [llvm] [clang-tidy] Add support for determining constness of more expressions. (PR #82617)

2024-02-26 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/82617 >From 9b93c8bf0614e64352de8e210adf6ff316c0133e Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Mon, 19 Feb 2024 14:58:27 + Subject: [PATCH 1/5] [llvm-exegesis][NFC] Refactor all `ValidationEvent` in

[clang-tools-extra] [clang-tidy] Add support for determining constness of more expressions. (PR #82617)

2024-02-26 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/82617 >From b2b98e9594b224f471f88924b8b060bee06de483 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Wed, 21 Feb 2024 09:15:22 + Subject: [PATCH 1/3] [clang-tidy] Add support for determining constness of

[clang-tools-extra] [clang-tidy] Add support for determining constness of more expressions. (PR #82617)

2024-02-26 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/82617 >From b2b98e9594b224f471f88924b8b060bee06de483 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Wed, 21 Feb 2024 09:15:22 + Subject: [PATCH 1/2] [clang-tidy] Add support for determining constness of

[clang-tools-extra] [clang-tidy] Add support for determining constness of more expressions. (PR #82617)

2024-02-26 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle updated https://github.com/llvm/llvm-project/pull/82617 >From b2b98e9594b224f471f88924b8b060bee06de483 Mon Sep 17 00:00:00 2001 From: Clement Courbet Date: Wed, 21 Feb 2024 09:15:22 + Subject: [PATCH] [clang-tidy] Add support for determining constness of more

[clang-tools-extra] [clang-tidy] Add support for determining constness of more expressions. (PR #82617)

2024-02-22 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle created https://github.com/llvm/llvm-project/pull/82617 This uses a more systematic approach for determining whcich `DeclRefExpr`s mutate the underlying object: Instead of using a few matchers, we walk up the AST until we find a parent that we can prove cannot c

[clang-tools-extra] [clang] [llvm] [llvm-exegesis] Replace --num-repetitions with --min-instructions (PR #77153)

2024-02-01 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle approved this pull request. https://github.com/llvm/llvm-project/pull/77153 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang] [llvm] [llvm-exegesis] Replace --num-repetitions with --min-instructions (PR #77153)

2024-02-01 Thread Clement Courbet via cfe-commits
legrosbuffle wrote: > I'm assuming at some point we'll want to deprecate this old option? It's a single line of code so it probably can stay there for backwards compatibility :) https://github.com/llvm/llvm-project/pull/77153 ___ cfe-commits mailing

[clang] [llvm] [clang-tools-extra] [libc] [llvm-exegesis] Add middle half repetition mode (PR #77020)

2024-01-30 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle approved this pull request. https://github.com/llvm/llvm-project/pull/77020 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[compiler-rt] [libc] [llvm] [clang-tools-extra] [clang] [libc] `FPRep` builders return `FPRep` instead of raw `StorageType` (PR #78588)

2024-01-22 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle approved this pull request. https://github.com/llvm/llvm-project/pull/78588 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[compiler-rt] [libc] [llvm] [clang-tools-extra] [clang] [libc] `FPRep` builders return `FPRep` instead of raw `StorageType` (PR #78588)

2024-01-22 Thread Clement Courbet via cfe-commits
@@ -535,92 +472,178 @@ struct FPRep : public FPRepBase { // - Quiet Not a Number // - Unnormal // This can be reduced to the following logic: -if (exp_bits() == encode(BiasedExponent::BITS_ALL_ONES())) +if (exp_bits() == encode(BiasedExp::BITS_ALL_ONES()))

[clang-tools-extra] [clang] [clang-tidy] Handle C++ structured bindings in `performance-for-range-copy` (PR #77105)

2024-01-16 Thread Clement Courbet via cfe-commits
https://github.com/legrosbuffle closed https://github.com/llvm/llvm-project/pull/77105 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[lld] [clang] [clang-tools-extra] [llvm] [llvm-exegesis] Add support for validation counters (PR #76653)

2024-01-11 Thread Clement Courbet via cfe-commits
@@ -112,9 +116,11 @@ class Counter { PerfEvent Event; int FileDescriptor = -1; bool IsDummyEvent; + std::vector ValidationEvents; legrosbuffle wrote: OK, let's rename `Counter` to `CounterGroup`, but let's at least create a (private) abstraction for an

[clang] [clang-tools-extra] [clang-tidy] Handle C++ structured bindings in `performance-for-range-copy` (PR #77105)

2024-01-08 Thread Clement Courbet via cfe-commits
@@ -234,6 +239,22 @@ void positiveOnlyAccessedFieldAsConst() { } } +void positiveOnlyAccessedFieldAsConstBinding() { legrosbuffle wrote: Done. https://github.com/llvm/llvm-project/pull/77105 ___ cfe-commits maili

  1   2   3   4   >