[clangd][NFC] Use the existing ASTContext from scope
This commit is contained in:
parent
7212977fbb
commit
0473530281
|
@ -578,7 +578,7 @@ HoverInfo getHoverContents(const NamedDecl *D, const PrintingPolicy &PP,
|
|||
const SymbolIndex *Index,
|
||||
const syntax::TokenBuffer &TB) {
|
||||
HoverInfo HI;
|
||||
const ASTContext &Ctx = D->getASTContext();
|
||||
auto &Ctx = D->getASTContext();
|
||||
|
||||
HI.AccessSpecifier = getAccessSpelling(D->getAccess()).str();
|
||||
HI.NamespaceScope = getNamespaceScope(D);
|
||||
|
@ -614,20 +614,17 @@ HoverInfo getHoverContents(const NamedDecl *D, const PrintingPolicy &PP,
|
|||
if (const FunctionDecl *FD = getUnderlyingFunction(D))
|
||||
fillFunctionTypeAndParams(HI, D, FD, PP);
|
||||
else if (const auto *VD = dyn_cast<ValueDecl>(D))
|
||||
HI.Type = printType(VD->getType(), VD->getASTContext(), PP);
|
||||
HI.Type = printType(VD->getType(), Ctx, PP);
|
||||
else if (const auto *TTP = dyn_cast<TemplateTypeParmDecl>(D))
|
||||
HI.Type = TTP->wasDeclaredWithTypename() ? "typename" : "class";
|
||||
else if (const auto *TTP = dyn_cast<TemplateTemplateParmDecl>(D))
|
||||
HI.Type = printType(TTP, PP);
|
||||
else if (const auto *VT = dyn_cast<VarTemplateDecl>(D))
|
||||
HI.Type =
|
||||
printType(VT->getTemplatedDecl()->getType(), VT->getASTContext(), PP);
|
||||
HI.Type = printType(VT->getTemplatedDecl()->getType(), Ctx, PP);
|
||||
else if (const auto *TN = dyn_cast<TypedefNameDecl>(D))
|
||||
HI.Type = printType(TN->getUnderlyingType().getDesugaredType(Ctx),
|
||||
TN->getASTContext(), PP);
|
||||
HI.Type = printType(TN->getUnderlyingType().getDesugaredType(Ctx), Ctx, PP);
|
||||
else if (const auto *TAT = dyn_cast<TypeAliasTemplateDecl>(D))
|
||||
HI.Type = printType(TAT->getTemplatedDecl()->getUnderlyingType(),
|
||||
TAT->getASTContext(), PP);
|
||||
HI.Type = printType(TAT->getTemplatedDecl()->getUnderlyingType(), Ctx, PP);
|
||||
|
||||
// Fill in value with evaluated initializer if possible.
|
||||
if (const auto *Var = dyn_cast<VarDecl>(D)) {
|
||||
|
|
Loading…
Reference in a new issue