[clang-tools-extra] [clangd] Add inlay hints for default function arguments and implicit lambda captures (PR #95712)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Sun Jun 16 22:37:38 PDT 2024
================
@@ -755,12 +807,34 @@ class InlayHintVisitor : public RecursiveASTVisitor<InlayHintVisitor> {
bool NameHint = shouldHintName(Args[I], Name);
bool ReferenceHint = shouldHintReference(Params[I], ForwardedParams[I]);
+ bool IsDefault = isa<CXXDefaultArgExpr>(Args[I]);
+ HasNonDefaultArgs |= !IsDefault;
+ if (Cfg.InlayHints.DefaultArguments && IsDefault) {
+ auto SourceText = Lexer::getSourceText(
+ CharSourceRange::getTokenRange(Params[I]->getDefaultArgRange()),
+ Callee.Decl->getASTContext().getSourceManager(),
+ Callee.Decl->getASTContext().getLangOpts());
----------------
zyn0217 wrote:
You don't have to query `Decl::getASTContext()` for the ASTContext, we have one in `InlayHintVisitor`.
https://github.com/llvm/llvm-project/pull/95712
More information about the cfe-commits
mailing list