[PATCH] D62814: [clangd] Treat lambdas as functions when preparing hover response

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 4 02:56:14 PDT 2019


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


================
Comment at: clang-tools-extra/clangd/unittests/XRefsTests.cpp:819
         )cpp",
        [](HoverInfo &HI) {
          HI.NamespaceScope = "";
----------------
sammccall wrote:
> I'm slightly nervous about the fact that "lambda" doesn't appear anywhere here.
> 
> e.g. maybe the Type should be "<lambda> bool(int, bool)" or so?
> Many lambdas are not interchangeable with "plain" functions references.
I've added the textual info to type. I don't think it is useful enough to put it as semantic info into the struct.

I believe it is rather a visual cue to the user, which seems pretty available in the "Type" field.


================
Comment at: clang-tools-extra/clangd/unittests/XRefsTests.cpp:831
+         };
          return HI;
        }},
----------------
ilya-biryukov wrote:
> Could you add another test with even weirder types where we fail to show the signature? To make sure we don't break when reaching the limitations of the chosen approach and document what those limitations are.
> 
> Something like:
> ```
> auto a = [](int a) { return 10; };
> auto *b = &a;
> auto *c = &b;
> ```
> 
> We would fail to show the signature here, but it's totally ok to ignore it.
added cases, and changed code(a lot simpler now) to generate signatures for those cases as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62814





More information about the cfe-commits mailing list