[PATCH] D92041: [clangd] Add hover info for `this` expr
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 11 02:30:21 PST 2020
sammccall added a comment.
In D92041#2448176 <https://reviews.llvm.org/D92041#2448176>, @xndcn wrote:
> In D92041#2446366 <https://reviews.llvm.org/D92041#2446366>, @sammccall wrote:
>
>> Sorry for the delay here. Kadir is out on vacation.
>>
>> Yikes - it's a shame reusing our existing type printing doesn't do the right thing, but injected-classname and partial specializations are indeed weird.
>> I'm tempted to say just to live with the "type-parameter-0-0" nonsense rather than implement the workaround, but it's up to you.
>
> Got it, thanks.
> The weird string only happens in injected-classname and partial specialization, maybe we can add a PrintPolicy so that TypePrinter can handle this case? I have tried to extract template arguments by casting the injected-class to `ClassTemplatePartialSpecializationDecl`, and it seems work well.
Oh, I forgot... we added `declaredType()` in AST.h - you pass in a TypeDecl and get out a `QualType`... but it should handle CTPSDecl correctly.
So something like:
Pointee = Thisexpr->getpointeetype
ClassDecl = Pointee->getAsTagDecl
ClassType = declaredType(ClassDecl)
PrettyThisType = ASTContext.getPointerType(QualType(ClassType.getTypePtr(), Pointee.getCVQualifiers()));
then render PrettyThisType?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92041/new/
https://reviews.llvm.org/D92041
More information about the cfe-commits
mailing list