[PATCH] D68024: [clangd] Implement GetEligiblePoints

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 27 06:11:14 PDT 2019


kadircet marked 3 inline comments as done.
kadircet added inline comments.


================
Comment at: clang-tools-extra/clangd/SourceCode.cpp:997
+  // definitions as well. One might use a closing parantheses(")" followed by an
+  // opening brace "{" to trigger the start.
+  parseNamespaceEvents(Code, Style, [&](NamespaceEvent Event) {
----------------
hokein wrote:
> If I understand the FIXME well, so we will extend the API to parse functions, so that we could get a more eligible point e.g. near the near the neighboring declaration.
yes that's the idea. we'll try to provide as many valid insertion points as possible in the closest namespace.


================
Comment at: clang-tools-extra/clangd/SourceCode.h:273
+  /// definition.
+  std::vector<Position> EligiblePoints;
+};
----------------
hokein wrote:
> I'm curious how the caller use this, it seems that the caller has no/little information to distinguish all the positions, even for a simple case where we add a definition at the last eligible point (I assume just just using `EligiblePoints.back()`).
for example a caller with access to AST and Index, could first look at the decls surrounding the target(fully qualified name), then check for their definition locations using index and find an eligible point between these two.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68024





More information about the cfe-commits mailing list