[PATCH] D71240: [clangd] Heuristically resolve dependent method calls

Nathan Ridge via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 12 14:15:21 PST 2019


nridge added inline comments.


================
Comment at: clang-tools-extra/clangd/FindTarget.cpp:278
+            });
+        for (const NamedDecl *D : Decls) {
+          Outer.add(D, Flags);
----------------
sammccall wrote:
> sammccall wrote:
> > can we make this function return the decls, and make the callers call add() in a loop?
> > 
> > That way this function could be reused for the `operator->` lookup, and could be a standalone helper function outside this class. (Maybe eventually exposed in AST.h, as I can imagine it being useful in other places, but static in this file seems fine)
> with multiple lookup results we could add all, discard all, or pick one arbitrarily.
> 
> I'm not sure what the best policy is, but it's worth pointing out in a comment what the cases are and what the choice is.
> 
> I think this should only affects overloads, where returning all seems reasonable (resolution would be way too much work).
> 
> Can you add a test?
Note, the additions to `LocateSymbol.Ambiguous` provide test coverage for this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71240





More information about the cfe-commits mailing list