summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/struct.c
blob: a3753d314a60ea9146303cca5be96d71b4b00753 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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