[PATCH] D122698: [clangd] Add support to extract method for ExtractFunction Tweak

Fabio Rossini Sluzala via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 4 16:02:02 PDT 2022


FabioRS updated this revision to Diff 420336.
FabioRS added a comment.

Thanks!

I removed the excess setting/resseting of the SyntacticDC and SemanticDC

  ExtractedFunc.SyntacticDC =
      ExtZone.EnclosingFunction->getLexicalDeclContext();
  ExtractedFunc.SemanticDC = ExtZone.EnclosingFunction->getDeclContext();



  if (const auto *Method =
          llvm::dyn_cast<CXXMethodDecl>(ExtZone.EnclosingFunction))
    captureMethodInfo(ExtractedFunc, Method);

I place the  ExtractedFunc.ForwardDeclarationSyntacticDC = ExtractedFunc.SemanticDC inside the if (ExtZone.EnclosingFunction->isOutOfLine()) branch since the out-of-line ns:f() needs it too. What do you think?


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

https://reviews.llvm.org/D122698

Files:
  clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp
  clang-tools-extra/clangd/unittests/tweaks/ExtractFunctionTests.cpp

STAMPS
actor(@FabioRS) application(Differential) author(@FabioRS) herald(H243) herald(H311) herald(H365) herald(H378) herald(H391) herald(H502) herald(H576) herald(H744) herald(H864) monogram(D122698) object-type(DREV) phid(PHID-DREV-cfxk4igkfserwacndt5w) reviewer(@sammccall) revision-status(accepted) subscriber(@arphaman) subscriber(@cfe-commits) subscriber(@ilya-biryukov) subscriber(@kadircet) subscriber(@MaskRay) subscriber(@nridge) subscriber(@usaxena95) tag(#all) tag(#clang-tools-extra) via(web)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122698.420336.patch
Type: text/x-patch
Size: 20543 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220404/abe132f9/attachment-0001.bin>


More information about the cfe-commits mailing list