[PATCH] D147802: [clangd] Handle destructors in DefineOutline tweak
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 14 08:06:32 PDT 2023
kadircet accepted this revision.
kadircet added a comment.
This revision is now accepted and ready to land.
thanks!
================
Comment at: clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp:186-194
+ if (const auto *Destructor = llvm::dyn_cast<CXXDestructorDecl>(FD)) {
+ if (auto Err = DeclarationCleanups.add(tooling::Replacement(
+ SM, Destructor->getLocation(), 0,
+ getQualification(AST, *TargetContext,
+ SM.getLocForStartOfFile(SM.getMainFileID()),
+ Destructor))))
+ Errors = llvm::joinErrors(std::move(Errors), std::move(Err));
----------------
njames93 wrote:
> I had thought about adjusting the FindTarget code for this, but that resulted in a lot of other failed tests. It seems a delicate one there.
yeah it's a little unfortunate. can you have a comment about it in here so that we can keep it in mind. something like:
```
findExplicitReferences doesn't provide references to constructor/destructors, it only provides references to type names inside them.
this works for constructors, but doesn't work for destructor as type name doesn't cover leading `~`, so handle it specially.
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147802/new/
https://reviews.llvm.org/D147802
More information about the cfe-commits
mailing list