1*cddc9993SBruno Ricci // Test without serialization:
2830909b9SErich Keane // RUN: %clang_cc1 -ast-dump %s | FileCheck %s
3*cddc9993SBruno Ricci //
4*cddc9993SBruno Ricci // Test with serialization:
5*cddc9993SBruno Ricci // RUN: %clang_cc1 -emit-pch -o %t %s
6*cddc9993SBruno Ricci // RUN: %clang_cc1 -x c++ -include-pch %t -ast-dump-all /dev/null \
7*cddc9993SBruno Ricci // RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
8*cddc9993SBruno Ricci // RUN: | FileCheck %s
9830909b9SErich Keane
10830909b9SErich Keane template<int N = 0>
pr43370()11830909b9SErich Keane void pr43370() {
12830909b9SErich Keane int arr[2];
13566b3164SMichael Liao __atomic_store_n(arr, 0, 5);
14830909b9SErich Keane }
15566b3164SMichael Liao
16566b3164SMichael Liao template<int N = 0>
foo()17566b3164SMichael Liao void foo() {
18566b3164SMichael Liao int arr[2];
19566b3164SMichael Liao (void)__atomic_compare_exchange_n(arr, arr, 1, 0, 3, 4);
20566b3164SMichael Liao }
21566b3164SMichael Liao
useage()22830909b9SErich Keane void useage(){
23830909b9SErich Keane pr43370();
24566b3164SMichael Liao foo();
25830909b9SErich Keane }
26830909b9SErich Keane
27*cddc9993SBruno Ricci // CHECK:FunctionTemplateDecl 0x{{[0-9a-f]+}} <{{[^,]+}}, line:{{.*}}:1> line:{{.*}}:6 pr43370
28830909b9SErich Keane // CHECK: AtomicExpr
29830909b9SErich Keane // CHECK-NEXT: ImplicitCastExpr
30830909b9SErich Keane // CHECK-SAME: <ArrayToPointerDecay>
31566b3164SMichael Liao // CHECK-NEXT: DeclRefExpr 0x{{[0-9a-f]+}} <{{[^:]+}}:20> 'int[2]' lvalue Var 0x{{[0-9a-f]+}} 'arr' 'int[2]'
32566b3164SMichael Liao // CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:28> 'int' 5
33566b3164SMichael Liao // CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:25> 'int' 0
34*cddc9993SBruno Ricci // CHECK:FunctionDecl 0x{{[0-9a-f]+}} <line:{{.*}}:1, line:{{.*}}:1> line:{{.*}}:6 used pr43370
35830909b9SErich Keane // CHECK: AtomicExpr
36830909b9SErich Keane // CHECK-NEXT: ImplicitCastExpr
37830909b9SErich Keane // CHECK-SAME: <ArrayToPointerDecay>
38566b3164SMichael Liao // CHECK-NEXT: DeclRefExpr 0x{{[0-9a-f]+}} <{{[^:]+}}:20> 'int[2]' lvalue Var 0x{{[0-9a-f]+}} 'arr' 'int[2]'
39566b3164SMichael Liao // CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:28> 'int' 5
40566b3164SMichael Liao // CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:25> 'int' 0
41566b3164SMichael Liao
42*cddc9993SBruno Ricci // CHECK:FunctionTemplateDecl 0x{{[0-9a-f]+}} <line:{{.*}}:1, line:{{.*}}:1> line:{{.*}}:6 foo
43566b3164SMichael Liao // CHECK: AtomicExpr
44566b3164SMichael Liao // CHECK-NEXT: ImplicitCastExpr
45566b3164SMichael Liao // CHECK-SAME: <ArrayToPointerDecay>
46566b3164SMichael Liao // CHECK-NEXT: DeclRefExpr 0x{{[0-9a-f]+}} <{{[^:]+}}:37> 'int[2]' lvalue Var 0x{{[0-9a-f]+}} 'arr' 'int[2]'
47566b3164SMichael Liao // CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:53> 'int' 3
48566b3164SMichael Liao // CHECK-NEXT: ImplicitCastExpr
49566b3164SMichael Liao // CHECK-SAME: <ArrayToPointerDecay>
50566b3164SMichael Liao // CHECK-NEXT: DeclRefExpr 0x{{[0-9a-f]+}} <{{[^:]+}}:42> 'int[2]' lvalue Var 0x{{[0-9a-f]+}} 'arr' 'int[2]'
51566b3164SMichael Liao // CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:56> 'int' 4
52566b3164SMichael Liao // CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:47> 'int' 1
53566b3164SMichael Liao // CHECK-NEXT: ImplicitCastExpr
54566b3164SMichael Liao // CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:50> 'int' 0
55*cddc9993SBruno Ricci // CHECK:FunctionDecl 0x{{[0-9a-f]+}} <line:{{.*}}:1, line:{{.*}}:1> line:{{.*}}:6 used foo
56566b3164SMichael Liao // CHECK: AtomicExpr
57566b3164SMichael Liao // CHECK-NEXT: ImplicitCastExpr
58566b3164SMichael Liao // CHECK-SAME: <ArrayToPointerDecay>
59566b3164SMichael Liao // CHECK-NEXT: DeclRefExpr 0x{{[0-9a-f]+}} <{{[^:]+}}:37> 'int[2]' lvalue Var 0x{{[0-9a-f]+}} 'arr' 'int[2]'
60566b3164SMichael Liao // CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:53> 'int' 3
61566b3164SMichael Liao // CHECK-NEXT: ImplicitCastExpr
62566b3164SMichael Liao // CHECK-SAME: <ArrayToPointerDecay>
63566b3164SMichael Liao // CHECK-NEXT: DeclRefExpr 0x{{[0-9a-f]+}} <{{[^:]+}}:42> 'int[2]' lvalue Var 0x{{[0-9a-f]+}} 'arr' 'int[2]'
64566b3164SMichael Liao // CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:56> 'int' 4
65566b3164SMichael Liao // CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:47> 'int' 1
66566b3164SMichael Liao // CHECK-NEXT: ImplicitCastExpr
67566b3164SMichael Liao // CHECK-NEXT: IntegerLiteral 0x{{[0-9a-f]+}} <{{[^:]+}}:50> 'int' 0
68