[PATCH] D124486: [clangd] ExtractVariable support for C and Objective-C

David Goldman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 20 09:33:45 PDT 2022


dgoldman added inline comments.


================
Comment at: clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp:418
+  if (const auto *ME = dyn_cast<MemberExpr>(E))
+    if (const auto *TE = dyn_cast<CXXThisExpr>(ME->getBase()))
+      if (TE->isImplicit())
----------------
sammccall wrote:
> oops, I forgot one detail: we want ME->getBase()->IgnoreImpCasts()
> 
> (in `void nonConstMethod() { constMethod(); }` there's an ImplicitCastExpr in there...
Hmm, is this right, I tested out that example and it seems like that's actually a `CXXMemberCallExpr` which this doesn't handle?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124486



More information about the cfe-commits mailing list