summaryrefslogtreecommitdiff
path: root/test/CodeGen/struct.c
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2007-10-23 20:28:39 +0000
committerDevang Patel <dpatel@apple.com>2007-10-23 20:28:39 +0000
commitb9b00ad6260b17c18195ff4a54c8b3abbf33fcc9 (patch)
tree57518ba5a6b862fc30b3ebebb1af1d0cc872771a /test/CodeGen/struct.c
parent7e15891fc89256fc013bd1003676ad3197b85c25 (diff)
downloadclang-b9b00ad6260b17c18195ff4a54c8b3abbf33fcc9.tar.gz
Handle simple struct member expr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43258 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/struct.c')
-rw-r--r--test/CodeGen/struct.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/CodeGen/struct.c b/test/CodeGen/struct.c
new file mode 100644
index 0000000000..a3753d314a
--- /dev/null
+++ b/test/CodeGen/struct.c
@@ -0,0 +1,39 @@
+// RUN: clang %s -emit-llvm
+
+struct {
+ int x;
+ int y;
+} point;
+
+void fn1() {
+ point.x = 42;
+}
+
+/* Nested member */
+struct {
+ struct {
+ int a;
+ int b;
+ } p1;
+} point2;
+
+void fn2() {
+ point2.p1.a = 42;
+}
+
+/* Indirect reference */
+typedef struct __sf {
+ unsigned char *c;
+ short flags;
+} F;
+
+typedef struct __sf2 {
+ F *ff;
+} F2;
+
+int fn3(F2 *c) {
+ if (c->ff->c >= 0)
+ return 1;
+ else
+ return 0;
+}