[PATCH] D91952: [clangd] Add support for within-file rename of complicated fields

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 26 04:33:33 PST 2020


hokein accepted this revision.
hokein added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang-tools-extra/clangd/refactor/Rename.cpp:132
+    // instantiated.
+    // FIXME: Maybe a proper way of fixing this would be enhancing Clang AST
+    // although it might be a bigger effort.
----------------
not sure the `FIXME` is useful here, we may never do that, I'd just drop it.


================
Comment at: clang-tools-extra/clangd/refactor/Rename.cpp:138
+    FieldParent = FieldParent->getTemplateInstantiationPattern();
+    if (!FieldParent)
+      return Field->getCanonicalDecl();
----------------
nit: this if branch is not necessary, because the if below already handles that.


================
Comment at: clang-tools-extra/clangd/refactor/Rename.cpp:150
+    const VarDecl *OriginalVD = VD->getInstantiatedFromStaticDataMember();
+    if (OriginalVD)
+      VD = OriginalVD;
----------------
nit: we can inline the OriginalVD declaration into the `if`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91952



More information about the cfe-commits mailing list