~ubuntu-branches/ubuntu/trusty/llvm-toolchain-snapshot/trusty-201310232150

« back to all changes in this revision

Viewing changes to lldb/test/lang/c/anonymous/main.c

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-27 15:01:57 UTC
  • mfrom: (0.10.1) (0.9.1) (0.8.1) (0.7.1) (0.6.1) (0.5.2)
  • Revision ID: package-import@ubuntu.com-20130527150157-tdkrsjpuvht7v0qx
Tags: 1:3.4~svn182733-1~exp1
* New snapshot release (3.4 release)
* Add a symlink of libLLVM-3.4.so.1 to usr/lib/llvm-3.4/lib/libLLVM-3.4.so
    to fix make the llvm-config-3.4 --libdir work (Closes: #708677)
  * Various packages rename to allow co installations:
    * libclang1 => libclang1-3.4
    * libclang1-dbg => libclang1-3.4-dbg
    * libclang-dev => libclang-3.4-dev
    * libclang-common-dev => libclang-common-3.4-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include <stdio.h>
2
2
 
3
 
struct container {
4
 
  struct {
5
 
    struct {
6
 
      int a;
7
 
      int b;
8
 
    };
9
 
    struct {
10
 
      int c;
11
 
      int d;
12
 
    } foo;
13
 
  };
14
 
};
15
 
 
16
 
int processor (struct container *c)
17
 
{
18
 
  return c->foo.d + c->b; // Set breakpoint 0 here.
19
 
}
 
3
struct anonymous_nest {
 
4
  struct {
 
5
    struct {
 
6
      int a;
 
7
      int b;
 
8
    }; // anonymous
 
9
    struct {
 
10
      int c;
 
11
      int d;
 
12
    } foo;
 
13
  }; // anonymous
 
14
};
 
15
 
 
16
struct anonymous_child {
 
17
  struct {
 
18
    struct {
 
19
      int a;
 
20
      int b;
 
21
    } grandchild;
 
22
    struct {
 
23
      int c;
 
24
      int d;
 
25
    } foo;
 
26
  }; // anonymous
 
27
};
 
28
 
 
29
struct anonymous_grandchild {
 
30
  struct {
 
31
    struct {
 
32
      int a;
 
33
      int b;
 
34
    }; // anonymous
 
35
    struct {
 
36
      int c;
 
37
      int d;
 
38
    } foo;
 
39
  } child;
 
40
};
 
41
 
 
42
int processor_nest (struct anonymous_nest *n)
 
43
{
 
44
  return n->foo.d + n->b; // Set breakpoint 0 here.
 
45
}
 
46
 
 
47
int processor_child (struct anonymous_child *c)
 
48
{
 
49
  return c->foo.d + c->grandchild.b; // Set breakpoint 1 here.
 
50
}
 
51
 
 
52
int processor_grandchild (struct anonymous_grandchild *g)
 
53
{
 
54
  return g->child.foo.d + g->child.b;
 
55
}
 
56
 
 
57
 
 
58
 
 
59
typedef struct {
 
60
    int dummy;
 
61
} type_y;
 
62
 
 
63
typedef struct {
 
64
    type_y y;
 
65
} type_z;
 
66
 
 
67
 
20
68
 
21
69
int main()
22
70
{
23
 
  struct container c = { 0, 2, 0, 4 };
24
 
  
25
 
  printf("%d\n", processor(&c));
 
71
  struct anonymous_nest n = { 0, 2, 0, 4 };
 
72
  struct anonymous_child c = { 0, 2, 0, 4 };
 
73
  struct anonymous_grandchild g = { 0, 2, 0, 4 };
 
74
  type_z *pz = 0;
 
75
  type_z z = {{2}};
 
76
 
 
77
  printf("%d\n", processor_nest(&n));
 
78
  printf("%d\n", processor_child(&c));
 
79
  printf("%d\n", processor_grandchild(&g)); // Set breakpoint 2 here.
26
80
 
27
81
  return 0;
28
82
}