[PATCH] D136212: [clangd] consider ~^foo() to target the destructor, not the type

Nathan Ridge via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 18 22:38:57 PDT 2022


nridge accepted this revision.
nridge added a comment.
This revision is now accepted and ready to land.

Thanks for fixing!



================
Comment at: clang-tools-extra/clangd/Selection.cpp:881
+      return CDD->getNameInfo().getNamedTypeInfo()->getTypeLoc().getBeginLoc();
+    if (const Stmt *S = N.get<MemberExpr>()) {
+      if (const auto *ME = llvm::dyn_cast<MemberExpr>(S)) {
----------------
Doesn't `N.get<MemberExpr>` already return a `MemberExpr*`?


================
Comment at: clang-tools-extra/clangd/Selection.cpp:884
+        auto NameInfo = ME->getMemberNameInfo();
+        llvm::errs() << "name " << NameInfo.getAsString() << "\n";
+        if (NameInfo.getName().getNameKind() ==
----------------
remove log


================
Comment at: clang-tools-extra/clangd/unittests/SelectionTests.cpp:469
       {"struct foo { [[^~foo()]]; };", "CXXDestructorDecl"},
-      // FIXME: The following to should be class itself instead.
       {"struct foo { [[fo^o(){}]] };", "CXXConstructorDecl"},
----------------
The FIXME looks like it pertains to the next line where the behaviour is unchanged -- should it be preserved?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136212



More information about the cfe-commits mailing list