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