|
1 |
| -// RUN: %clang_cc1 -std=c++98 -triple x86_64-linux-gnu -fclang-abi-compat=3.0 %s -emit-llvm -o - | FileCheck --check-prefixes=CHECK,PRE39,PRE5,PRE12 %s |
2 |
| -// RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -fclang-abi-compat=3.0 %s -emit-llvm -o - | FileCheck --check-prefixes=CHECK,PRE39,PRE5,PRE12 %s |
3 |
| -// RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -fclang-abi-compat=3.8 %s -emit-llvm -o - | FileCheck --check-prefixes=CHECK,PRE39,PRE5,PRE12 %s |
4 |
| -// RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -fclang-abi-compat=3.9 %s -emit-llvm -o - | FileCheck --check-prefixes=CHECK,V39,PRE5,PRE12 %s |
5 |
| -// RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -fclang-abi-compat=4.0 %s -emit-llvm -o - | FileCheck --check-prefixes=CHECK,V39,PRE5,PRE12 %s |
6 |
| -// RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -fclang-abi-compat=5 %s -emit-llvm -o - | FileCheck --check-prefixes=CHECK,V39,V5,PRE12,PRE12-CXX17 %s |
7 |
| -// RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -fclang-abi-compat=11 %s -emit-llvm -o - | FileCheck --check-prefixes=CHECK,V39,V5,PRE12,PRE12-CXX17 %s |
8 |
| -// RUN: %clang_cc1 -std=c++98 -triple x86_64-linux-gnu -fclang-abi-compat=latest %s -emit-llvm -o - | FileCheck --check-prefixes=CHECK,V39,V5,V12 %s |
9 |
| -// RUN: %clang_cc1 -std=c++20 -triple x86_64-linux-gnu -fclang-abi-compat=latest %s -emit-llvm -o - | FileCheck --check-prefixes=CHECK,V39,V5,V12,V12-CXX17 %s |
| 1 | +// RUN: %clang_cc1 -std=c++98 -triple x86_64-linux-gnu -fenable-matrix -fclang-abi-compat=3.0 %s -emit-llvm -o - -Wno-c++11-extensions \ |
| 2 | +// RUN: | FileCheck --check-prefixes=CHECK,PRE39,PRE5,PRE12 %s |
| 3 | +// RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -fenable-matrix -fclang-abi-compat=3.0 %s -emit-llvm -o - \ |
| 4 | +// RUN: | FileCheck --check-prefixes=CHECK,PRE39,PRE5,PRE12 %s |
| 5 | +// RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -fenable-matrix -fclang-abi-compat=3.8 %s -emit-llvm -o - \ |
| 6 | +// RUN: | FileCheck --check-prefixes=CHECK,PRE39,PRE5,PRE12 %s |
| 7 | +// RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -fenable-matrix -fclang-abi-compat=3.9 %s -emit-llvm -o - \ |
| 8 | +// RUN: | FileCheck --check-prefixes=CHECK,V39,PRE5,PRE12 %s |
| 9 | +// RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -fenable-matrix -fclang-abi-compat=4.0 %s -emit-llvm -o - \ |
| 10 | +// RUN: | FileCheck --check-prefixes=CHECK,V39,PRE5,PRE12 %s |
| 11 | +// RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -fenable-matrix -fclang-abi-compat=5 %s -emit-llvm -o - \ |
| 12 | +// RUN: | FileCheck --check-prefixes=CHECK,V39,V5,PRE12,PRE12-CXX17 %s |
| 13 | +// RUN: %clang_cc1 -std=c++17 -triple x86_64-linux-gnu -fenable-matrix -fclang-abi-compat=11 %s -emit-llvm -o - \ |
| 14 | +// RUN: | FileCheck --check-prefixes=CHECK,V39,V5,PRE12,PRE12-CXX17 %s |
| 15 | +// RUN: %clang_cc1 -std=c++20 -triple x86_64-linux-gnu -fenable-matrix -fclang-abi-compat=11 %s -emit-llvm -o - \ |
| 16 | +// RUN: | FileCheck --check-prefixes=CHECK,V39,V5,PRE12,PRE12-CXX17,PRE12-CXX20 %s |
| 17 | +// RUN: %clang_cc1 -std=c++98 -triple x86_64-linux-gnu -fenable-matrix -fclang-abi-compat=latest %s -emit-llvm -o - -Wno-c++11-extensions \ |
| 18 | +// RUN: | FileCheck --check-prefixes=CHECK,V39,V5,V12 %s |
| 19 | +// RUN: %clang_cc1 -std=c++20 -triple x86_64-linux-gnu -fenable-matrix -fclang-abi-compat=latest %s -emit-llvm -o - \ |
| 20 | +// RUN: | FileCheck --check-prefixes=CHECK,V39,V5,V12,V12-CXX17,V12-CXX20 %s |
10 | 21 |
|
11 | 22 | typedef __attribute__((vector_size(8))) long long v1xi64;
|
12 | 23 | void clang39(v1xi64) {}
|
@@ -55,3 +66,68 @@ template void clang12_b<arr>();
|
55 | 66 | // CHECK: @_Z9clang12_cIXadL_Z3arrEEEvv
|
56 | 67 | template<const char (*)[6]> void clang12_c() {}
|
57 | 68 | template void clang12_c<&arr>();
|
| 69 | + |
| 70 | + |
| 71 | +/// Tests for <template-arg> <expr-primary> changes in clang12: |
| 72 | +namespace expr_primary { |
| 73 | +struct A { |
| 74 | + template<int N> struct Int {}; |
| 75 | + template<int& N> struct Ref {}; |
| 76 | +}; |
| 77 | + |
| 78 | +/// Check various DeclRefExpr manglings |
| 79 | + |
| 80 | +// PRE12: @_ZN12expr_primary5test1INS_1AEEEvNT_3IntIXLi1EEEE |
| 81 | +// V12: @_ZN12expr_primary5test1INS_1AEEEvNT_3IntILi1EEE |
| 82 | +template <typename T> void test1(typename T::template Int<1> a) {} |
| 83 | +template void test1<A>(typename A::template Int<1> a); |
| 84 | + |
| 85 | +enum Enum { EnumVal = 4 }; |
| 86 | +int Global; |
| 87 | + |
| 88 | +// PRE12: @_ZN12expr_primary5test2INS_1AEEEvNT_3IntIXLNS_4EnumE4EEEE |
| 89 | +// V12: @_ZN12expr_primary5test2INS_1AEEEvNT_3IntILNS_4EnumE4EEE |
| 90 | +template <typename T> void test2(typename T::template Int<EnumVal> a) {} |
| 91 | +template void test2<A>(typename A::template Int<4> a); |
| 92 | + |
| 93 | +// CHECK: @_ZN12expr_primary5test3ILi3EEEvNS_1A3IntIXT_EEE |
| 94 | +template <int X> void test3(typename A::template Int<X> a) {} |
| 95 | +template void test3<3>(A::Int<3> a); |
| 96 | + |
| 97 | +#if __cplusplus >= 202002L |
| 98 | +// CHECK-CXX20: @_ZN12expr_primary5test4INS_1AEEEvNT_3RefIL_ZNS_6GlobalEEEE |
| 99 | +template <typename T> void test4(typename T::template Ref<(Global)> a) {} |
| 100 | +template void test4<A>(typename A::template Ref<Global> a); |
| 101 | + |
| 102 | +struct B { |
| 103 | + struct X { |
| 104 | + constexpr X(double) {} |
| 105 | + constexpr X(int&) {} |
| 106 | + }; |
| 107 | + template<X> struct Y {}; |
| 108 | +}; |
| 109 | + |
| 110 | +// PRE12-CXX20: _ZN12expr_primary5test5INS_1BEEEvNT_1YIXLd3ff0000000000000EEEE |
| 111 | +// V12-CXX20: _ZN12expr_primary5test5INS_1BEEEvNT_1YILd3ff0000000000000EEE |
| 112 | +template<typename T> void test5(typename T::template Y<1.0>) { } |
| 113 | +template void test5<B>(typename B::Y<1.0>); |
| 114 | + |
| 115 | +// PRE12-CXX20: @_ZN12expr_primary5test6INS_1BEEENT_1YIL_ZZNS_5test6EiE1bEEEi |
| 116 | +// V12-CXX20: @_ZN12expr_primary5test6INS_1BEEENT_1YIXfp_EEEi |
| 117 | +template<typename T> auto test6(int b) -> typename T::template Y<b> { return {}; } |
| 118 | +template auto test6<B>(int b) -> B::Y<b>; |
| 119 | +#endif |
| 120 | + |
| 121 | +/// Verify non-dependent type-traits within a dependent template arg. |
| 122 | + |
| 123 | +// PRE12: @_ZN12expr_primary5test7INS_1AEEEvNT_3IntIXLm1EEEE |
| 124 | +// V12: @_ZN12expr_primary5test7INS_1AEEEvNT_3IntILm1EEE |
| 125 | +template <class T> void test7(typename T::template Int<sizeof(char)> a) {} |
| 126 | +template void test7<A>(A::Int<1>); |
| 127 | + |
| 128 | +// PRE12: @_ZN12expr_primary5test8ILi2EEEvu11matrix_typeIXLi1EEXT_EiE |
| 129 | +// V12: @_ZN12expr_primary5test8ILi2EEEvu11matrix_typeILi1EXT_EiE |
| 130 | +template<int N> using matrix1xN = int __attribute__((matrix_type(1, N))); |
| 131 | +template<int N> void test8(matrix1xN<N> a) {} |
| 132 | +template void test8<2>(matrix1xN<2> a); |
| 133 | +} |
0 commit comments