[PATCH] D94942: [clangd] Add tweak for implementing abstract class

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 31 09:14:32 PDT 2022


njames93 added a comment.

In D94942#3419616 <https://reviews.llvm.org/D94942#3419616>, @sammccall wrote:

> @njames93 I had completely forgotten about this when I attempted the same thing early this year.
> I never finished it but wanted to share what I had in case it's useful: http://reviews.llvm.org/D122827. Also happy to finish that sometime if you're not keen on completing this.
>
> Some thoughts based on that:
>
> - I think it's worth handling both "implement pure-virtuals" and "override virtuals" as the same tweak, choosing based on context. >90% of the work is the same. (I think my patch gets detection wrong though).
> - we now have a library to pick insertion points in a class a bit more declaratively
> - I think you can use getFinalOverriders to avoid a lot of work traversing class hierarchies
> - if you're not using getReturnType().print(..., /*Placeholder=*/Declarator) then functions-that-return-function-pointers will definitely be rendered wrong :-)

I stopped working on this a while ago but happy to resume (I've cherry picked this to the custom clangd build I use and it definitely has some value)
However I think we need a discussion about the ideal interface for this as there is no perfect solution for each use case. 
For example where do we trigger the tweak, and do we only override the pure virtual functions or is there value to have overrides for all virtual functions.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94942/new/

https://reviews.llvm.org/D94942



More information about the cfe-commits mailing list