summaryrefslogtreecommitdiffstats
path: root/clang/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
commit30efa2eec9818a05c1beb3f9fc378e6d20ad3861 (patch)
treea617dd020e97d5734ad2cbb11efdf99a4dbed4dc /clang/test/CodeGen/struct.c
parente670dbb9e6bb2c15d0fa6bbde1f641a3f2c2440f (diff)
downloadbcm5719-llvm-30efa2eec9818a05c1beb3f9fc378e6d20ad3861.tar.gz
bcm5719-llvm-30efa2eec9818a05c1beb3f9fc378e6d20ad3861.zip
Handle simple struct member expr.
llvm-svn: 43258
Diffstat (limited to 'clang/test/CodeGen/struct.c')
-rw-r--r--clang/test/CodeGen/struct.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/clang/test/CodeGen/struct.c b/clang/test/CodeGen/struct.c
new file mode 100644
index 00000000000..a3753d314a6
--- /dev/null
+++ b/clang/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;
+}
OpenPOWER on IntegriCloud