[PATCH] D92847: [clangd] ExpandAutoType: Do not offer code action on lambdas.
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 8 10:18:02 PST 2020
sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.
================
Comment at: clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp:73
if (!Result.getTypePtr()->isDecltypeAuto() &&
!isStructuredBindingType(Node))
CachedLocation = Result;
----------------
i'd pull out a new function and just write `!isDeducedAsLambda(Node, Result.getLocation())` or so here...
================
Comment at: clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp:87
+ //
+ // In the future, We could re-use this node we found here in apply(), but a
+ // better approach would be to fix getDeducedType() to not require walking
----------------
This comment makes it sound a bit more committed to fixing this than I feel :-\
I'd maybe limit this to: getDeducedType() does a traversal, which we want to avoid in prepare().
But at least check this isn't `auto x = []{...};`, which can't ever be expanded.
(It would be nice if we had an efficient getDeducedType(), instead).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92847/new/
https://reviews.llvm.org/D92847
More information about the cfe-commits
mailing list