]> granicus.if.org Git - clang/commitdiff
Test CXXNoexceptExpr codegen and serialization.
authorSebastian Redl <sebastian.redl@getdesigned.at>
Fri, 10 Sep 2010 21:04:03 +0000 (21:04 +0000)
committerSebastian Redl <sebastian.redl@getdesigned.at>
Fri, 10 Sep 2010 21:04:03 +0000 (21:04 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113630 91177308-0d34-0410-b5e6-96231b3b80d8

test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp [new file with mode: 0644]
test/CXX/expr/expr.unary/expr.unary.noexcept/ser.h [new file with mode: 0644]

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 (file)
index 0000000..c567eff
--- /dev/null
@@ -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 (file)
index 0000000..e6e7b79
--- /dev/null
@@ -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);
+}