xref: /minix3/external/bsd/llvm/dist/clang/test/Driver/phases.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // Basic compilation for various types of files.
2f4a2713aSLionel Sambuc // RUN: %clang -target i386-unknown-unknown -ccc-print-phases -x c %s -x objective-c %s -x c++ %s -x objective-c++ -x assembler %s -x assembler-with-cpp %s -x none %s 2>&1 | FileCheck -check-prefix=BASIC %s
3f4a2713aSLionel Sambuc // BASIC: 0: input, "{{.*}}phases.c", c
4f4a2713aSLionel Sambuc // BASIC: 1: preprocessor, {0}, cpp-output
5*0a6a1f1dSLionel Sambuc // BASIC: 2: compiler, {1}, ir
6*0a6a1f1dSLionel Sambuc // BASIC: 3: backend, {2}, assembler
7*0a6a1f1dSLionel Sambuc // BASIC: 4: assembler, {3}, object
8*0a6a1f1dSLionel Sambuc // BASIC: 5: input, "{{.*}}phases.c", objective-c
9*0a6a1f1dSLionel Sambuc // BASIC: 6: preprocessor, {5}, objective-c-cpp-output
10*0a6a1f1dSLionel Sambuc // BASIC: 7: compiler, {6}, ir
11*0a6a1f1dSLionel Sambuc // BASIC: 8: backend, {7}, assembler
12*0a6a1f1dSLionel Sambuc // BASIC: 9: assembler, {8}, object
13*0a6a1f1dSLionel Sambuc // BASIC: 10: input, "{{.*}}phases.c", c++
14*0a6a1f1dSLionel Sambuc // BASIC: 11: preprocessor, {10}, c++-cpp-output
15*0a6a1f1dSLionel Sambuc // BASIC: 12: compiler, {11}, ir
16*0a6a1f1dSLionel Sambuc // BASIC: 13: backend, {12}, assembler
17*0a6a1f1dSLionel Sambuc // BASIC: 14: assembler, {13}, object
18*0a6a1f1dSLionel Sambuc // BASIC: 15: input, "{{.*}}phases.c", assembler
19f4a2713aSLionel Sambuc // BASIC: 16: assembler, {15}, object
20*0a6a1f1dSLionel Sambuc // BASIC: 17: input, "{{.*}}phases.c", assembler-with-cpp
21*0a6a1f1dSLionel Sambuc // BASIC: 18: preprocessor, {17}, assembler
22*0a6a1f1dSLionel Sambuc // BASIC: 19: assembler, {18}, object
23*0a6a1f1dSLionel Sambuc // BASIC: 20: input, "{{.*}}phases.c", c
24*0a6a1f1dSLionel Sambuc // BASIC: 21: preprocessor, {20}, cpp-output
25*0a6a1f1dSLionel Sambuc // BASIC: 22: compiler, {21}, ir
26*0a6a1f1dSLionel Sambuc // BASIC: 23: backend, {22}, assembler
27*0a6a1f1dSLionel Sambuc // BASIC: 24: assembler, {23}, object
28*0a6a1f1dSLionel Sambuc // BASIC: 25: linker, {4, 9, 14, 16, 19, 24}, image
29f4a2713aSLionel Sambuc 
30f4a2713aSLionel Sambuc // Universal linked image.
31f4a2713aSLionel Sambuc // RUN: %clang -target i386-apple-darwin9 -ccc-print-phases -x c %s -arch ppc -arch i386 2>&1 | FileCheck -check-prefix=ULI %s
32f4a2713aSLionel Sambuc // ULI: 0: input, "{{.*}}phases.c", c
33f4a2713aSLionel Sambuc // ULI: 1: preprocessor, {0}, cpp-output
34*0a6a1f1dSLionel Sambuc // ULI: 2: compiler, {1}, ir
35*0a6a1f1dSLionel Sambuc // ULI: 3: backend, {2}, assembler
36*0a6a1f1dSLionel Sambuc // ULI: 4: assembler, {3}, object
37*0a6a1f1dSLionel Sambuc // ULI: 5: linker, {4}, image
38*0a6a1f1dSLionel Sambuc // ULI: 6: bind-arch, "ppc", {5}, image
39*0a6a1f1dSLionel Sambuc // ULI: 7: bind-arch, "i386", {5}, image
40*0a6a1f1dSLionel Sambuc // ULI: 8: lipo, {6, 7}, image
41f4a2713aSLionel Sambuc 
42f4a2713aSLionel Sambuc // Universal object file.
43f4a2713aSLionel Sambuc // RUN: %clang -target i386-apple-darwin9 -ccc-print-phases -c -x c %s -arch ppc -arch i386 2>&1 | FileCheck -check-prefix=UOF %s
44f4a2713aSLionel Sambuc // UOF: 0: input, "{{.*}}phases.c", c
45f4a2713aSLionel Sambuc // UOF: 1: preprocessor, {0}, cpp-output
46*0a6a1f1dSLionel Sambuc // UOF: 2: compiler, {1}, ir
47*0a6a1f1dSLionel Sambuc // UOF: 3: backend, {2}, assembler
48*0a6a1f1dSLionel Sambuc // UOF: 4: assembler, {3}, object
49*0a6a1f1dSLionel Sambuc // UOF: 5: bind-arch, "ppc", {4}, object
50*0a6a1f1dSLionel Sambuc // UOF: 6: bind-arch, "i386", {4}, object
51*0a6a1f1dSLionel Sambuc // UOF: 7: lipo, {5, 6}, object
52f4a2713aSLionel Sambuc 
53f4a2713aSLionel Sambuc // Arch defaulting
54f4a2713aSLionel Sambuc // RUN: %clang -target i386-apple-darwin9 -ccc-print-phases -c -x assembler %s 2>&1 | FileCheck -check-prefix=ARCH1 %s
55f4a2713aSLionel Sambuc // ARCH1: 2: bind-arch, "i386", {1}, object
56f4a2713aSLionel Sambuc // RUN: %clang -target i386-apple-darwin9 -ccc-print-phases -c -x assembler %s -m32 -m64 2>&1 | FileCheck -check-prefix=ARCH2 %s
57f4a2713aSLionel Sambuc // ARCH2: 2: bind-arch, "x86_64", {1}, object
58f4a2713aSLionel Sambuc // RUN: %clang -target x86_64-apple-darwin9 -ccc-print-phases -c -x assembler %s 2>&1 | FileCheck -check-prefix=ARCH3 %s
59f4a2713aSLionel Sambuc // ARCH3: 2: bind-arch, "x86_64", {1}, object
60f4a2713aSLionel Sambuc // RUN: %clang -target x86_64-apple-darwin9 -ccc-print-phases -c -x assembler %s -m64 -m32 2>&1 | FileCheck -check-prefix=ARCH4 %s
61f4a2713aSLionel Sambuc // ARCH4: 2: bind-arch, "i386", {1}, object
62f4a2713aSLionel Sambuc 
63f4a2713aSLionel Sambuc // Analyzer
64f4a2713aSLionel Sambuc // RUN: %clang -target i386-unknown-unknown -ccc-print-phases --analyze %s 2>&1 | FileCheck -check-prefix=ANALYZE %s
65f4a2713aSLionel Sambuc // ANALYZE: 0: input, "{{.*}}phases.c", c
66f4a2713aSLionel Sambuc // ANALYZE: 1: preprocessor, {0}, cpp-output
67f4a2713aSLionel Sambuc // ANALYZE: 2: analyzer, {1}, plist
68f4a2713aSLionel Sambuc 
69f4a2713aSLionel Sambuc // Precompiler
70f4a2713aSLionel Sambuc // RUN: %clang -target i386-unknown-unknown -ccc-print-phases -x c-header %s 2>&1 | FileCheck -check-prefix=PCH %s
71f4a2713aSLionel Sambuc // PCH: 0: input, "{{.*}}phases.c", c-header
72f4a2713aSLionel Sambuc // PCH: 1: preprocessor, {0}, c-header-cpp-output
73f4a2713aSLionel Sambuc // PCH: 2: precompiler, {1}, precompiled-header
74f4a2713aSLionel Sambuc 
75f4a2713aSLionel Sambuc // Darwin overrides the handling for .s
76f4a2713aSLionel Sambuc // RUN: touch %t.s
77f4a2713aSLionel Sambuc // RUN: %clang -target i386-unknown-unknown -ccc-print-phases -c %t.s 2>&1 | FileCheck -check-prefix=DARWIN1 %s
78f4a2713aSLionel Sambuc // DARWIN1: 0: input, "{{.*}}.s", assembler
79f4a2713aSLionel Sambuc // DARWIN1: 1: assembler, {0}, object
80f4a2713aSLionel Sambuc // RUN: %clang -target i386-apple-darwin9 -ccc-print-phases -c %t.s 2>&1 | FileCheck -check-prefix=DARWIN2 %s
81f4a2713aSLionel Sambuc // DARWIN2: 0: input, "{{.*}}.s", assembler-with-cpp
82f4a2713aSLionel Sambuc // DARWIN2: 1: preprocessor, {0}, assembler
83f4a2713aSLionel Sambuc // DARWIN2: 2: assembler, {1}, object
84f4a2713aSLionel Sambuc 
85