Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / c99-variable-length-array.cpp
blob24ad90153a68c633fb605f1f6939100b68c8c2f7
1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
2 struct X {
3 X();
4 ~X();
5 };
7 struct Y {
8 Y();
9 ~Y();
12 // CHECK-LABEL: define{{.*}} void @_Z1fiPPKc(
13 void f(int argc, const char* argv[]) {
14 // CHECK: call void @_ZN1XC1Ev
15 X x;
16 // CHECK: call ptr @llvm.stacksave.p0(
17 const char *argv2[argc];
18 // CHECK: call void @_ZN1YC1Ev
19 Y y;
20 for (int i = 0; i != argc; ++i)
21 argv2[i] = argv[i];
23 // CHECK: call void @_ZN1YD1Ev
24 // CHECK: call void @llvm.stackrestore.p0
25 // CHECK: call void @_ZN1XD1Ev
26 // CHECK: ret void
29 namespace PR11744 {
30 // Make sure this doesn't crash; there was a use-after-free issue
31 // for this testcase.
32 template<typename T> int f(int n) {
33 T arr[3][n];
34 return 3;
36 int test = f<int>(0);