1 // RUN: %llvmgcc -S %s -o - | llvm-as -o /dev/null
5 void *malloc(unsigned);
7 // Test opaque structure support. the list type is defined later
10 struct list
*PassThroughList(struct list
*L
) {
15 // Recursive data structure tests...
25 static int Foo
= 0; // Test static local variable
26 Foo
+= 1; // Increment static variable
28 Data
= (list
*)malloc(12); // This is not a proper list allocation
31 extern list ListNode1
;
32 list ListNode3
= { 4, 0 };
33 list ListNode2
= { 3, &ListNode3
};
34 list ListNode0
= { 1, &ListNode1
};
35 list ListNode1
= { 2, &ListNode2
};
40 // Iterative insert fn
41 void InsertIntoListTail(list
**L
, int Data
) {
44 *L
= (list
*)malloc(sizeof(list
));
49 // Recursive list search fn
50 list
*FindData(list
*L
, int Data
) {
52 if (L
->Data
== Data
) return L
;
53 return FindData(L
->Next
, Data
);
61 InsertIntoListTail(&MyList
, 100);
62 InsertIntoListTail(&MyList
, 12);
63 InsertIntoListTail(&MyList
, 42);
64 InsertIntoListTail(&MyList
, 1123);
65 InsertIntoListTail(&MyList
, 1213);
67 if (FindData(MyList
, 75)) foundIt();
68 if (FindData(MyList
, 42)) foundIt();
69 if (FindData(MyList
, 700)) foundIt();