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

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 9 04:46:35 PST 2019


hokein 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();
----------------
just curious what's the `getDefaultArgRange` for case like `void foo(int a = 5)`, is it just `[[5]]`?


================
Comment at: clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp:191
+      // it.
+      if (!PVD->getDeclName().isEmpty())
+        StartLoc =
----------------
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)
```


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