[PATCH] D65526: [Clangd] First version of ExtractFunction

Shaurya Gupta via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 23 06:02:47 PDT 2019


SureYeaah added inline comments.


================
Comment at: clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp:214
+    bool IsConst;
+    Parameter(std::string Name, std::string Type, bool IsConst)
+        : Name(Name), Type(Type), IsConst(IsConst) {}
----------------
sammccall wrote:
> I'd suggest capturing the type as a QualType instead of a string + const + ref flag
> 
> When types may need to be re-spelled, we'll need that extra information - the context needed to re-spell is available at render() time, not addParameter() time.
Const will also depend on CapturedSourceInfo. So I'm passing QualType instead of the name as string.


================
Comment at: clang-tools-extra/clangd/refactor/tweaks/ExtractFunction.cpp:360
+
+CapturedSourceInfo::DeclInformation &
+CapturedSourceInfo::getDeclInformationFor(const Decl *D) {
----------------
kadircet wrote:
> why not move this and 4 following functions into astvisitor?
Because we would need to pass CapturedSourceInfo and ExtractionZone to the Visitor then?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65526





More information about the cfe-commits mailing list