Debian Codegraph @

clang/test/Analysis/Inputs/ctu-other.c

raw
1 // Test typedef and global variable in function.
2 typedef struct {
3 int a;
4 int b;
5 } FooBar;
6 FooBar fb;
7 int f(int i) {
8 if (fb.a) {
9 fb.b = i;
10 }
11 return 1;
12 }
13
14 // Test enums.
15 enum B { x2 = 42,
16 y2,
17 z2 };
18 int enumCheck(void) {
19 return x2;
20 }
21
22 // Test reporting an error in macro definition
23 #define MYMACRO(ctx) \
24 ctx->a;
25 struct S {
26 int a;
27 };
28 int g(struct S *ctx) {
29 MYMACRO(ctx);
30 return 0;
31 }
32
33 // Test that asm import does not fail.
34 // TODO: Support the GNU extension asm keyword as well.
35 // Example using the GNU extension: asm("mov $42, %0" : "=r"(res));
36 int inlineAsm(void) {
37 int res;
38 __asm__("mov $42, %0"
39 : "=r"(res));
40 return res;
41 }
42
43 // Implicit function.
44 int identImplicit(int in) {
45 return in;
46 }
47
48 // ASTImporter doesn't support this construct.
49 int structInProto(struct DataType {int a;int b; } * d) {
50 return 0;
51 }
52
53 int switchWithoutCases(int x) {
54 switch (x) {
55 };
56 return 0;
57 }