Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Analysis / Inputs / ctu-other.c
blob2bb5a04d6c22814cef368726fc63446e17d1203d
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;
11 return 1;
14 // Test enums.
15 enum B { x2 = 42,
16 y2,
17 z2 };
18 int enumCheck(void) {
19 return x2;
22 // Test reporting an error in macro definition
23 #define MYMACRO(ctx) \
24 ctx->a;
25 struct S {
26 int a;
28 int g(struct S *ctx) {
29 MYMACRO(ctx);
30 return 0;
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;
43 // Implicit function.
44 int identImplicit(int in) {
45 return in;
48 // ASTImporter doesn't support this construct.
49 int structInProto(struct DataType {int a;int b; } * d) {
50 return 0;
53 int switchWithoutCases(int x) {
54 switch (x) {
56 return 0;