[all-commits] [llvm/llvm-project] c9974a: [clangd] Do not offer extraction to variable for d...

Christian Kandeler via All-commits all-commits at lists.llvm.org
Mon Feb 19 11:00:35 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c9974ae4a0601a9e9f5842114ecd899ab9142786
      https://github.com/llvm/llvm-project/commit/c9974ae4a0601a9e9f5842114ecd899ab9142786
  Author: Christian Kandeler <christian.kandeler at qt.io>
  Date:   2024-02-19 (Mon, 19 Feb 2024)

  Changed paths:
    M clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp
    M clang-tools-extra/clangd/unittests/tweaks/ExtractVariableTests.cpp

  Log Message:
  -----------
  [clangd] Do not offer extraction to variable for decl init expression (#69477)

That would turn:
  int x = f() + 1;
into:
  auto placeholder = f() + 1;
  int x = placeholder;
which makes little sense and is clearly not intended, as stated
explicitly by a comment in eligibleForExtraction(). It appears that the
declaration case was simply forgotten (the assignment case was already
implemented).



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list