[PATCH] D71187: [clangd] Delete default arguments while moving functions out-of-line

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 9 05:35:57 PST 2019


kadircet added inline comments.


================
Comment at: clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp:186
+    if (PVD->hasDefaultArg()) {
+      auto DelRange = CharSourceRange::getTokenRange(PVD->getDefaultArgRange());
+      auto StartLoc = PVD->getLocation();
----------------
hokein wrote:
> just curious what's the `getDefaultArgRange` for case like `void foo(int a = 5)`, is it just `[[5]]`?
yes it is the range of the initializer.


================
Comment at: clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp:191
+      // it.
+      if (!PVD->getDeclName().isEmpty())
+        StartLoc =
----------------
hokein wrote:
> The approach seems fail on the following case,  StartLoc will point to `Foo`.
> 
> ```
>  class Bar { void func(int); };
>  void bind(const char*, void(Bar::*Foo)(int) = nullptr)
> ```
ah, right. switching to a similar strategy as D71188 to find first `=` before initializer.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71187





More information about the cfe-commits mailing list