diff options
author | Matheus Izvekov <mizvekov@gmail.com> | 2024-05-22 12:18:44 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-22 12:18:44 -0300 |
commit | 2bde13cda1e389599413132028731f18fb5c03c3 (patch) | |
tree | 055429c600c8fbf084e714ac858d28ae4d9eaf2f /clang/lib/Index | |
parent | 30d484fa994577216736e797b6c6e74483a56641 (diff) | |
download | llvm-2bde13cda1e389599413132028731f18fb5c03c3.zip llvm-2bde13cda1e389599413132028731f18fb5c03c3.tar.gz llvm-2bde13cda1e389599413132028731f18fb5c03c3.tar.bz2 |
[clang] NFCI: use TemplateArgumentLoc for NTTP DefaultArgument (#92852)
This is an enabler for https://github.com/llvm/llvm-project/pull/92855
This allows an NTTP default argument to be set as an arbitrary
TemplateArgument, not just an expression.
This allows template parameter packs to have default arguments in the
AST, even though the language proper doesn't support the syntax for it.
This allows NTTP default arguments to be other kinds of arguments, like
packs, integral constants, and such.
Diffstat (limited to 'clang/lib/Index')
-rw-r--r-- | clang/lib/Index/IndexDecl.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Index/IndexDecl.cpp b/clang/lib/Index/IndexDecl.cpp index 058f4ae..a7fa6c5 100644 --- a/clang/lib/Index/IndexDecl.cpp +++ b/clang/lib/Index/IndexDecl.cpp @@ -711,7 +711,8 @@ public: } else if (const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(TP)) { IndexCtx.indexTypeSourceInfo(NTTP->getTypeSourceInfo(), Parent); if (NTTP->hasDefaultArgument()) - IndexCtx.indexBody(NTTP->getDefaultArgument(), Parent); + handleTemplateArgumentLoc(NTTP->getDefaultArgument(), Parent, + TP->getLexicalDeclContext()); } else if (const auto *TTPD = dyn_cast<TemplateTemplateParmDecl>(TP)) { if (TTPD->hasDefaultArgument()) handleTemplateArgumentLoc(TTPD->getDefaultArgument(), Parent, |