mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-18 19:16:43 +00:00
[clang] Reland: Instantiate alias templates with sugar (#101858)
This makes use of the changes introduced in D134604, in order to instantiate alias templates witn a final sugared substitution. This comes at no additional relevant cost. Since we don't track / unique them in specializations, we wouldn't be able to resugar them later anyway. Differential Revision: https://reviews.llvm.org/D136565
This commit is contained in:
parent
748371183a
commit
7f78f99fe5
@ -1325,7 +1325,7 @@ class Foo final {})cpp";
|
||||
HI.LocalScope = "";
|
||||
HI.Kind = index::SymbolKind::TypeAlias;
|
||||
HI.Definition = "template <typename T> using AA = A<T>";
|
||||
HI.Type = {"A<T>", "type-parameter-0-0"}; // FIXME: should be 'T'
|
||||
HI.Type = {"A<T>", "T"};
|
||||
HI.TemplateParameters = {
|
||||
{{"typename"}, std::string("T"), std::nullopt}};
|
||||
}},
|
||||
|
@ -76,7 +76,7 @@ T qux(T Generic) {
|
||||
async::Future<T> TemplateType;
|
||||
// CHECK-MESSAGES: :[[@LINE-1]]:22: warning: unused local variable 'TemplateType' of type 'async::Future<T>' [bugprone-unused-local-non-trivial-variable]
|
||||
a::Future<T> AliasTemplateType;
|
||||
// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: unused local variable 'AliasTemplateType' of type 'a::Future<T>' (aka 'Future<type-parameter-0-0>') [bugprone-unused-local-non-trivial-variable]
|
||||
// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: unused local variable 'AliasTemplateType' of type 'a::Future<T>' (aka 'Future<T>') [bugprone-unused-local-non-trivial-variable]
|
||||
[[maybe_unused]] async::Future<Units> MaybeUnused;
|
||||
return Generic;
|
||||
}
|
||||
|
@ -149,6 +149,8 @@ Improvements to Clang's diagnostics
|
||||
|
||||
- -Wdangling-assignment-gsl is enabled by default.
|
||||
- Clang now does a better job preserving the template arguments as written when specializing concepts.
|
||||
- Clang now always preserves the template arguments as written used
|
||||
to specialize template type aliases.
|
||||
|
||||
Improvements to Clang's time-trace
|
||||
----------------------------------
|
||||
|
@ -3334,8 +3334,8 @@ QualType Sema::CheckTemplateIdType(TemplateName Name,
|
||||
|
||||
// Only substitute for the innermost template argument list.
|
||||
MultiLevelTemplateArgumentList TemplateArgLists;
|
||||
TemplateArgLists.addOuterTemplateArguments(Template, CanonicalConverted,
|
||||
/*Final=*/false);
|
||||
TemplateArgLists.addOuterTemplateArguments(Template, SugaredConverted,
|
||||
/*Final=*/true);
|
||||
TemplateArgLists.addOuterRetainedLevels(
|
||||
AliasTemplate->getTemplateParameters()->getDepth());
|
||||
|
||||
|
@ -123,8 +123,6 @@ using type2 = typename C<int>::type1<void>;
|
||||
// CHECK-NEXT: TemplateArgument type 'void'
|
||||
// CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'void'
|
||||
// CHECK-NEXT: FunctionProtoType 0x{{[^ ]*}} 'void (int)' cdecl
|
||||
// CHECK-NEXT: SubstTemplateTypeParmType 0x{{[^ ]*}} 'void' sugar class depth 0 index 0 U
|
||||
// CHECK-NEXT: TypeAliasTemplate 0x{{[^ ]*}} 'type1'
|
||||
// CHECK-NEXT: BuiltinType 0x{{[^ ]*}} 'void'
|
||||
// CHECK-NEXT: SubstTemplateTypeParmType 0x{{[^ ]*}} 'int' sugar class depth 0 index 0 T
|
||||
// CHECK-NEXT: ClassTemplateSpecialization 0x{{[^ ]*}} 'C'
|
||||
@ -132,39 +130,24 @@ using type2 = typename C<int>::type1<void>;
|
||||
} // namespace PR55886
|
||||
|
||||
namespace PR56099 {
|
||||
template <typename... As> struct Y;
|
||||
template <typename... Bs> using Z = Y<Bs...>;
|
||||
template <typename... Cs> struct foo {
|
||||
template <typename... Ds> using bind = Z<Ds..., Cs...>;
|
||||
};
|
||||
using t1 = foo<int, short>::bind<char, float>;
|
||||
// CHECK: TemplateSpecializationType 0x{{[^ ]*}} 'Y<char, float, int, short>' sugar
|
||||
// CHECK: SubstTemplateTypeParmType 0x{{[^ ]*}} 'char' sugar typename depth 0 index 0 ... Bs pack_index 3
|
||||
// CHECK-NEXT: TypeAliasTemplate 0x{{[^ ]*}} 'Z'
|
||||
// CHECK: SubstTemplateTypeParmType 0x{{[^ ]*}} 'float' sugar typename depth 0 index 0 ... Bs pack_index 2
|
||||
// CHECK-NEXT: TypeAliasTemplate 0x{{[^ ]*}} 'Z'
|
||||
// CHECK: SubstTemplateTypeParmType 0x{{[^ ]*}} 'int' sugar typename depth 0 index 0 ... Bs pack_index 1
|
||||
// CHECK-NEXT: TypeAliasTemplate 0x{{[^ ]*}} 'Z'
|
||||
// CHECK: SubstTemplateTypeParmType 0x{{[^ ]*}} 'short' sugar typename depth 0 index 0 ... Bs pack_index 0
|
||||
// CHECK-NEXT: TypeAliasTemplate 0x{{[^ ]*}} 'Z'
|
||||
|
||||
template <typename... T> struct D {
|
||||
template <typename... U> using B = int(int (*...p)(T, U));
|
||||
template <typename... U> struct bind {
|
||||
using bound_type = int(int (*...p)(T, U));
|
||||
};
|
||||
};
|
||||
using t2 = D<float, char>::B<int, short>;
|
||||
// CHECK: TemplateSpecializationType 0x{{[^ ]*}} 'B<int, short>' sugar alias{{$}}
|
||||
// CHECK-NEXT: name: 'D<float, char>::B':'PR56099::D<float, char>::B' qualified
|
||||
template struct D<float, char>::bind<int, short>;
|
||||
// CHECK: TypeAliasDecl 0x{{[^ ]*}} <line:{{[1-9]+}}:5, col:45> col:11 bound_type 'int (int (*)(float, int), int (*)(char, short))'
|
||||
// CHECK: FunctionProtoType 0x{{[^ ]*}} 'int (int (*)(float, int), int (*)(char, short))' cdecl
|
||||
// CHECK: FunctionProtoType 0x{{[^ ]*}} 'int (float, int)' cdecl
|
||||
// CHECK: SubstTemplateTypeParmType 0x{{[^ ]*}} 'float' sugar typename depth 0 index 0 ... T pack_index 1
|
||||
// CHECK-NEXT: ClassTemplateSpecialization 0x{{[^ ]*}} 'D'
|
||||
// CHECK: SubstTemplateTypeParmType 0x{{[^ ]*}} 'int' sugar typename depth 0 index 0 ... U pack_index 1
|
||||
// CHECK-NEXT: TypeAliasTemplate 0x{{[^ ]*}} 'B'
|
||||
// CHECK-NEXT: ClassTemplateSpecialization 0x{{[^ ]*}} 'bind'
|
||||
// CHECK: FunctionProtoType 0x{{[^ ]*}} 'int (char, short)' cdecl
|
||||
// CHECK: SubstTemplateTypeParmType 0x{{[^ ]*}} 'char' sugar typename depth 0 index 0 ... T pack_index 0
|
||||
// CHECK-NEXT: ClassTemplateSpecialization 0x{{[^ ]*}} 'D'
|
||||
// CHECK: SubstTemplateTypeParmType 0x{{[^ ]*}} 'short' sugar typename depth 0 index 0 ... U pack_index 0
|
||||
// CHECK-NEXT: TypeAliasTemplate 0x{{[^ ]*}} 'B'
|
||||
// CHECK-NEXT: ClassTemplateSpecialization 0x{{[^ ]*}} 'bind'
|
||||
} // namespace PR56099
|
||||
|
||||
namespace subst_default_argument {
|
||||
@ -178,9 +161,7 @@ using test1 = D<E, int>;
|
||||
// CHECK-NEXT: |-name: 'A':'subst_default_argument::A' qualified
|
||||
// CHECK-NEXT: | `-ClassTemplateDecl {{.+}} A
|
||||
// CHECK-NEXT: |-TemplateArgument type 'int'
|
||||
// CHECK-NEXT: | `-SubstTemplateTypeParmType 0x{{[^ ]*}} 'int' sugar class depth 0 index 1 D2
|
||||
// CHECK-NEXT: | |-TypeAliasTemplate 0x{{[^ ]*}} 'D'
|
||||
// CHECK-NEXT: | `-BuiltinType 0x{{[^ ]*}} 'int'
|
||||
// CHECK-NEXT: | `-BuiltinType 0x{{[^ ]*}} 'int'
|
||||
// CHECK-NEXT: `-RecordType 0x{{[^ ]*}} 'subst_default_argument::A<int>'
|
||||
// CHECK-NEXT: `-ClassTemplateSpecialization 0x{{[^ ]*}} 'A'
|
||||
} // namespace subst_default_argument
|
||||
|
@ -33,7 +33,7 @@ template<template<typename> typename TT> struct E { // expected-note 2{{template
|
||||
};
|
||||
|
||||
A(int) -> int; // expected-error {{deduced type 'int' of deduction guide is not a specialization of template 'A'}}
|
||||
template<typename T> A(T) -> B<T>; // expected-error {{deduced type 'B<T>' (aka 'A<type-parameter-0-0>') of deduction guide is not written as a specialization of template 'A'}}
|
||||
template <typename T> A(T)->B<T>; // expected-error {{deduced type 'B<T>' (aka 'A<T>') of deduction guide is not written as a specialization of template 'A'}}
|
||||
template<typename T> A(T*) -> const A<T>; // expected-error {{deduced type 'const A<T>' of deduction guide is not a specialization of template 'A'}}
|
||||
|
||||
// A deduction-guide shall be declared in the same scope as the corresponding
|
||||
|
@ -257,25 +257,22 @@ int f9(S9<int, char, U9<const double>>);
|
||||
int k9 = f9(V9<double>());
|
||||
|
||||
// CHECK-ELIDE-NOTREE: no matching function for call to 'f9'
|
||||
// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'S9<[2 * ...], S9<[2 * ...], double>>' to 'S9<[2 * ...], S9<[2 * ...], const double>>' for 1st argument
|
||||
// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'S9<[2 * ...], U9<double>>' to 'S9<[2 * ...], U9<const double>>' for 1st argument
|
||||
// CHECK-NOELIDE-NOTREE: no matching function for call to 'f9'
|
||||
// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'S9<int, char, S9<int, char, double>>' to 'S9<int, char, S9<int, char, const double>>' for 1st argument
|
||||
// CHECK-NOELIDE-NOTREE: candidate function not viable: no known conversion from 'S9<int, char, U9<double>>' to 'S9<int, char, U9<const double>>' for 1st argument
|
||||
// CHECK-ELIDE-TREE: no matching function for call to 'f9'
|
||||
// CHECK-ELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
|
||||
// CHECK-ELIDE-TREE: S9<
|
||||
// CHECK-ELIDE-TREE: [2 * ...],
|
||||
// CHECK-ELIDE-TREE: S9<
|
||||
// CHECK-ELIDE-TREE: [2 * ...],
|
||||
// CHECK-ELIDE-TREE: [double != const double]>>
|
||||
// CHECK-ELIDE-TREE: [2 * ...],
|
||||
// CHECK-ELIDE-TREE: U9<
|
||||
// CHECK-ELIDE-TREE: [(no qualifiers) != const] double>>
|
||||
// CHECK-NOELIDE-TREE: no matching function for call to 'f9'
|
||||
// CHECK-NOELIDE-TREE: candidate function not viable: no known conversion from argument type to parameter type for 1st argument
|
||||
// CHECK-NOELIDE-TREE: S9<
|
||||
// CHECK-NOELIDE-TREE: int,
|
||||
// CHECK-NOELIDE-TREE: char,
|
||||
// CHECK-NOELIDE-TREE: S9<
|
||||
// CHECK-NOELIDE-TREE: int,
|
||||
// CHECK-NOELIDE-TREE: char,
|
||||
// CHECK-NOELIDE-TREE: [double != const double]>>
|
||||
// CHECK-NOELIDE-TREE: int,
|
||||
// CHECK-NOELIDE-TREE: char,
|
||||
// CHECK-NOELIDE-TREE: U9<
|
||||
// CHECK-NOELIDE-TREE: [(no qualifiers) != const] double>>
|
||||
|
||||
template<typename ...A> class class_types {};
|
||||
void set10(class_types<int, int>) {}
|
||||
|
@ -98,7 +98,7 @@ void test_accepts_nonnull_null_pointer_literal(X *x) {
|
||||
accepts_nonnull_6(nullptr); // expected-warning{{null passed to a callee that requires a non-null argument}}
|
||||
}
|
||||
|
||||
template<void FP(_Nonnull int*)>
|
||||
template<void FP(_Nonnull int*)>
|
||||
void test_accepts_nonnull_null_pointer_literal_template() {
|
||||
FP(0); // expected-warning{{null passed to a callee that requires a non-null argument}}
|
||||
}
|
||||
@ -197,6 +197,6 @@ void testNullabilityCompletenessWithTemplate() {
|
||||
|
||||
namespace GH60344 {
|
||||
class a;
|
||||
template <typename b> using c = b _Nullable; // expected-error {{'_Nullable' cannot be applied to non-pointer type 'GH60344::a'}}
|
||||
template <typename b> using c = b _Nullable; // expected-error {{'_Nullable' cannot be applied to non-pointer type 'a'}}
|
||||
c<a>; // expected-note {{in instantiation of template type alias 'c' requested here}}
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ void template_fn_rvalue_ref(T &&) {}
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
template <typename T>
|
||||
using array_alias = T[1]; // expected-error {{array has sizeless element type '__SVInt8_t'}}
|
||||
using array_alias = T[1]; // expected-error {{array has sizeless element type 'svint8_t' (aka '__SVInt8_t')}}
|
||||
extern array_alias<int> *array_alias_int_ptr;
|
||||
extern array_alias<svint8_t> *array_alias_int8_ptr; // expected-note {{in instantiation of template type alias 'array_alias' requested here}}
|
||||
#endif
|
||||
|
@ -22,7 +22,7 @@ void Fn2(int16_t2 S);
|
||||
// CHECK: CallExpr {{.*}} 'void'
|
||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(int64_t2)' <FunctionToPointerDecay>
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'void (int64_t2)' lvalue Function {{.*}} 'Fn2' 'void (int64_t2)'
|
||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'vector<long, 2>' <IntegralCast>
|
||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'vector<int64_t, 2>' <IntegralCast>
|
||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'int2':'vector<int, 2>' <LValueToRValue>
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'int2':'vector<int, 2>' lvalue ParmVar {{.*}} 'I' 'int2':'vector<int, 2>'
|
||||
|
||||
@ -36,7 +36,7 @@ void Fn3( int64_t2 p0);
|
||||
// CHECK: CallExpr {{.*}} 'void'
|
||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(int64_t2)' <FunctionToPointerDecay>
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'void (int64_t2)' lvalue Function {{.*}} 'Fn3' 'void (int64_t2)'
|
||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'vector<long, 2>' <FloatingToIntegral>
|
||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'vector<int64_t, 2>' <FloatingToIntegral>
|
||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'half2':'vector<half, 2>' <LValueToRValue>
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'half2':'vector<half, 2>' lvalue ParmVar {{.*}} 'p0' 'half2':'vector<half, 2>'
|
||||
// CHECKIR-LABEL: Call3
|
||||
@ -49,7 +49,7 @@ void Call3(half2 p0) {
|
||||
// CHECK: CallExpr {{.*}} 'void'
|
||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(int64_t2)' <FunctionToPointerDecay>
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'void (int64_t2)' lvalue Function {{.*}} 'Fn3' 'void (int64_t2)'
|
||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'vector<long, 2>' <FloatingToIntegral>
|
||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'vector<int64_t, 2>' <FloatingToIntegral>
|
||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float2':'vector<float, 2>' <LValueToRValue>
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'float2':'vector<float, 2>' lvalue ParmVar {{.*}} 'p0' 'float2':'vector<float, 2>'
|
||||
// CHECKIR-LABEL: Call4
|
||||
@ -65,8 +65,8 @@ void Fn4( float2 p0);
|
||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(float2)' <FunctionToPointerDecay>
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'void (float2)' lvalue Function {{.*}} 'Fn4' 'void (float2)'
|
||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'vector<float, 2>' <IntegralToFloating>
|
||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'int64_t2':'vector<long, 2>' <LValueToRValue>
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'int64_t2':'vector<long, 2>' lvalue ParmVar {{.*}} 'p0' 'int64_t2':'vector<long, 2>'
|
||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'int64_t2':'vector<int64_t, 2>' <LValueToRValue>
|
||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'int64_t2':'vector<int64_t, 2>' lvalue ParmVar {{.*}} 'p0' 'int64_t2':'vector<int64_t, 2>'
|
||||
// CHECKIR-LABEL: Call5
|
||||
// CHECKIR: {{.*}} = sitofp <2 x i64> {{.*}} to <2 x float>
|
||||
void Call5(int64_t2 p0) {
|
||||
|
@ -161,10 +161,10 @@ using DT = D<int, int>;
|
||||
// CHECK: `-SubstTemplateTypeParmPackType {{.*}} 'U' dependent contains_unexpanded_pack typename depth 1 index 0 ... U
|
||||
// CHECK: |-TypeAliasTemplate {{.*}} 'B'
|
||||
// CHECK: `-TemplateArgument pack
|
||||
// CHECK: |-TemplateArgument type 'type-parameter-0-1'
|
||||
// CHECK: |-TemplateArgument type 'U1':'type-parameter-0-1'
|
||||
// CHECK-NOT: Subst
|
||||
// CHECK: | `-TemplateTypeParmType
|
||||
// CHECK: `-TemplateArgument type 'type-parameter-0-2'
|
||||
// CHECK: `-TemplateArgument type 'U2':'type-parameter-0-2'
|
||||
// CHECK-NOT: Subst
|
||||
// CHECK: `-TemplateTypeParmType
|
||||
|
||||
@ -351,9 +351,9 @@ X x = {{1, 2}};
|
||||
// CHECK-LABEL: Dumping GH64625::<deduction guide for X>:
|
||||
// CHECK-NEXT: FunctionTemplateDecl {{.+}} <{{.+}}:[[#@LINE - 7]]:1, col:27> col:27 implicit <deduction guide for X>
|
||||
// CHECK-NEXT: |-TemplateTypeParmDecl {{.+}} <col:11, col:17> col:17 referenced class depth 0 index 0 T
|
||||
// CHECK: |-CXXDeductionGuideDecl {{.+}} <col:27> col:27 implicit <deduction guide for X> 'auto (T (&&)[2]) -> X<T>' aggregate
|
||||
// CHECK: |-CXXDeductionGuideDecl {{.+}} <col:27> col:27 implicit <deduction guide for X> 'auto (T (&&)[2]) -> X<T>' aggregate
|
||||
// CHECK-NEXT: | `-ParmVarDecl {{.+}} <col:27> col:27 'T (&&)[2]'
|
||||
// CHECK-NEXT: `-CXXDeductionGuideDecl {{.+}} <col:27> col:27 implicit used <deduction guide for X> 'auto (int (&&)[2]) -> GH64625::X<int>' implicit_instantiation aggregate
|
||||
// CHECK-NEXT: `-CXXDeductionGuideDecl {{.+}} <col:27> col:27 implicit used <deduction guide for X> 'auto (int (&&)[2]) -> GH64625::X<int>' implicit_instantiation aggregate
|
||||
// CHECK-NEXT: |-TemplateArgument type 'int'
|
||||
// CHECK-NEXT: | `-BuiltinType {{.+}} 'int'
|
||||
// CHECK-NEXT: `-ParmVarDecl {{.+}} <col:27> col:27 'int (&&)[2]'
|
||||
@ -361,7 +361,7 @@ X x = {{1, 2}};
|
||||
// CHECK-NEXT: |-InjectedClassNameType {{.+}} 'X<T>' dependent
|
||||
// CHECK-NEXT: | `-CXXRecord {{.+}} 'X'
|
||||
// CHECK-NEXT: `-RValueReferenceType {{.+}} 'T (&&)[2]' dependent
|
||||
// CHECK-NEXT: `-ConstantArrayType {{.+}} 'T[2]' dependent 2
|
||||
// CHECK-NEXT: `-ConstantArrayType {{.+}} 'T[2]' dependent 2
|
||||
// CHECK-NEXT: `-TemplateTypeParmType {{.+}} 'T' dependent depth 0 index 0
|
||||
// CHECK-NEXT: `-TemplateTypeParm {{.+}} 'T'
|
||||
|
||||
@ -372,37 +372,37 @@ template <class T, class U> struct TwoArrays {
|
||||
|
||||
TwoArrays ta = {{1, 2}, {3, 4, 5}};
|
||||
// CHECK-LABEL: Dumping GH64625::<deduction guide for TwoArrays>:
|
||||
// CHECK-NEXT: FunctionTemplateDecl {{.+}} <{{.+}}:[[#@LINE - 7]]:1, col:36> col:36 implicit <deduction guide for TwoArrays>
|
||||
// CHECK-NEXT: |-TemplateTypeParmDecl {{.+}} <col:11, col:17> col:17 referenced class depth 0 index 0 T
|
||||
// CHECK-NEXT: |-TemplateTypeParmDecl {{.+}} <col:20, col:26> col:26 referenced class depth 0 index 1 U
|
||||
// CHECK: |-CXXDeductionGuideDecl {{.+}} <col:36> col:36 implicit <deduction guide for TwoArrays> 'auto (T (&&)[2], U (&&)[3]) -> TwoArrays<T, U>' aggregate
|
||||
// CHECK-NEXT: | |-ParmVarDecl {{.+}} <col:36> col:36 'T (&&)[2]'
|
||||
// CHECK-NEXT: | `-ParmVarDecl {{.+}} <col:36> col:36 'U (&&)[3]'
|
||||
// CHECK-NEXT: `-CXXDeductionGuideDecl {{.+}} <col:36> col:36 implicit used <deduction guide for TwoArrays> 'auto (int (&&)[2], int (&&)[3]) -> GH64625::TwoArrays<int, int>' implicit_instantiation aggregate
|
||||
// CHECK-NEXT: |-TemplateArgument type 'int'
|
||||
// CHECK-NEXT: | `-BuiltinType {{.+}} 'int'
|
||||
// CHECK-NEXT: |-TemplateArgument type 'int'
|
||||
// CHECK-NEXT: | `-BuiltinType {{.+}} 'int'
|
||||
// CHECK-NEXT: |-ParmVarDecl {{.+}} <col:36> col:36 'int (&&)[2]'
|
||||
// CHECK-NEXT: `-ParmVarDecl {{.+}} <col:36> col:36 'int (&&)[3]'
|
||||
// CHECK-NEXT: FunctionProtoType {{.+}} 'auto (T (&&)[2], U (&&)[3]) -> TwoArrays<T, U>' dependent trailing_return
|
||||
// CHECK-NEXT: |-InjectedClassNameType {{.+}} 'TwoArrays<T, U>' dependent
|
||||
// CHECK-NEXT: | `-CXXRecord {{.+}} 'TwoArrays'
|
||||
// CHECK-NEXT: |-RValueReferenceType {{.+}} 'T (&&)[2]' dependent
|
||||
// CHECK-NEXT: | `-ConstantArrayType {{.+}} 'T[2]' dependent 2
|
||||
// CHECK-NEXT: | `-TemplateTypeParmType {{.+}} 'T' dependent depth 0 index 0
|
||||
// CHECK-NEXT: | `-TemplateTypeParm {{.+}} 'T'
|
||||
// CHECK-NEXT: `-RValueReferenceType {{.+}} 'U (&&)[3]' dependent
|
||||
// CHECK-NEXT: `-ConstantArrayType {{.+}} 'U[3]' dependent 3
|
||||
// CHECK-NEXT: `-TemplateTypeParmType {{.+}} 'U' dependent depth 0 index 1
|
||||
// CHECK-NEXT: FunctionTemplateDecl {{.+}} <{{.+}}:[[#@LINE - 7]]:1, col:36> col:36 implicit <deduction guide for TwoArrays>
|
||||
// CHECK-NEXT: |-TemplateTypeParmDecl {{.+}} <col:11, col:17> col:17 referenced class depth 0 index 0 T
|
||||
// CHECK-NEXT: |-TemplateTypeParmDecl {{.+}} <col:20, col:26> col:26 referenced class depth 0 index 1 U
|
||||
// CHECK: |-CXXDeductionGuideDecl {{.+}} <col:36> col:36 implicit <deduction guide for TwoArrays> 'auto (T (&&)[2], U (&&)[3]) -> TwoArrays<T, U>' aggregate
|
||||
// CHECK-NEXT: | |-ParmVarDecl {{.+}} <col:36> col:36 'T (&&)[2]'
|
||||
// CHECK-NEXT: | `-ParmVarDecl {{.+}} <col:36> col:36 'U (&&)[3]'
|
||||
// CHECK-NEXT: `-CXXDeductionGuideDecl {{.+}} <col:36> col:36 implicit used <deduction guide for TwoArrays> 'auto (int (&&)[2], int (&&)[3]) -> GH64625::TwoArrays<int, int>' implicit_instantiation aggregate
|
||||
// CHECK-NEXT: |-TemplateArgument type 'int'
|
||||
// CHECK-NEXT: | `-BuiltinType {{.+}} 'int'
|
||||
// CHECK-NEXT: |-TemplateArgument type 'int'
|
||||
// CHECK-NEXT: | `-BuiltinType {{.+}} 'int'
|
||||
// CHECK-NEXT: |-ParmVarDecl {{.+}} <col:36> col:36 'int (&&)[2]'
|
||||
// CHECK-NEXT: `-ParmVarDecl {{.+}} <col:36> col:36 'int (&&)[3]'
|
||||
// CHECK-NEXT: FunctionProtoType {{.+}} 'auto (T (&&)[2], U (&&)[3]) -> TwoArrays<T, U>' dependent trailing_return
|
||||
// CHECK-NEXT: |-InjectedClassNameType {{.+}} 'TwoArrays<T, U>' dependent
|
||||
// CHECK-NEXT: | `-CXXRecord {{.+}} 'TwoArrays'
|
||||
// CHECK-NEXT: |-RValueReferenceType {{.+}} 'T (&&)[2]' dependent
|
||||
// CHECK-NEXT: | `-ConstantArrayType {{.+}} 'T[2]' dependent 2
|
||||
// CHECK-NEXT: | `-TemplateTypeParmType {{.+}} 'T' dependent depth 0 index 0
|
||||
// CHECK-NEXT: | `-TemplateTypeParm {{.+}} 'T'
|
||||
// CHECK-NEXT: `-RValueReferenceType {{.+}} 'U (&&)[3]' dependent
|
||||
// CHECK-NEXT: `-ConstantArrayType {{.+}} 'U[3]' dependent 3
|
||||
// CHECK-NEXT: `-TemplateTypeParmType {{.+}} 'U' dependent depth 0 index 1
|
||||
// CHECK-NEXT: `-TemplateTypeParm {{.+}} 'U'
|
||||
|
||||
TwoArrays tb = {1, 2, {3, 4, 5}};
|
||||
// CHECK: |-CXXDeductionGuideDecl {{.+}} <col:36> col:36 implicit <deduction guide for TwoArrays> 'auto (T, T, U (&&)[3]) -> TwoArrays<T, U>' aggregate
|
||||
// CHECK: |-CXXDeductionGuideDecl {{.+}} <col:36> col:36 implicit <deduction guide for TwoArrays> 'auto (T, T, U (&&)[3]) -> TwoArrays<T, U>' aggregate
|
||||
// CHECK-NEXT: | |-ParmVarDecl {{.+}} <col:36> col:36 'T'
|
||||
// CHECK-NEXT: | |-ParmVarDecl {{.+}} <col:36> col:36 'T'
|
||||
// CHECK-NEXT: | `-ParmVarDecl {{.+}} <col:36> col:36 'U (&&)[3]'
|
||||
// CHECK-NEXT: `-CXXDeductionGuideDecl {{.+}} <col:36> col:36 implicit used <deduction guide for TwoArrays> 'auto (int, int, int (&&)[3]) -> GH64625::TwoArrays<int, int>' implicit_instantiation aggregate
|
||||
// CHECK-NEXT: `-CXXDeductionGuideDecl {{.+}} <col:36> col:36 implicit used <deduction guide for TwoArrays> 'auto (int, int, int (&&)[3]) -> GH64625::TwoArrays<int, int>' implicit_instantiation aggregate
|
||||
// CHECK-NEXT: |-TemplateArgument type 'int'
|
||||
// CHECK-NEXT: | `-BuiltinType {{.+}} 'int'
|
||||
// CHECK-NEXT: |-TemplateArgument type 'int'
|
||||
@ -418,17 +418,17 @@ TwoArrays tb = {1, 2, {3, 4, 5}};
|
||||
// CHECK-NEXT: |-TemplateTypeParmType {{.+}} 'T' dependent depth 0 index 0
|
||||
// CHECK-NEXT: | `-TemplateTypeParm {{.+}} 'T'
|
||||
// CHECK-NEXT: `-RValueReferenceType {{.+}} 'U (&&)[3]' dependent
|
||||
// CHECK-NEXT: `-ConstantArrayType {{.+}} 'U[3]' dependent 3
|
||||
// CHECK-NEXT: `-ConstantArrayType {{.+}} 'U[3]' dependent 3
|
||||
// CHECK-NEXT: `-TemplateTypeParmType {{.+}} 'U' dependent depth 0 index 1
|
||||
// CHECK-NEXT: `-TemplateTypeParm {{.+}} 'U'
|
||||
|
||||
TwoArrays tc = {{1, 2}, 3, 4, 5};
|
||||
// CHECK: |-CXXDeductionGuideDecl {{.+}} <col:36> col:36 implicit <deduction guide for TwoArrays> 'auto (T (&&)[2], U, U, U) -> TwoArrays<T, U>' aggregate
|
||||
// CHECK: |-CXXDeductionGuideDecl {{.+}} <col:36> col:36 implicit <deduction guide for TwoArrays> 'auto (T (&&)[2], U, U, U) -> TwoArrays<T, U>' aggregate
|
||||
// CHECK-NEXT: | |-ParmVarDecl {{.+}} <col:36> col:36 'T (&&)[2]'
|
||||
// CHECK-NEXT: | |-ParmVarDecl {{.+}} <col:36> col:36 'U'
|
||||
// CHECK-NEXT: | |-ParmVarDecl {{.+}} <col:36> col:36 'U'
|
||||
// CHECK-NEXT: | `-ParmVarDecl {{.+}} <col:36> col:36 'U'
|
||||
// CHECK-NEXT: `-CXXDeductionGuideDecl {{.+}} <col:36> col:36 implicit used <deduction guide for TwoArrays> 'auto (int (&&)[2], int, int, int) -> GH64625::TwoArrays<int, int>' implicit_instantiation aggregate
|
||||
// CHECK-NEXT: `-CXXDeductionGuideDecl {{.+}} <col:36> col:36 implicit used <deduction guide for TwoArrays> 'auto (int (&&)[2], int, int, int) -> GH64625::TwoArrays<int, int>' implicit_instantiation aggregate
|
||||
// CHECK-NEXT: |-TemplateArgument type 'int'
|
||||
// CHECK-NEXT: | `-BuiltinType {{.+}} 'int'
|
||||
// CHECK-NEXT: |-TemplateArgument type 'int'
|
||||
@ -441,7 +441,7 @@ TwoArrays tc = {{1, 2}, 3, 4, 5};
|
||||
// CHECK-NEXT: |-InjectedClassNameType {{.+}} 'TwoArrays<T, U>' dependent
|
||||
// CHECK-NEXT: | `-CXXRecord {{.+}} 'TwoArrays'
|
||||
// CHECK-NEXT: |-RValueReferenceType {{.+}} 'T (&&)[2]' dependent
|
||||
// CHECK-NEXT: | `-ConstantArrayType {{.+}} 'T[2]' dependent 2
|
||||
// CHECK-NEXT: | `-ConstantArrayType {{.+}} 'T[2]' dependent 2
|
||||
// CHECK-NEXT: | `-TemplateTypeParmType {{.+}} 'T' dependent depth 0 index 0
|
||||
// CHECK-NEXT: | `-TemplateTypeParm {{.+}} 'T'
|
||||
// CHECK-NEXT: |-TemplateTypeParmType {{.+}} 'U' dependent depth 0 index 1
|
||||
@ -466,7 +466,7 @@ A a{.f1 = {1}};
|
||||
// CHECK-NEXT: |-NonTypeTemplateParmDecl {{.+}} <col:11, col:15> col:15 referenced 'int' depth 0 index 0 N
|
||||
// CHECK: |-CXXDeductionGuideDecl {{.+}} <col:25> col:25 implicit <deduction guide for A> 'auto (int (&&)[N]) -> A<N>' aggregate
|
||||
// CHECK-NEXT: | `-ParmVarDecl {{.+}} <col:25> col:25 'int (&&)[N]'
|
||||
// CHECK-NEXT: `-CXXDeductionGuideDecl {{.+}} <col:25> col:25 implicit used <deduction guide for A> 'auto (int (&&)[1]) -> GH83368::A<1>' implicit_instantiation aggregate
|
||||
// CHECK-NEXT: `-CXXDeductionGuideDecl {{.+}} <col:25> col:25 implicit used <deduction guide for A> 'auto (int (&&)[1]) -> GH83368::A<1>' implicit_instantiation aggregate
|
||||
// CHECK-NEXT: |-TemplateArgument integral '1'
|
||||
// CHECK-NEXT: `-ParmVarDecl {{.+}} <col:25> col:25 'int (&&)[1]'
|
||||
// CHECK-NEXT: FunctionProtoType {{.+}} 'auto (int (&&)[N]) -> A<N>' dependent trailing_return
|
||||
|
@ -48,9 +48,7 @@ using test2 = B<int, 1>;
|
||||
// CHECK-NEXT: |-TemplateArgument template 'A'
|
||||
// CHECK-NEXT: | `-ClassTemplateDecl 0x{{[0-9A-Fa-f]+}} <line:{{.+}}:1, col:41> col:38 A
|
||||
// CHECK-NEXT: |-TemplateArgument type 'int'
|
||||
// CHECK-NEXT: | `-SubstTemplateTypeParmType 0x{{[0-9A-Fa-f]+}} 'int' sugar class depth 0 index 0 B1
|
||||
// CHECK-NEXT: | |-TypeAliasTemplate 0x{{[0-9A-Fa-f]+}} 'B'
|
||||
// CHECK-NEXT: | `-BuiltinType 0x{{[0-9A-Fa-f]+}} 'int'
|
||||
// CHECK-NEXT: | `-BuiltinType 0x{{[0-9A-Fa-f]+}} 'int'
|
||||
// CHECK-NEXT: |-TemplateArgument expr '1'
|
||||
// CHECK-NEXT: | `-ConstantExpr 0x{{[0-9A-Fa-f]+}} <line:{{.+}}:64> 'int'
|
||||
// CHECK-NEXT: | |-value: Int 1
|
||||
@ -61,9 +59,7 @@ using test2 = B<int, 1>;
|
||||
// CHECK-NEXT: |-name: 'A' qualified
|
||||
// CHECK-NEXT: | `-ClassTemplateDecl {{.+}} A
|
||||
// CHECK-NEXT: |-TemplateArgument type 'int'
|
||||
// CHECK-NEXT: | `-SubstTemplateTypeParmType 0x{{[0-9A-Fa-f]+}} 'int' sugar class depth 0 index 0 B1
|
||||
// CHECK-NEXT: | |-TypeAliasTemplate 0x{{[0-9A-Fa-f]+}} 'B'
|
||||
// CHECK-NEXT: | `-BuiltinType 0x{{[0-9A-Fa-f]+}} 'int'
|
||||
// CHECK-NEXT: | `-BuiltinType 0x{{[0-9A-Fa-f]+}} 'int'
|
||||
// CHECK-NEXT: |-TemplateArgument expr '0'
|
||||
// CHECK-NEXT: | `-ConstantExpr 0x{{[0-9A-Fa-f]+}} <line:{{.+}}:64> 'int'
|
||||
// CHECK-NEXT: | |-value: Int 0
|
||||
|
@ -436,7 +436,7 @@ namespace dependent_nested_partial_specialization {
|
||||
|
||||
template<template<typename> class X> struct A {
|
||||
template<typename T, X<T> N> struct B; // expected-note 2{{here}}
|
||||
template<typename T> struct B<T, 0> {}; // expected-error {{non-type template argument specializes a template parameter with dependent type 'Y<T>' (aka 'type-parameter-0-0 *')}}
|
||||
template <typename T> struct B<T, 0> {}; // expected-error {{non-type template argument specializes a template parameter with dependent type 'Y<T>' (aka 'T *')}}
|
||||
};
|
||||
A<X>::B<int, 0> ax;
|
||||
A<Y>::B<int, &n> ay; // expected-error {{undefined}} expected-note {{instantiation of}}
|
||||
|
@ -25,9 +25,9 @@ class TestSharedPtr(TestBase):
|
||||
result_summary="3 strong=1 weak=1",
|
||||
result_children=[ValueCheck(name="__ptr_")],
|
||||
)
|
||||
self.expect_expr("*s", result_type="int", result_value="3")
|
||||
self.expect_expr("*s = 5", result_type="int", result_value="5")
|
||||
self.expect_expr("*s", result_type="int", result_value="5")
|
||||
self.expect_expr("*s", result_type="element_type", result_value="3")
|
||||
self.expect_expr("*s = 5", result_type="element_type", result_value="5")
|
||||
self.expect_expr("*s", result_type="element_type", result_value="5")
|
||||
self.expect_expr("(bool)s", result_type="bool", result_value="true")
|
||||
self.expect("expr s.reset()")
|
||||
self.expect_expr("(bool)s", result_type="bool", result_value="false")
|
||||
|
@ -24,7 +24,7 @@ class TestDbgInfoContentWeakPtr(TestBase):
|
||||
result_type="std::weak_ptr<Foo>",
|
||||
result_children=[ValueCheck(name="__ptr_")],
|
||||
)
|
||||
self.expect_expr("*w.lock()", result_type="Foo")
|
||||
self.expect_expr("*w.lock()", result_type="element_type")
|
||||
self.expect_expr("w.lock()->a", result_type="int", result_value="3")
|
||||
self.expect_expr("w.lock()->a = 5", result_type="int", result_value="5")
|
||||
self.expect_expr("w.lock()->a", result_type="int", result_value="5")
|
||||
|
@ -25,9 +25,9 @@ class TestSharedPtr(TestBase):
|
||||
result_summary="3 strong=1 weak=2",
|
||||
result_children=[ValueCheck(name="__ptr_")],
|
||||
)
|
||||
self.expect_expr("*w.lock()", result_type="int", result_value="3")
|
||||
self.expect_expr("*w.lock() = 5", result_type="int", result_value="5")
|
||||
self.expect_expr("*w.lock()", result_type="int", result_value="5")
|
||||
self.expect_expr("*w.lock()", result_type="element_type", result_value="3")
|
||||
self.expect_expr("*w.lock() = 5", result_type="element_type", result_value="5")
|
||||
self.expect_expr("*w.lock()", result_type="element_type", result_value="5")
|
||||
self.expect_expr("w.use_count()", result_type="long", result_value="1")
|
||||
self.expect("expr w.reset()")
|
||||
self.expect_expr("w.use_count()", result_type="long", result_value="0")
|
||||
|
Loading…
x
Reference in New Issue
Block a user