[PATCH] D110825: [clangd] Handle members of anon structs in SelectionTree

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 30 08:08:06 PDT 2021


sammccall added inline comments.


================
Comment at: clang-tools-extra/clangd/unittests/XRefsTests.cpp:368
 
+TEST(LocateSymbol, AnonymousStructFields) {
+  auto Code = Annotations(R"cpp(
----------------
kadircet wrote:
> sammccall wrote:
> > This example is quite complicated to the point where it's hard to see what it's testing... The example you have in the comment is much clearer.
> > 
> > If we also want to test named fields with inline struct types, maybe that should be a second test...
> it is actually important to demonstrate we are not claiming the whole range at the first encounter (and to make sure traversal is not stopped for any other reason).
Makes sense, but without comment it's not clear.
Can we make the latter a separate test case, and simplify it too? This seems to be enough:

```
struct [[Foo]] {
  struct { int x; }
};
int a = ^Foo{}.x;
```
Here the Foo{} is the non-empty base of the anon member access that must be traversed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110825



More information about the cfe-commits mailing list