[PATCH] D70317: [clangd] More sensible output for constructors/destructors in hover.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 18 12:48:35 PST 2019


sammccall marked an inline comment as done.
sammccall added inline comments.


================
Comment at: clang-tools-extra/clangd/XRefs.cpp:598
+    // Constructor's "return type" is the class type.
+    HI.ReturnType = declaredType(CCD->getParent()).getAsString(Policy);
+    // Don't provide any type for the constructor itself.
----------------
hokein wrote:
> this looks reasonable though I'd prefer not setting the return type for ctor/dtor. If we decide to go down this path, we'd better make other "returnType" places (`Symbol::ReturnType`, CodeCompletion) align with this.
So code completion shows ~foo() as type void, and has no return type for constructors (including when it would matter for ranking!). Indexing code doesn't have a return type for either.
Per offline discussion, I'd rather fix those to include the type.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70317





More information about the cfe-commits mailing list