[PATCH] D152645: [clangd] Handle DependentNameType in HeuristicResolver::resolveTypeToRecordDecl()
Nathan Ridge via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 16 00:12:41 PDT 2023
nridge added inline comments.
================
Comment at: clang-tools-extra/clangd/HeuristicResolver.cpp:56
+ if (const auto *DNT = T->getAs<DependentNameType>()) {
+ T = resolveDeclsToType(resolveDependentNameType(DNT));
+ if (!T)
----------------
hokein wrote:
> Is the `resolveDeclsToType` call necessary here?
> The code path we're doing is `dependent-type => Decl* => Type => Decl*`, the later two steps seems redundant, can we just use the Decl result from `resolveDependentNameType()`?
>
>
The Decl returned by `resolveDependentNameType()` in this testcase is a `TypeAliasDecl`. The function needs to return the `CXXRecordDecl` which is named by the target type of the alias.
We could add logic to "desugar" the `TypeAliasDecl`, but it seems easier to reuse the existing logic that does the desugaring in type-land.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152645/new/
https://reviews.llvm.org/D152645
More information about the cfe-commits
mailing list