|
Revision tags: llvmorg-21-init, llvmorg-19.1.7 |
|
| #
3972ed57 |
| 08-Jan-2025 |
Younan Zhang <zyn7109@gmail.com> |
Revert "[Clang] Implement CWG2369 "Ordering between constraints and substitution"" (#122130)
Unfortunately that breaks some code on Windows when lambdas come into play, as reported in https://github
Revert "[Clang] Implement CWG2369 "Ordering between constraints and substitution"" (#122130)
Unfortunately that breaks some code on Windows when lambdas come into play, as reported in https://github.com/llvm/llvm-project/pull/102857#issuecomment-2577861178
This reverts commit 96eced624e0f120155256033fdcb8342e7e58d6e.
show more ...
|
| #
96eced62 |
| 05-Jan-2025 |
Younan Zhang <zyn7109@gmail.com> |
[Clang] Implement CWG2369 "Ordering between constraints and substitution" (#102857)
This patch partially implements CWG2369 for non-lambda-constrained functions.
Lambdas are left intact at this poi
[Clang] Implement CWG2369 "Ordering between constraints and substitution" (#102857)
This patch partially implements CWG2369 for non-lambda-constrained functions.
Lambdas are left intact at this point because we need extra work to correctly instantiate captures before the function instantiation.
As a premise of CWG2369, this patch also implements CWG2770 to ensure the function parameters are instantiated on demand.
Closes https://github.com/llvm/llvm-project/issues/54440
show more ...
|
|
Revision tags: llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4 |
|
| #
adb0d8dd |
| 07-Nov-2024 |
Younan Zhang <zyn7109@gmail.com> |
[Clang] Distinguish expanding-pack-in-place cases for SubstTemplateTypeParmTypes (#114220)
In 50e5411e4, we preserved the pack substitution index within
SubstTemplateTypeParmType nodes and performe
[Clang] Distinguish expanding-pack-in-place cases for SubstTemplateTypeParmTypes (#114220)
In 50e5411e4, we preserved the pack substitution index within
SubstTemplateTypeParmType nodes and performed in-place expansions of
packs such that type constraints on a lambda that serve as a pattern of
a fold expression could be evaluated if the type constraints contain any
packs that are expanded by the fold expression.
However, we made an incorrect assumption of the condition under which
in-place expansion should occur. For example, a SizeOfPackExpr case
relies on SubstTemplateTypeParmType nodes being transformed to
SubstTemplateTypeParmPackTypes rather than expanding them immediately in
place.
This fixes that by adding a flag to SubstTemplateTypeParmType to
discriminate such in-place expansion situations.
Fixes https://github.com/llvm/llvm-project/issues/113518
show more ...
|
|
Revision tags: llvmorg-19.1.3, llvmorg-19.1.2 |
|
| #
0bc02b99 |
| 11-Oct-2024 |
Younan Zhang <zyn7109@gmail.com> |
[Clang] Instantiate Typedefs referenced by type alias deduction guides (#111804)
TypedefNameDecl referenced by a synthesized CTAD guide for type aliases
was not transformed previously, resulting in
[Clang] Instantiate Typedefs referenced by type alias deduction guides (#111804)
TypedefNameDecl referenced by a synthesized CTAD guide for type aliases
was not transformed previously, resulting in a substitution failure in
BuildDeductionGuideForTypeAlias() when substituting into the
right-hand-side deduction guide.
This patch fixes it in the way we have been doing since
https://reviews.llvm.org/D80743. We transform all the function
parameters, parenting referenced TypedefNameDecls with the
CXXDeductionGuideDecl. Then we instantiate these declarations in
FindInstantiatedDecl() as we build up the eventual deduction guide,
using the mechanism introduced in D80743
Fixes #111508
show more ...
|
|
Revision tags: llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init |
|
| #
c7bfc418 |
| 22-Jul-2024 |
Younan Zhang <zyn7109@gmail.com> |
[Clang][NFCI] Prefer non-canonical template arguments for synthesized CTAD guides (#99840)
This seems to be low-hanging fruit: We could remove all calls to
`Context.getCanonicalTemplateArgument()`
[Clang][NFCI] Prefer non-canonical template arguments for synthesized CTAD guides (#99840)
This seems to be low-hanging fruit: We could remove all calls to
`Context.getCanonicalTemplateArgument()` and gain a better
diagnostic/AST.
The non-canonical template arguments shouldn't make a difference when
synthesizing a CTAD guide, so this is intended to be an NFC.
Closes https://github.com/llvm/llvm-project/issues/79798
show more ...
|
| #
1205371a |
| 10-Jul-2024 |
Haojian Wu <hokein.wu@gmail.com> |
[clang] CTAD: Generate deduction guides for alias templates from non-template explicit deduction guides (#96686)
This patch addresses an issue where non-template explicit deduction
guides were not
[clang] CTAD: Generate deduction guides for alias templates from non-template explicit deduction guides (#96686)
This patch addresses an issue where non-template explicit deduction
guides were not considered when synthesized the deduction guides for
alias templates.
Fixes #94927.
show more ...
|
| #
834ecc8b |
| 04-Jul-2024 |
Haojian Wu <hokein.wu@gmail.com> |
[clang] CTAD alias: fix transformation for require-clause expr Part2. (#93533)
In the https://github.com/llvm/llvm-project/pull/90961 fix, we miss a
case where the undeduced template parameters of
[clang] CTAD alias: fix transformation for require-clause expr Part2. (#93533)
In the https://github.com/llvm/llvm-project/pull/90961 fix, we miss a
case where the undeduced template parameters of the underlying deduction
guide are not transformed, which leaves incorrect depth/index
information, and causes crashes when evaluating constraints.
This patch fix this missing case.
Fixes #92596
Fixes #92212
show more ...
|
| #
3b639d7d |
| 02-Jul-2024 |
Younan Zhang <zyn7109@gmail.com> |
[Clang] Clarify diagnostic notes for implicitly generated deduction guides (#96084)
Given the following invalid code,
```cpp
template <class T>
struct S {
T *a;
};
S s = {1};
```
we produc
[Clang] Clarify diagnostic notes for implicitly generated deduction guides (#96084)
Given the following invalid code,
```cpp
template <class T>
struct S {
T *a;
};
S s = {1};
```
we produce such diagnostics currently:
```
<source>:2:8: note: candidate template ignored: could not match 'S<T>' against 'int'
2 | struct S {
| ^
<source>:2:8: note: candidate template ignored: could not match 'T *' against 'int'
```
Which I think is confusing because there's no `S<T>` nor `T *` at the
location it points to. This is because we're deducing the initializer
against implicitly generated deduction guides, and their source
locations just point to the corresponding `RecordDecl`. Hence the
misleading notes.
This patch alleviates the issue by adding extra notes demonstrating
which implicit deduction guide we're deducing against. In other words,
in addition to the note of `could not match 'T *' against 'int'`, we
would also say the implicit deduction guide we're trying to use:
`template <class T> S(T *) -> S<T>`, which looks clearer IMO.
---------
Co-authored-by: Sirraide <aeternalmail@gmail.com>
show more ...
|
|
Revision tags: llvmorg-18.1.8, llvmorg-18.1.7 |
|
| #
01f143dd |
| 23-May-2024 |
Matheus Izvekov <mizvekov@gmail.com> |
[clang] fix printing of canonical template template parameters (#93124)
|
| #
1553b21f |
| 20-May-2024 |
Haojian Wu <hokein.wu@gmail.com> |
[clang] CTAD alias: Fix missing template arg packs during the transformation (#92535)
clang rejects some valid code (see testcases) because of an incorrect
transformed deduction guides. This patch
[clang] CTAD alias: Fix missing template arg packs during the transformation (#92535)
clang rejects some valid code (see testcases) because of an incorrect
transformed deduction guides. This patch fixes it.
We miss the template argument packs during the transformation (`auto
(type-parameter-0-0...) -> Foo<>`). In
`TreeTransform::TransformTemplateArguments `, we have a logic of
handling template argument packs which were originally added to support
CTAD alias, it doesn't seem to be needed, we need to unpack them.
show more ...
|
|
Revision tags: llvmorg-18.1.6 |
|
| #
fe4d5f0d |
| 16-May-2024 |
Matheus Izvekov <mizvekov@gmail.com> |
[clang] NFC: stray space cleanup
|
| #
f210152e |
| 16-May-2024 |
Matheus Izvekov <mizvekov@gmail.com> |
[clang] constrain `SemaCXX/cxx20-ctad-type-alias.cpp` target triple
The test expectations are otherwise affected by the underlying type of size_t.
|
| #
a383b3cc |
| 16-May-2024 |
Haojian Wu <hokein.wu@gmail.com> |
[clang] CTAD alias: Emit a more descriptive diagnostic message when is_deducible constraint is evaluated to false. (#92389)
Fixes https://github.com/llvm/llvm-project/issues/92225
|
| #
a9605730 |
| 16-May-2024 |
Haojian Wu <hokein.wu@gmail.com> |
[clang] CTAD: implement the missing IsDeducible constraint for alias templates (#89358)
Fixes https://github.com/llvm/llvm-project/issues/85192
Fixes https://github.com/llvm/llvm-project/issues/84
[clang] CTAD: implement the missing IsDeducible constraint for alias templates (#89358)
Fixes https://github.com/llvm/llvm-project/issues/85192
Fixes https://github.com/llvm/llvm-project/issues/84492
This patch implements the "IsDeducible" constraint where the template
arguments of the alias template can be deduced from the returned type of
the synthesized deduction guide, per C++ [over.match.class.deduct]p4. In
the implementation, we perform the deduction directly, which is more
efficient than the way specified in the standard.
Also update relevant CTAD tests which were incorrectly compiled due to
the missing constraint.
show more ...
|
| #
d182877b |
| 13-May-2024 |
Haojian Wu <hokein.wu@gmail.com> |
[clang] CTAD alias: fix the transformation for the require-clause expr (#90961)
In the clang AST, constraint nodes are deliberately not instantiated
unless they are actively being evaluated. Conseq
[clang] CTAD alias: fix the transformation for the require-clause expr (#90961)
In the clang AST, constraint nodes are deliberately not instantiated
unless they are actively being evaluated. Consequently, occurrences of
template parameters in the require-clause expression have a subtle
"depth" difference compared to normal occurrences in places, such as
function parameters. When transforming the require-clause, we must take
this distinction into account.
The existing implementation overlooks this consideration. This patch is
to rewrite the implementation of the require-clause transformation to
address this issue.
Fixes #90177
show more ...
|
| #
27becf0c |
| 07-May-2024 |
Haojian Wu <hokein.wu@gmail.com> |
[clang] CTAD: fix the aggregate deduction guide for alias templates. (#90894)
For alias templates, our current way of constructing their aggregate
deduction guides deviates from the standard approa
[clang] CTAD: fix the aggregate deduction guide for alias templates. (#90894)
For alias templates, our current way of constructing their aggregate
deduction guides deviates from the standard approach. We should align it
with how we handle implicit deduction guides.
This patch has a refactoring change which pulls the construction logic
out from `DeclareImplicitDeductionGuidesForTypeAlia` and reusing it for
building aggregate deduction guides.
show more ...
|
|
Revision tags: llvmorg-18.1.5 |
|
| #
57c24eb0 |
| 22-Apr-2024 |
Haojian Wu <hokein.wu@gmail.com> |
Reland "[clang] CTAD: Fix require-clause is not transformed." (#89476)
This relands the c8e65e193d542464421ad4f9a9965d45b302ac0c, which was reverted in b48ea2d394911efcc56880fde58f806282db1e8a due t
Reland "[clang] CTAD: Fix require-clause is not transformed." (#89476)
This relands the c8e65e193d542464421ad4f9a9965d45b302ac0c, which was reverted in b48ea2d394911efcc56880fde58f806282db1e8a due to the breakage of windows builtbot.
The reland contains some adjustments in the lit test deduction-gudie.cpp, to make the checking text less strict.
show more ...
|
| #
b48ea2d3 |
| 20-Apr-2024 |
Mehdi Amini <joker.eph@gmail.com> |
Revert "[clang] CTAD: Fix require-clause is not transformed." (#89476)
Reverts llvm/llvm-project#89378
Broke the windows premerge checks
https://lab.llvm.org/buildbot/#/builders/271/builds/6788
|
| #
c8e65e19 |
| 19-Apr-2024 |
Haojian Wu <hokein.wu@gmail.com> |
[clang] CTAD: Fix require-clause is not transformed. (#89378)
Fixes https://github.com/llvm/llvm-project/issues/89013
When building the deduction guide, we use the
TemplateArgsForBuildingFPrime
[clang] CTAD: Fix require-clause is not transformed. (#89378)
Fixes https://github.com/llvm/llvm-project/issues/89013
When building the deduction guide, we use the
TemplateArgsForBuildingFPrime to transform the require-clause from the
underlying class deduction guide. However, we do this at the wrong place
where not all elements of TemplateArgsForBuildingFPrime are initialized.
The fix involves rearranging the transformRequireClause call to the
correct location.
As part of the fix, we extend the TemplateInstantiator to support more
types in the template-rewrite mode. Otherwise, we will encounter an
assertion error when attempting to rewrite the template type parameter
type like D with a complex type like Derived<U>.
show more ...
|
| #
4c3514fa |
| 18-Apr-2024 |
Haojian Wu <hokein.wu@gmail.com> |
[clang] Fix a "!CodeSynthesisContexts.empty()" assertion failure when constructing aggregate deduction guides. (#89227)
We were missing to push an record to the instantiation stack in
`DeclareAggre
[clang] Fix a "!CodeSynthesisContexts.empty()" assertion failure when constructing aggregate deduction guides. (#89227)
We were missing to push an record to the instantiation stack in
`DeclareAggregateDeductionGuideForTypeAlias`. This patch fixes that.
show more ...
|
|
Revision tags: llvmorg-18.1.4, llvmorg-18.1.3 |
|
| #
0b9528d6 |
| 02-Apr-2024 |
Haojian Wu <hokein.wu@gmail.com> |
[clang] CTAD: Track template template type parameters that referenced in the template arguments of the RHS. (#85405)
Fixes https://github.com/llvm/llvm-project/issues/85385.
The Finder was missin
[clang] CTAD: Track template template type parameters that referenced in the template arguments of the RHS. (#85405)
Fixes https://github.com/llvm/llvm-project/issues/85385.
The Finder was missing for this case, for the crash test, the template
parameter TTP was incorrectly considered as not referenced/appeared in
the template arguments of the right hand side of the alias template
decl, thus the synthesized deduction decl doesn't contain this TTP in
the template parameter list, but we have references in the declaration,
thus it caused crashes.
show more ...
|
| #
63ea5a40 |
| 28-Mar-2024 |
Haojian Wu <hokein.wu@gmail.com> |
[clang] Invalidate the alias template decl if it has multiple written template parameter lists. (#85413)
Fixes #85406.
- Set the invalid bit for alias template decl where it has multiple
written
[clang] Invalidate the alias template decl if it has multiple written template parameter lists. (#85413)
Fixes #85406.
- Set the invalid bit for alias template decl where it has multiple
written template parameter lists (as the AST node is ill-formed)
- don't perform CTAD for invalid alias template decls
show more ...
|
|
Revision tags: llvmorg-18.1.2 |
|
| #
0be9592b |
| 13-Mar-2024 |
Haojian Wu <hokein.wu@gmail.com> |
[clang] CTAD: Respect requires-clause of the original function template for the synthesized deduction guide (#84913)
We ignored the require-clause of the original template when building the deductio
[clang] CTAD: Respect requires-clause of the original function template for the synthesized deduction guide (#84913)
We ignored the require-clause of the original template when building the deduction guide for type-alias CTAD, this resulted in accepting code which should be rejected (see the test case). This patch fixes it, part of #84492.
show more ...
|
| #
7415524b |
| 08-Mar-2024 |
Haojian Wu <hokein.wu@gmail.com> |
[clang] Implement CTAD for type alias template. (#77890)
Fixes #54051
This patch implements the C++20 feature -- CTAD for alias templates (P1814R0, specified in https://eel.is/c++draft/over.match
[clang] Implement CTAD for type alias template. (#77890)
Fixes #54051
This patch implements the C++20 feature -- CTAD for alias templates (P1814R0, specified in https://eel.is/c++draft/over.match.class.deduct#3). It is an initial patch:
- it cover major pieces, thus it works for most cases;
- the big missing piece is to implement the associated constraints (over.match.class.deduct#3.3) for the synthesized deduction guides, see the FIXME in code and tests;
- Some enhancements on the TreeTransform&TemplateInstantiator to allow performing instantiation on `BuildingDeductionGuides` mode;
show more ...
|