1 // RUN: %clang_cc1 %s -DUSEIT -triple %itanium_abi_triple -emit-llvm -o - | FileCheck %s
3 // Test with decls and template defs in pch, and just use in .cpp
4 // RUN: %clang_cc1 %s -DTMPL_DEF_IN_HEADER -triple %itanium_abi_triple -emit-pch -o %t
5 // RUN: %clang_cc1 %s -DTMPL_DEF_IN_HEADER -DUSEIT -triple %itanium_abi_triple -include-pch %t -emit-llvm -o - | FileCheck %s
7 // Test with A in pch, and B and C in main
8 // Test with just decls in pch, and template defs and use in .cpp
9 // RUN: %clang_cc1 %s -triple %itanium_abi_triple -emit-pch -o %t
10 // RUN: %clang_cc1 %s -DUSEIT -triple %itanium_abi_triple -include-pch %t -emit-llvm -o - | FileCheck %s
14 template < typename T
, int N
= 0 > class TmplWithArray
{
16 virtual T
& operator [] (int idx
);
17 virtual T
& func1 (int idx
);
18 virtual T
& func2 (int idx
);
22 TmplWithArray
<bool, 10> data
;
24 if (a
> 6) return data
[a
] ; // Should devirtualize
25 if (a
> 4) return data
.func1(a
); // Should devirtualize
26 return data
.func2(a
); // Should devirtualize
30 #ifdef TMPL_DEF_IN_HEADER
31 template <typename T
, int N
> T
& TmplWithArray
<T
, N
>::operator[](int idx
) {
34 template <typename T
, int N
> T
& TmplWithArray
<T
, N
>::func1(int idx
) {
37 #endif // TMPL_DEF_IN_HEADER
41 #ifndef TMPL_DEF_IN_HEADER
42 template <typename T
, int N
> T
& TmplWithArray
<T
, N
>::operator[](int idx
) {
45 template <typename T
, int N
> T
& TmplWithArray
<T
, N
>::func1(int idx
) {
48 #endif // !TMPL_DEF_IN_HEADER
56 // CHECK-DAG: call {{.*}} @_ZN13TmplWithArrayIbLi10EEixEi
57 // CHECK-DAG: call {{.*}} @_ZN13TmplWithArrayIbLi10EE5func1Ei
58 // CHECK-DAG: call {{.*}} @_ZN13TmplWithArrayIbLi10EE5func2Ei