[PATCH] D116502: [clangd] Helper for determining member insertion point.
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 3 01:21:46 PST 2022
kadircet added inline comments.
================
Comment at: clang-tools-extra/clangd/refactor/InsertionPoint.cpp:51
+ } else {
+ assert(A.Direction == Anchor::Below);
+ if (LastMatched && !Matches)
----------------
nit: use a switch?
================
Comment at: clang-tools-extra/clangd/refactor/InsertionPoint.cpp:134
+ // Fallback: insert at the end of the class. Check if protection matches!
+ if (Loc.isInvalid()) {
+ Loc = InClass.getBraceRange().getEnd();
----------------
what if we had:
```
class Foo {
public:
void foo();
};
```
and wanted to insert a `private` member/field?
I suppose we should check for the specifier of last decl in `InClass` instead.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116502/new/
https://reviews.llvm.org/D116502
More information about the cfe-commits
mailing list