[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 15:51:59 PDT 2022
FabioRS added inline comments.
================
Comment at: clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp:765
+
+ ExtractedFunc.ForwardDeclarationSyntacticDC = ExtractedFunc.SemanticDC =
+ ExtractedFunc.SyntacticDC = ExtZone.EnclosingFunction->getDeclContext();
----------------
sammccall wrote:
> You're setting/resetting these in lots of different places, but no need for that:
>
> SyntacticDC = EnclosingFunction->getLexicalDeclContext()
> SemanticDC = getDeclContext();
>
> and set ForwardDeclarationSyntacticDC in captureMethodInfo(), leave it null if this isn't a method.
Thanks!
The out-of-line ns:f() needs the ForwardDeclarationSyntacticDC too, I think inside the branch if (ExtZone.EnclosingFunction->isOutOfLine()) is the place to put it, I will submit a diff.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122698/new/
https://reviews.llvm.org/D122698
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)
More information about the cfe-commits
mailing list