This is an archive of the discontinued LLVM Phabricator instance.

[clangd] ExpandAutoType: Do not offer code action on lambdas.
ClosedPublic

Authored by adamcz on Dec 8 2020, 7:36 AM.

Details

Summary

We can't expand lambda types anyway. Now we simply not offer the code
action instead of showing it and then returning an error in apply().

Diff Detail

Event Timeline

adamcz created this revision.Dec 8 2020, 7:36 AM
adamcz requested review of this revision.Dec 8 2020, 7:36 AM
sammccall accepted this revision.Dec 8 2020, 10:18 AM
sammccall added inline comments.
clang-tools-extra/clangd/refactor/tweaks/ExpandAutoType.cpp
92–93

i'd pull out a new function and just write !isDeducedAsLambda(Node, Result.getLocation()) or so here...

107

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).

This revision is now accepted and ready to land.Dec 8 2020, 10:18 AM
adamcz updated this revision to Diff 310289.Dec 8 2020, 10:54 AM
adamcz marked 2 inline comments as done.

addressed review comments

Also added some "const" to make clang-tidy happy

This revision was landed with ongoing or failed builds.Dec 8 2020, 11:08 AM
This revision was automatically updated to reflect the committed changes.