Clang Project

clang_source_code/test/Analysis/Inputs/ctu-other.c
1// Test typedef and global variable in function.
2typedef struct {
3  int a;
4  int b;
5} FooBar;
6FooBar fb;
7int f(int i) {
8  if (fb.a) {
9    fb.b = i;
10  }
11  return 1;
12}
13
14// Test enums.
15enum B { x = 42,
16         l,
17         s };
18int enumCheck(void) {
19  return x;
20}
21
22// Test reporting an error in macro definition
23#define MYMACRO(ctx) \
24  ctx->a;
25struct S {
26  int a;
27};
28int g(struct S *ctx) {
29  MYMACRO(ctx);
30  return 0;
31}
32
33// Test that asm import does not fail.
34int inlineAsm() {
35  int res;
36  asm("mov $42, %0"
37      : "=r"(res));
38  return res;
39}
40
41// Implicit function.
42int identImplicit(int in) {
43  return in;
44}
45
46// ASTImporter doesn't support this construct.
47int structInProto(struct DataType {int a;int b; } * d) {
48  return 0;
49}
50