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

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 4 01:31:21 PDT 2019


sammccall accepted this revision.
sammccall added inline comments.


================
Comment at: clang-tools-extra/clangd/XRefs.cpp:657
 
+  auto ToFunctionDecl = [](const Decl *D) -> const FunctionDecl * {
+    // Extract lambda from variables.
----------------
can this be a separate function rather than a local lambda?

I think the name could be clearer, e.g. `getUnderlyingFunction`


================
Comment at: clang-tools-extra/clangd/unittests/XRefsTests.cpp:819
         )cpp",
        [](HoverInfo &HI) {
          HI.NamespaceScope = "";
----------------
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.


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