aboutsummaryrefslogtreecommitdiff
path: root/test/CXX
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2010-09-10 21:04:03 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2010-09-10 21:04:03 +0000
commitce5eff5c813daead3f51dcfb8261a7b5643ede5c (patch)
tree8652e8d74016a1bfc406618a277de0358d64e1c2 /test/CXX
parent98294def01c97e127fa6d812ebd944d37212828a (diff)
Test CXXNoexceptExpr codegen and serialization.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113630 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX')
-rw-r--r--test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp15
-rw-r--r--test/CXX/expr/expr.unary/expr.unary.noexcept/ser.h8
2 files changed, 23 insertions, 0 deletions
diff --git a/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp b/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp
new file mode 100644
index 0000000000..c567eff8c3
--- /dev/null
+++ b/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -S -emit-llvm -std=c++0x -include %S/ser.h %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-pch -o %t-ser.pch -std=c++0x -x c++ %S/ser.h
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -S -emit-llvm -std=c++0x -include-pch %t-ser.pch %s -o - | FileCheck %s
+
+void test() {
+ bool b;
+ // CHECK: store i8 1, i8* %b, align 1
+ b = noexcept(0);
+ // CHECK: store i8 0, i8* %b, align 1
+ b = noexcept(throw 0);
+ // CHECK: ret i1 true
+ b = f1();
+ // CHECK: ret i1 false
+ b = f2();
+}
diff --git a/test/CXX/expr/expr.unary/expr.unary.noexcept/ser.h b/test/CXX/expr/expr.unary/expr.unary.noexcept/ser.h
new file mode 100644
index 0000000000..e6e7b795d2
--- /dev/null
+++ b/test/CXX/expr/expr.unary/expr.unary.noexcept/ser.h
@@ -0,0 +1,8 @@
+// Serialization testing helper for noexcept, included by cg.cpp.
+
+inline bool f1() {
+ return noexcept(0);
+}
+inline bool f2() {
+ return noexcept(throw 0);
+}