This is an archive of the discontinued LLVM Phabricator instance.

[clangd] More sensible output for constructors/destructors in hover.
ClosedPublic

Authored by sammccall on Nov 15 2019, 8:26 AM.

Details

Summary

Previously: both had type void() and return type void.
Now: neither have a type. Constructors return T, destructors return void.

Diff Detail

Event Timeline

sammccall created this revision.Nov 15 2019, 8:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 15 2019, 8:26 AM

Build result: pass - 60137 tests passed, 0 failed and 729 were skipped.
Log files: console-log.txt, CMakeCache.txt

hokein added inline comments.Nov 18 2019, 1:28 AM
clang-tools-extra/clangd/XRefs.cpp
599

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.

clang-tools-extra/clangd/unittests/XRefsTests.cpp
914

nit: add a test case for destructor?

sammccall marked 2 inline comments as done.

Update tests and rebase

sammccall marked an inline comment as done.Nov 18 2019, 12:45 PM
sammccall added inline comments.
clang-tools-extra/clangd/XRefs.cpp
599

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.

Build result: pass - 60168 tests passed, 0 failed and 731 were skipped.
Log files: console-log.txt, CMakeCache.txt

hokein accepted this revision.Nov 19 2019, 1:16 AM
This revision is now accepted and ready to land.Nov 19 2019, 1:16 AM
This revision was automatically updated to reflect the committed changes.