[PATCH] D119537: [clangd] Treat 'auto' params as deduced if there's a single instantiation.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 11 03:11:02 PST 2022


sammccall created this revision.
sammccall added a reviewer: nridge.
Herald added subscribers: usaxena95, kadircet, arphaman.
sammccall requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119537

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119537.407824.patch
Type: text/x-patch
Size: 10332 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220211/ff87ae23/attachment.bin>


More information about the cfe-commits mailing list