diff options
author | Matheus Izvekov <mizvekov@gmail.com> | 2025-04-01 21:11:56 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-01 21:11:56 -0300 |
commit | ad1ca5f4a2bc09f99fd82e5444f5da37c2985e97 (patch) | |
tree | 9d393f3b37d398a8c3bdcc52f68bbeed93773cfe /clang/lib/Sema/SemaCodeComplete.cpp | |
parent | 2f25345670081f1ca460ea3f42a0585ef3f1e877 (diff) | |
download | llvm-ad1ca5f4a2bc09f99fd82e5444f5da37c2985e97.zip llvm-ad1ca5f4a2bc09f99fd82e5444f5da37c2985e97.tar.gz llvm-ad1ca5f4a2bc09f99fd82e5444f5da37c2985e97.tar.bz2 |
[clang] Concepts: support pack expansions for type constraints (#132626)
This reverts an earlier attempt
(adb0d8ddceb143749c519d14b8b31b481071da77 and
50e5411e4247421fd606f0a206682fcdf0303ae3) to support these expansions,
which was limited to type arguments and which subverted the purpose
of SubstTemplateTypeParmType.
This propagates the ArgumentPackSubstitutionIndex along with the
AssociatedConstraint, so that the pack expansion works, without
needing any new transforms or otherwise any changes to the template
instantiation process.
This keeps the tests from the reverted commits, and adds a few more
showing the new solution also works for NTTPs.
Fixes https://github.com/llvm/llvm-project/issues/131798
Diffstat (limited to 'clang/lib/Sema/SemaCodeComplete.cpp')
-rw-r--r-- | clang/lib/Sema/SemaCodeComplete.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index 54cafc2..44a49a6 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -5463,8 +5463,9 @@ public: // that T is attached to in order to gather the relevant constraints. ConceptInfo(const TemplateTypeParmType &BaseType, Scope *S) { auto *TemplatedEntity = getTemplatedEntity(BaseType.getDecl(), S); - for (const Expr *E : constraintsForTemplatedEntity(TemplatedEntity)) - believe(E, &BaseType); + for (const AssociatedConstraint &AC : + constraintsForTemplatedEntity(TemplatedEntity)) + believe(AC.ConstraintExpr, &BaseType); } std::vector<Member> members() { @@ -5696,9 +5697,9 @@ private: // Gets all the type constraint expressions that might apply to the type // variables associated with DC (as returned by getTemplatedEntity()). - static SmallVector<const Expr *, 1> + static SmallVector<AssociatedConstraint, 1> constraintsForTemplatedEntity(DeclContext *DC) { - SmallVector<const Expr *, 1> Result; + SmallVector<AssociatedConstraint, 1> Result; if (DC == nullptr) return Result; // Primary templates can have constraints. |