[PATCH] D96612: [clangd] Improve printing of Objective-C categories and methods
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 15 10:19:26 PST 2021
sammccall added inline comments.
================
Comment at: clang-tools-extra/clangd/AST.cpp:224
+ if (const auto *C = dyn_cast<ObjCContainerDecl>(&ND))
+ return printObjCContainer(*C);
----------------
I'm not sure this fits with the contract of printName, which really is to print the name of the symbol rather than describe it.
Examples:
- the title of a hovercard for a method will be "instance-method `-[foo]`" instead of "instance-method `foo`", which is inconsistent with c/c++
- the title of a hovercard for a category will be "extension `PotentiallyLongClassName(CatName)`" instead of `extension ClassName`
- the documentSymbol response will include the extra details in the `name` field rather than the `detail` field
We don't actually populate `detail` in documentSymbol, so maybe we do need a separate function that gives that level of detail.
Though I wonder whether it should mosty just print the decl (e.g. `class X{};`, `@implementation PotentiallyLongClassName(CatName)` etc. WDYT?
See also https://github.com/clangd/clangd/issues/520 https://github.com/clangd/clangd/issues/601 though both appear to have stalled.
================
Comment at: clang-tools-extra/clangd/AST.cpp:228
+ Out << (Method->isInstanceMethod() ? '-' : '+');
+ Method->getSelector().print(Out);
+ return Out.str();
----------------
in the other patch this was with `-[brackets]`
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96612/new/
https://reviews.llvm.org/D96612
More information about the cfe-commits
mailing list