[all-commits] [llvm/llvm-project] b9b693: [clangd] Treat 'auto' params as deduced if there's...

Sam McCall via All-commits all-commits at lists.llvm.org
Mon Feb 21 04:42:46 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b9b6938183e837e66ff7450fb2b8a73dce5889c0
      https://github.com/llvm/llvm-project/commit/b9b6938183e837e66ff7450fb2b8a73dce5889c0
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2022-02-21 (Mon, 21 Feb 2022)

  Changed paths:
    M clang-tools-extra/clangd/AST.cpp
    M clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
    M clang-tools-extra/clangd/unittests/ASTTests.cpp
    M clang-tools-extra/clangd/unittests/XRefsTests.cpp
    M clang-tools-extra/clangd/unittests/tweaks/ExpandAutoTypeTests.cpp

  Log Message:
  -----------
  [clangd] Treat 'auto' params as deduced if there's a single instantiation.

This makes hover/go-to-definition/expand-auto etc work for auto params in many
common cases.
This includes when a generic lambda is passed to a function accepting
std::function. (The tests don't use this case, it requires a lot of setup).

Note that this doesn't affect the AST of the function body itself, cause its
nodes not to be dependent, improve code completion etc.
(These sort of improvements seem possible, in a similar "if there's a single
instantiation, traverse it instead of the primary template" way).

Fixes https://github.com/clangd/clangd/issues/493
Fixes https://github.com/clangd/clangd/issues/1015

Differential Revision: https://reviews.llvm.org/D119537




More information about the All-commits mailing list