aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/captured-statements.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGen/captured-statements.c')
-rw-r--r--test/CodeGen/captured-statements.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/test/CodeGen/captured-statements.c b/test/CodeGen/captured-statements.c
index c87c1873506b..85d597aeb3c3 100644
--- a/test/CodeGen/captured-statements.c
+++ b/test/CodeGen/captured-statements.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm %s -o %t
+// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o %t
// RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-GLOBALS
// RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-1
// RUN: FileCheck %s -input-file=%t -check-prefix=CHECK-2
@@ -48,17 +48,31 @@ void test2(int x) {
// CHECK-2: %i = alloca i32
// Capture array
-void test3() {
+void test3(int size) {
int arr[] = {1, 2, 3, 4, 5};
+ int vla_arr[size];
#pragma clang __debug captured
{
- arr[2] = arr[1];
+ arr[2] = vla_arr[size - 1];
}
// CHECK-3: test3
// CHECK-3: alloca [5 x i32]
// CHECK-3: call void @__captured_stmt
}
+// Capture VLA array
+void test4(int size, int vla_arr[size]) {
+ #pragma clang __debug captured
+ {
+ vla_arr[0] = 1;
+ }
+ // CHECK-3: test4([[INT:i.+]] {{.*}}[[SIZE:%.+]], [[INT]]*
+ // CHECK-3: store [[INT]] {{.*}}[[SIZE]], [[INT]]* [[SIZE_ADDR:%.+]],
+ // CHECK-3: [[REF:%.+]] = getelementptr inbounds
+ // CHECK-3: store [[INT]]* [[SIZE_ADDR]], [[INT]]** [[REF]]
+ // CHECK-3: call void @__captured_stmt
+}
+
void dont_capture_global() {
static int s;
extern int e;