diff options
author | Matheus Izvekov <mizvekov@gmail.com> | 2022-08-14 13:48:18 +0200 |
---|---|---|
committer | Matheus Izvekov <mizvekov@gmail.com> | 2022-10-15 22:08:36 +0200 |
commit | bcd9ba2b7e64f6ce54defd2fa73fc8e0fee5707c (patch) | |
tree | 4aaa7f816d36bfb0916cc0322984e780a4e2dce2 /clang/lib/Sema/SemaTemplateVariadic.cpp | |
parent | 0784de20e2ad5a91f07f952ae6d9887e380bccd6 (diff) | |
download | llvm-bcd9ba2b7e64f6ce54defd2fa73fc8e0fee5707c.zip llvm-bcd9ba2b7e64f6ce54defd2fa73fc8e0fee5707c.tar.gz llvm-bcd9ba2b7e64f6ce54defd2fa73fc8e0fee5707c.tar.bz2 |
[clang] Track the templated entity in type substitution.
This is a change to how we represent type subsitution in the AST.
Instead of only storing the replaced type, we track the templated
entity we are substituting, plus an index.
We modify MLTAL to track the templated entity at each level.
Otherwise, it's much more expensive to go from the template parameter back
to the templated entity, and not possible to do in some cases, as when
we instantiate outer templates, parameters might still reference the
original entity.
This also allows us to very cheaply lookup the templated entity we saw in
the naming context and find the corresponding argument it was replaced
from, such as for implementing template specialization resugaring.
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Differential Revision: https://reviews.llvm.org/D131858
Diffstat (limited to 'clang/lib/Sema/SemaTemplateVariadic.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplateVariadic.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaTemplateVariadic.cpp b/clang/lib/Sema/SemaTemplateVariadic.cpp index 4915b48..49c178b 100644 --- a/clang/lib/Sema/SemaTemplateVariadic.cpp +++ b/clang/lib/Sema/SemaTemplateVariadic.cpp @@ -720,7 +720,7 @@ bool Sema::CheckParameterPacksForExpansion( } else if (const auto *STP = P.dyn_cast<const SubstTemplateTypeParmPackType *>()) { NewPackSize = STP->getNumArgs(); - ND = STP->getReplacedParameter()->getDecl(); + ND = STP->getReplacedParameter(); } else { const auto *SEP = P.get<const SubstNonTypeTemplateParmPackExpr *>(); NewPackSize = SEP->getArgumentPack().pack_size(); |