ilya-biryukov added a comment. In https://reviews.llvm.org/D53347#1267216, @kadircet wrote:
> LGTM, it bugs me that some part in the documentation says it doesn't go > through decltype(`This looks through declarators like pointer types, but not > through decltype or typedefs`) but since tests containing decltype didn't > break it looks OK to me. I would still wait for @hokein to have another look > as well. The decltypes are handled separately in `VisitDecltypeTypeLoc` and typedefs are a decl, so they are handled even before the visitor runs. This is only about 'auto'. So I think we're covered here. ================ Comment at: clangd/XRefs.cpp:592 - auto DeclT = UnwrapReferenceOrPointer(D->getType()); - const AutoType *AT = dyn_cast<AutoType>(DeclT.getTypePtr()); - if (AT && !AT->getDeducedType().isNull()) { - // For auto, use the underlying type because the const& would be - // represented twice: written in the code and in the hover. - // Example: "const auto I = 1", we only want "int" when hovering on auto, - // not "const int". - // - // For decltype(auto), take the type as is because it cannot be written - // with qualifiers or references but its decuded type can be const-ref. - DeducedType = AT->isDecltypeAuto() ? DeclT : DeclT.getUnqualifiedType(); - } + auto AT = D->getType()->getContainedAutoType(); + if (AT && !AT->getDeducedType().isNull()) ---------------- hokein wrote: > Maybe just > > ``` > if (auto* DT = D->getType()->getContainedDeducedType()) > DeducedType = *DT; > ``` > > ? It feels like explicitly unwrapping auto from the deduced type instead of relying the printer to do that is a bit more straightforward. Simplified code a bit per suggestions. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D53347 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits