diff options
author | Zancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au> | 2012-09-24 09:58:17 +1000 |
---|---|---|
committer | Zancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au> | 2012-09-24 09:58:17 +1000 |
commit | 222e2a7620e6520ffaf4fc4e69d79c18da31542e (patch) | |
tree | 7bfbc05bfa3b41c8f9d2e56d53a0bc3e310df239 /clang/test/CodeGenCXX/new-array-init.cpp | |
parent | 3d206f03985b50beacae843d880bccdc91a9f424 (diff) |
Add the clang library to the repo (with some of my changes, too).
Diffstat (limited to 'clang/test/CodeGenCXX/new-array-init.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/new-array-init.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/new-array-init.cpp b/clang/test/CodeGenCXX/new-array-init.cpp new file mode 100644 index 0000000..231df24 --- /dev/null +++ b/clang/test/CodeGenCXX/new-array-init.cpp @@ -0,0 +1,33 @@ +// RUN: %clang_cc1 -std=c++11 -triple i386-unknown-unknown %s -emit-llvm -o - | FileCheck %s + +// CHECK: define void @_Z2fni +void fn(int n) { + // CHECK: icmp ult i{{32|64}} %{{[^ ]+}}, 3 + // CHECK: store i32 1 + // CHECK: store i32 2 + // CHECK: store i32 3 + // CHECK: icmp eq i32* + // CHECK-NEXT: br i1 + new int[n] { 1, 2, 3 }; +} + +// CHECK: define void @_Z15const_underflowv +void const_underflow() { + // CHECK-NOT: icmp ult i{{32|64}} %{{[^ ]+}}, 3 + // CHECK: call noalias i8* @_Zna{{.}}(i{{32|64}} -1) + new int[2] { 1, 2, 3 }; +} + +// CHECK: define void @_Z11const_exactv +void const_exact() { + // CHECK-NOT: icmp ult i{{32|64}} %{{[^ ]+}}, 3 + // CHECK-NOT: icmp eq i32* + new int[3] { 1, 2, 3 }; +} + +// CHECK: define void @_Z16const_sufficientv +void const_sufficient() { + // CHECK-NOT: icmp ult i{{32|64}} %{{[^ ]+}}, 3 + new int[4] { 1, 2, 3 }; + // CHECK: ret void +} |