[clang-tools-extra] [clangd] Add inlay hints for default function arguments and implicit lambda captures (PR #95712)

2024-06-19 Thread Tor Shepherd via cfe-commits
torshepherd wrote: Ok I took a stab at doing lambda captures as hover instead. - Targeting the exact '=' or '&' is nontrivial since the capture list isn't in the AST, the lambda is just `LambdaExpr` with children for the parameters and the CompoundStmt body. - `auto MyLambda = [...` already

[clang-tools-extra] [clangd] Add inlay hints for default function arguments and implicit lambda captures (PR #95712)

2024-06-19 Thread Tor Shepherd via cfe-commits
https://github.com/torshepherd updated https://github.com/llvm/llvm-project/pull/95712 >From 3830a49faf5e20781f864d459f5478221740ac3d Mon Sep 17 00:00:00 2001 From: Tor Shepherd Date: Wed, 19 Jun 2024 09:55:34 -0400 Subject: [PATCH 1/2] after comments --- clang-tools-extra/clangd/Config.h

[clang-tools-extra] [clangd] Add inlay hints for default function arguments and implicit lambda captures (PR #95712)

2024-06-19 Thread Tor Shepherd via cfe-commits
https://github.com/torshepherd updated https://github.com/llvm/llvm-project/pull/95712 >From 3830a49faf5e20781f864d459f5478221740ac3d Mon Sep 17 00:00:00 2001 From: Tor Shepherd Date: Wed, 19 Jun 2024 09:55:34 -0400 Subject: [PATCH 1/2] after comments --- clang-tools-extra/clangd/Config.h

[clang-tools-extra] [clangd] Add inlay hints for default function arguments and implicit lambda captures (PR #95712)

2024-06-19 Thread Tor Shepherd via cfe-commits
@@ -372,6 +382,34 @@ maybeDropCxxExplicitObjectParameters(ArrayRef Params) { return Params; } +llvm::StringRef getLambdaCaptureName(const LambdaCapture ) { + if (Capture.capturesVariable()) +return Capture.getCapturedVar()->getName(); + if (Capture.capturesThis()) +

[clang-tools-extra] [clangd] Add inlay hints for default function arguments and implicit lambda captures (PR #95712)

2024-06-19 Thread Tor Shepherd via cfe-commits
@@ -372,6 +382,34 @@ maybeDropCxxExplicitObjectParameters(ArrayRef Params) { return Params; } +llvm::StringRef getLambdaCaptureName(const LambdaCapture ) { + if (Capture.capturesVariable()) +return Capture.getCapturedVar()->getName(); + if (Capture.capturesThis()) +

[clang-tools-extra] [clangd] Add inlay hints for default function arguments and implicit lambda captures (PR #95712)

2024-06-19 Thread Tor Shepherd via cfe-commits
@@ -15,9 +15,12 @@ #include "support/Context.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/ScopedPrinter.h" +#include "llvm/Support/raw_ostream.h" #include "gmock/gmock.h" #include "gtest/gtest.h" +#include #include +#include torshepherd

[clang-tools-extra] [clangd] Add inlay hints for default function arguments and implicit lambda captures (PR #95712)

2024-06-19 Thread Tor Shepherd via cfe-commits
https://github.com/torshepherd updated https://github.com/llvm/llvm-project/pull/95712 >From 3830a49faf5e20781f864d459f5478221740ac3d Mon Sep 17 00:00:00 2001 From: Tor Shepherd Date: Wed, 19 Jun 2024 09:55:34 -0400 Subject: [PATCH 1/2] after comments --- clang-tools-extra/clangd/Config.h

[clang-tools-extra] [clangd] Add inlay hints for default function arguments and implicit lambda captures (PR #95712)

2024-06-19 Thread Tor Shepherd via cfe-commits
https://github.com/torshepherd updated https://github.com/llvm/llvm-project/pull/95712 >From 77bb21454b2110bed491689a4c323cff1c745207 Mon Sep 17 00:00:00 2001 From: Tor Shepherd Date: Sun, 16 Jun 2024 10:54:43 -0400 Subject: [PATCH] Add default arguments and lambda captures only ---

[clang-tools-extra] [clangd] Add inlay hints for default function arguments and implicit lambda captures (PR #95712)

2024-06-17 Thread Tor Shepherd via cfe-commits
@@ -504,10 +503,10 @@ struct FragmentCompiler { auto Fast = isFastTidyCheck(Str); if (!Fast.has_value()) { diag(Warning, - llvm::formatv( - "Latency of clang-tidy check '{0}' is not known. " - "It will only run if

[clang-tools-extra] [clangd] Add inlay hints for default function arguments and implicit lambda captures (PR #95712)

2024-06-17 Thread Tor Shepherd via cfe-commits
@@ -1568,7 +1626,7 @@ TEST(TypeHints, SubstTemplateParameterAliases) { )cpp"; llvm::StringRef VectorIntPtr = R"cpp( -vector array; +vector $init[[array]]; torshepherd wrote: Another artifact, sorry https://github.com/llvm/llvm-project/pull/95712

[clang-tools-extra] [clangd] Add inlay hints for default function arguments and implicit lambda captures (PR #95712)

2024-06-17 Thread Tor Shepherd via cfe-commits
@@ -1458,13 +1463,66 @@ TEST(TypeHints, DefaultTemplateArgs) { struct A {}; A foo(); auto $var[[var]] = foo(); -A bar[1]; +A baz; +A bar[1]{}; torshepherd wrote: My fault, an artifact from a different set of inlay hints I decided not

[clang-tools-extra] [clangd] Add inlay hints for default function arguments and implicit lambda captures (PR #95712)

2024-06-17 Thread Tor Shepherd via cfe-commits
@@ -15,9 +15,12 @@ #include "support/Context.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/ScopedPrinter.h" +#include "llvm/Support/raw_ostream.h" #include "gmock/gmock.h" #include "gtest/gtest.h" +#include #include +#include torshepherd

[clang-tools-extra] [clangd] Add inlay hints for default function arguments and implicit lambda captures (PR #95712)

2024-06-17 Thread Tor Shepherd via cfe-commits
torshepherd wrote: Aha, that's a great suggestion. I agree that beyond the trivial case of 2 captured variables it gets a bit noisy. On-hover would be quite nice though! To clarify, you mean hovering over the default capture '=' or '&' right? I'm happy to remove the lambdas from this PR in

[clang-tools-extra] [clangd] Add inlay hints for default function arguments and implicit lambda captures (PR #95712)

2024-06-16 Thread Tor Shepherd via cfe-commits
https://github.com/torshepherd created https://github.com/llvm/llvm-project/pull/95712 Title. This PR adds support for showing implicit lambda captures: ![image](https://github.com/llvm/llvm-project/assets/49597791/d0150817-f71e-4971-8d8b-e25d2b1e8bf8) and defaulted function arguments:

[clang-tools-extra] [clangd] Add 'apply all clangd fixes' and 'apply all '_' fixes' QuickFixes (PR #79867)

2024-06-14 Thread Tor Shepherd via cfe-commits
torshepherd wrote: @HighCommander4 I've pushed up the change that doesn't allow conflicting fixits. I'll now be smoke-testing this over the coming weeks while I work, but consider it ready for review again whenever you have a chance https://github.com/llvm/llvm-project/pull/79867

[clang-tools-extra] [clangd] Add 'apply all clangd fixes' and 'apply all '_' fixes' QuickFixes (PR #79867)

2024-06-14 Thread Tor Shepherd via cfe-commits
https://github.com/torshepherd updated https://github.com/llvm/llvm-project/pull/79867 >From 94dee94becb7d79b087e183754602e08a5c4669d Mon Sep 17 00:00:00 2001 From: Tor Shepherd Date: Mon, 29 Jan 2024 11:44:25 -0500 Subject: [PATCH 1/2] [clangd] Add fix-all CodeActions ---

[clang-tools-extra] [clangd] Add 'apply all clangd fixes' and 'apply all '_' fixes' QuickFixes (PR #79867)

2024-05-04 Thread Tor Shepherd via cfe-commits
torshepherd wrote: Ah, awesome. In that case note that I'll make the option not show up when changes would have conflicting overlap ranges https://github.com/llvm/llvm-project/pull/79867 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang-tools-extra] [llvm] [clangd] Add CodeAction to swap operands to binary operators (PR #78999)

2024-05-04 Thread Tor Shepherd via cfe-commits
torshepherd wrote: Ping https://github.com/llvm/llvm-project/pull/78999 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clangd] Add 'apply all clangd fixes' and 'apply all '_' fixes' QuickFixes (PR #79867)

2024-05-04 Thread Tor Shepherd via cfe-commits
torshepherd wrote: Bump @HighCommander4 - did you get a chance to review this? I've been using this with great success in my local build for several months now, and the feature is _extremely_ handy. There is a slight bug that overlapping fixes are troublesome if you choose "clangd apply

[clang-tools-extra] [clangd] Add 'apply all clangd fixes' and 'apply all '_' fixes' QuickFixes (PR #79867)

2024-02-27 Thread Tor Shepherd via cfe-commits
https://github.com/torshepherd updated https://github.com/llvm/llvm-project/pull/79867 >From 94dee94becb7d79b087e183754602e08a5c4669d Mon Sep 17 00:00:00 2001 From: Tor Shepherd Date: Mon, 29 Jan 2024 11:44:25 -0500 Subject: [PATCH] [clangd] Add fix-all CodeActions ---

[clang-tools-extra] [clangd] Add 'apply all clangd fixes' and 'apply all '_' fixes' QuickFixes (PR #79867)

2024-02-13 Thread Tor Shepherd via cfe-commits
torshepherd wrote: Ping https://github.com/llvm/llvm-project/pull/79867 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [llvm] [clangd] Add CodeAction to swap operands to binary operators (PR #78999)

2024-02-11 Thread Tor Shepherd via cfe-commits
https://github.com/torshepherd updated https://github.com/llvm/llvm-project/pull/78999 >From 6abe2b5af090329bfca42d144597fbd5ca41d511 Mon Sep 17 00:00:00 2001 From: Tor Shepherd Date: Sun, 21 Jan 2024 17:53:31 -0500 Subject: [PATCH] [clangd] Swap binary operands ---

[clang-tools-extra] [clangd] Add 'apply all clangd fixes' and 'apply all '_' fixes' QuickFixes (PR #79867)

2024-02-11 Thread Tor Shepherd via cfe-commits
https://github.com/torshepherd updated https://github.com/llvm/llvm-project/pull/79867 >From 636e8286b38839c9d90e9eb147ba59d588c3241c Mon Sep 17 00:00:00 2001 From: Tor Shepherd Date: Mon, 29 Jan 2024 11:44:25 -0500 Subject: [PATCH] [clangd] Add fix-all CodeActions ---

[llvm] [clang] [clang-tools-extra] [clangd] Add CodeAction to swap operands to binary operators (PR #78999)

2024-02-04 Thread Tor Shepherd via cfe-commits
https://github.com/torshepherd updated https://github.com/llvm/llvm-project/pull/78999 >From c22c4fc969af0860b1fb2c371d31c2757da70e01 Mon Sep 17 00:00:00 2001 From: Tor Shepherd Date: Sun, 21 Jan 2024 17:53:31 -0500 Subject: [PATCH 1/2] swap binary ---

[clang-tools-extra] [clangd] Add 'apply all clangd fixes' and 'apply all '_' fixes' QuickFixes (PR #79867)

2024-02-04 Thread Tor Shepherd via cfe-commits
torshepherd wrote: Also pinging @kadircet who recently worked on Include Cleaner's similar batch fixes https://github.com/llvm/llvm-project/pull/79867 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang-tools-extra] [clangd] Add 'apply all clangd fixes' and 'apply all '_' fixes' QuickFixes (PR #79867)

2024-02-01 Thread Tor Shepherd via cfe-commits
https://github.com/torshepherd updated https://github.com/llvm/llvm-project/pull/79867 >From 7cb9e7b604a16414f31309b59747abbd7d3c0025 Mon Sep 17 00:00:00 2001 From: Tor Shepherd Date: Mon, 29 Jan 2024 11:44:25 -0500 Subject: [PATCH] [clangd] Add fix-all CodeActions ---

[clang-tools-extra] [clangd] Add 'apply all clangd fixes' and 'apply all '_' fixes' QuickFixes (PR #79867)

2024-01-30 Thread Tor Shepherd via cfe-commits
https://github.com/torshepherd updated https://github.com/llvm/llvm-project/pull/79867 >From 0ed7667a5b48064a492f7f125a4002912a35fec7 Mon Sep 17 00:00:00 2001 From: Tor Shepherd Date: Mon, 29 Jan 2024 11:44:25 -0500 Subject: [PATCH 1/2] initial cut ---

[clang-tools-extra] [clangd] Add 'apply all clangd fixes' and 'apply all '_' fixes' QuickFixes (PR #79867)

2024-01-30 Thread Tor Shepherd via cfe-commits
https://github.com/torshepherd edited https://github.com/llvm/llvm-project/pull/79867 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clangd] Add 'apply all clangd fixes' and 'apply all '_' fixes' QuickFixes (PR #79867)

2024-01-30 Thread Tor Shepherd via cfe-commits
https://github.com/torshepherd edited https://github.com/llvm/llvm-project/pull/79867 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clangd] Add 'apply all clangd fixes' and 'apply all '_' fixes' QuickFixes (PR #79867)

2024-01-30 Thread Tor Shepherd via cfe-commits
torshepherd wrote: Hmm I noticed another mini-issue. Ideally we shouldn't have a 'fix all clangd' quick fix if all of the issues come from the same source, only the 'fix all _' option https://github.com/llvm/llvm-project/pull/79867 ___ cfe-commits

[clang-tools-extra] [clangd] Add 'apply all clangd fixes' and 'apply all '_' fixes' QuickFixes (PR #79867)

2024-01-29 Thread Tor Shepherd via cfe-commits
torshepherd wrote: Also, I noticed that the conversion function `toCodeAction(const Fix& F, ...)` specifically hardcodes all Fix objects to `QUICKFIX_KIND`. When we do https://github.com/clangd/clangd/issues/1446, it would be good to add a string for `SOURCE_FIX_ALL_KIND` and set these

[clang-tools-extra] [clangd] Add 'apply all clangd fixes' and 'apply all '_' fixes' QuickFixes (PR #79867)

2024-01-29 Thread Tor Shepherd via cfe-commits
torshepherd wrote: Another thing that would be nice to solve in a follow-up (applies to unused includes as well btw) is to clean up the list of fixes when someone selects all and presses quick fix:

[clang-tools-extra] [clangd] Add 'apply all clangd fixes' and 'apply all '_' fixes' QuickFixes (PR #79867)

2024-01-29 Thread Tor Shepherd via cfe-commits
https://github.com/torshepherd created https://github.com/llvm/llvm-project/pull/79867 This PR adds the following features 1. If there are at least 2 distinct fixable diagnostics stemming from either `clang` or `clang-tidy` overall and their edits are distinct as well, we add a Fix to each

[clang-tools-extra] [clangd] Attempt to fix https://github.com/clangd/clangd/issues/1536 (PR #79448)

2024-01-28 Thread Tor Shepherd via cfe-commits
torshepherd wrote: I'll close this patch and pursue the other things we discussed https://github.com/llvm/llvm-project/pull/79448 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clangd] Attempt to fix https://github.com/clangd/clangd/issues/1536 (PR #79448)

2024-01-28 Thread Tor Shepherd via cfe-commits
https://github.com/torshepherd closed https://github.com/llvm/llvm-project/pull/79448 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[llvm] [clang-tools-extra] [clangd] Add CodeAction to swap operands to binary operators (PR #78999)

2024-01-26 Thread Tor Shepherd via cfe-commits
@@ -0,0 +1,210 @@ +//===--- SwapBinaryOperands.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:

[clang-tools-extra] [clangd] Attempt to fix https://github.com/clangd/clangd/issues/1536 (PR #79448)

2024-01-25 Thread Tor Shepherd via cfe-commits
https://github.com/torshepherd created https://github.com/llvm/llvm-project/pull/79448 This PR attempts to fix [1536.](https://github.com/clangd/clangd/issues/1536). See in the unit tests, when all quick fixes are of the same `code`, `isPreferred` will be true. However, this doesn't seem to

[llvm] [clang-tools-extra] [clangd] Add CodeAction to swap operands to binary operators (PR #78999)

2024-01-24 Thread Tor Shepherd via cfe-commits
https://github.com/torshepherd updated https://github.com/llvm/llvm-project/pull/78999 >From c22c4fc969af0860b1fb2c371d31c2757da70e01 Mon Sep 17 00:00:00 2001 From: Tor Shepherd Date: Sun, 21 Jan 2024 17:53:31 -0500 Subject: [PATCH 1/2] swap binary ---

[llvm] [clang-tools-extra] [clangd] Add CodeAction to swap operands to binary operators (PR #78999)

2024-01-22 Thread Tor Shepherd via cfe-commits
https://github.com/torshepherd created https://github.com/llvm/llvm-project/pull/78999 This MR resolves https://github.com/llvm/llvm-project/issues/78998 >From c22c4fc969af0860b1fb2c371d31c2757da70e01 Mon Sep 17 00:00:00 2001 From: Tor Shepherd Date: Sun, 21 Jan 2024 17:53:31 -0500 Subject: