summaryrefslogtreecommitdiff
path: root/test/CodeGen/complex-init-list.c
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-09-19 23:17:44 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-09-19 23:17:44 +0000
commit0c706c29f20b6fa36759fa41333b9c3ec0bd2969 (patch)
treecff749b4d8a9d6e5b4fbae39c4f4e710307366c0 /test/CodeGen/complex-init-list.c
parent40ccaccd21a4377cd76d6adda2b192dcf9514ef6 (diff)
downloadclang-0c706c29f20b6fa36759fa41333b9c3ec0bd2969.tar.gz
Add list initialization for complex numbers in C. Essentially, this allows "_Complex float x = {1.0f, 2.0f};". See changes to docs/LanguageExtensions.html for a longer description.
<rdar://problem/9397672>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140090 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/complex-init-list.c')
-rw-r--r--test/CodeGen/complex-init-list.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/CodeGen/complex-init-list.c b/test/CodeGen/complex-init-list.c
new file mode 100644
index 0000000000..819d4f9432
--- /dev/null
+++ b/test/CodeGen/complex-init-list.c
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin10 | FileCheck %s
+
+// This file tests the clang extension which allows initializing the components
+// of a complex number individually using an initialization list. (There is a
+// extensive description and test in test/Sema/complex-init-list.c.)
+
+_Complex float x = { 1.0f, 1.0f/0.0f };
+// CHECK: @x = global { float, float } { float 1.000000e+00, float 0x7FF0000000000000 }, align 4
+
+_Complex float f(float x, float y) { _Complex float z = { x, y }; return z; }
+// CHECK: define <2 x float> @f
+// CHECK: alloca { float, float } \ No newline at end of file