[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 09:41:17 PDT 2021


sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

Thanks!



================
Comment at: clang-tools-extra/clangd/Selection.cpp:446
       return true;
+  // Make sure anonymous structs don't end up owning tokens.
+  if (auto *ME = llvm::dyn_cast<MemberExpr>(S)) {
----------------
hmm, "implicit accesses of anonymous structs"?


================
Comment at: clang-tools-extra/clangd/Selection.cpp:450
+      if (FD->isAnonymousStructOrUnion())
+        // If the base is not implicit, it can own tokens, otherwise we should
+        // stop traversal.
----------------
The double negatives and references to a "traversal" here seem confusing.
Maybe something more concrete?
```
// If Base is an implicit CXXThis, then the whole MemberExpr has no tokens.
// If it's a normal e.g. DeclRef, we treat the MemberExpr like an implicit cast.
```


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