blob: 4c480d59c14a7cba391b308769fb2040d0a0ae13 [file] [log] [blame]
Daniel Dunbar83dd21f2009-03-13 17:57:10 +00001// Basic compilation for various types of files.
Sebastian Pop9ec60df2012-01-20 22:01:23 +00002// 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
Sebastian Redla98c0342009-10-26 18:07:30 +00003// BASIC: 0: input, "{{.*}}phases.c", c
4// BASIC: 1: preprocessor, {0}, cpp-output
5// BASIC: 2: compiler, {1}, assembler
6// BASIC: 3: assembler, {2}, object
7// BASIC: 4: input, "{{.*}}phases.c", objective-c
8// BASIC: 5: preprocessor, {4}, objective-c-cpp-output
9// BASIC: 6: compiler, {5}, assembler
10// BASIC: 7: assembler, {6}, object
11// BASIC: 8: input, "{{.*}}phases.c", c++
12// BASIC: 9: preprocessor, {8}, c++-cpp-output
13// BASIC: 10: compiler, {9}, assembler
14// BASIC: 11: assembler, {10}, object
15// BASIC: 12: input, "{{.*}}phases.c", assembler
16// BASIC: 13: assembler, {12}, object
17// BASIC: 14: input, "{{.*}}phases.c", assembler-with-cpp
18// BASIC: 15: preprocessor, {14}, assembler
19// BASIC: 16: assembler, {15}, object
20// BASIC: 17: input, "{{.*}}phases.c", c
21// BASIC: 18: preprocessor, {17}, cpp-output
22// BASIC: 19: compiler, {18}, assembler
23// BASIC: 20: assembler, {19}, object
24// BASIC: 21: linker, {3, 7, 11, 13, 16, 20}, image
Daniel Dunbar83dd21f2009-03-13 17:57:10 +000025
Daniel Dunbar83df91b2009-03-13 20:45:03 +000026// Universal linked image.
Sebastian Pop9ec60df2012-01-20 22:01:23 +000027// RUN: %clang -target i386-apple-darwin9 -ccc-print-phases -x c %s -arch ppc -arch i386 2>&1 | FileCheck -check-prefix=ULI %s
Sebastian Redla98c0342009-10-26 18:07:30 +000028// ULI: 0: input, "{{.*}}phases.c", c
29// ULI: 1: preprocessor, {0}, cpp-output
30// ULI: 2: compiler, {1}, assembler
31// ULI: 3: assembler, {2}, object
32// ULI: 4: linker, {3}, image
33// ULI: 5: bind-arch, "ppc", {4}, image
34// ULI: 6: bind-arch, "i386", {4}, image
35// ULI: 7: lipo, {5, 6}, image
Daniel Dunbar83df91b2009-03-13 20:45:03 +000036
37// Universal object file.
Sebastian Pop9ec60df2012-01-20 22:01:23 +000038// RUN: %clang -target i386-apple-darwin9 -ccc-print-phases -c -x c %s -arch ppc -arch i386 2>&1 | FileCheck -check-prefix=UOF %s
Sebastian Redla98c0342009-10-26 18:07:30 +000039// UOF: 0: input, "{{.*}}phases.c", c
40// UOF: 1: preprocessor, {0}, cpp-output
41// UOF: 2: compiler, {1}, assembler
42// UOF: 3: assembler, {2}, object
43// UOF: 4: bind-arch, "ppc", {3}, object
44// UOF: 5: bind-arch, "i386", {3}, object
45// UOF: 6: lipo, {4, 5}, object
Daniel Dunbar83df91b2009-03-13 20:45:03 +000046
Daniel Dunbarbaf07752009-03-17 21:29:52 +000047// Arch defaulting
Sebastian Pop9ec60df2012-01-20 22:01:23 +000048// RUN: %clang -target i386-apple-darwin9 -ccc-print-phases -c -x assembler %s 2>&1 | FileCheck -check-prefix=ARCH1 %s
Sebastian Redla98c0342009-10-26 18:07:30 +000049// ARCH1: 2: bind-arch, "i386", {1}, object
Sebastian Pop9ec60df2012-01-20 22:01:23 +000050// RUN: %clang -target i386-apple-darwin9 -ccc-print-phases -c -x assembler %s -m32 -m64 2>&1 | FileCheck -check-prefix=ARCH2 %s
Sebastian Redla98c0342009-10-26 18:07:30 +000051// ARCH2: 2: bind-arch, "x86_64", {1}, object
Sebastian Pop9ec60df2012-01-20 22:01:23 +000052// RUN: %clang -target x86_64-apple-darwin9 -ccc-print-phases -c -x assembler %s 2>&1 | FileCheck -check-prefix=ARCH3 %s
Sebastian Redla98c0342009-10-26 18:07:30 +000053// ARCH3: 2: bind-arch, "x86_64", {1}, object
Sebastian Pop9ec60df2012-01-20 22:01:23 +000054// RUN: %clang -target x86_64-apple-darwin9 -ccc-print-phases -c -x assembler %s -m64 -m32 2>&1 | FileCheck -check-prefix=ARCH4 %s
Sebastian Redla98c0342009-10-26 18:07:30 +000055// ARCH4: 2: bind-arch, "i386", {1}, object
Daniel Dunbarbaf07752009-03-17 21:29:52 +000056
Daniel Dunbar1a172b82009-03-17 23:26:35 +000057// Analyzer
Sebastian Pop9ec60df2012-01-20 22:01:23 +000058// RUN: %clang -target i386-unknown-unknown -ccc-print-phases --analyze %s 2>&1 | FileCheck -check-prefix=ANALYZE %s
Sebastian Redla98c0342009-10-26 18:07:30 +000059// ANALYZE: 0: input, "{{.*}}phases.c", c
60// ANALYZE: 1: preprocessor, {0}, cpp-output
61// ANALYZE: 2: analyzer, {1}, plist
Daniel Dunbar1a172b82009-03-17 23:26:35 +000062
63// Precompiler
Sebastian Pop9ec60df2012-01-20 22:01:23 +000064// RUN: %clang -target i386-unknown-unknown -ccc-print-phases -x c-header %s 2>&1 | FileCheck -check-prefix=PCH %s
Sebastian Redla98c0342009-10-26 18:07:30 +000065// PCH: 0: input, "{{.*}}phases.c", c-header
66// PCH: 1: preprocessor, {0}, c-header-cpp-output
67// PCH: 2: precompiler, {1}, precompiled-header
Daniel Dunbar1a172b82009-03-17 23:26:35 +000068
Daniel Dunbare33bea42009-03-20 23:39:23 +000069// Darwin overrides the handling for .s
Daniel Dunbar4fcfde42009-11-08 01:45:36 +000070// RUN: touch %t.s
Sebastian Pop9ec60df2012-01-20 22:01:23 +000071// RUN: %clang -target i386-unknown-unknown -ccc-print-phases -c %t.s 2>&1 | FileCheck -check-prefix=DARWIN1 %s
Sebastian Redla98c0342009-10-26 18:07:30 +000072// DARWIN1: 0: input, "{{.*}}.s", assembler
73// DARWIN1: 1: assembler, {0}, object
Sebastian Pop9ec60df2012-01-20 22:01:23 +000074// RUN: %clang -target i386-apple-darwin9 -ccc-print-phases -c %t.s 2>&1 | FileCheck -check-prefix=DARWIN2 %s
Sebastian Redla98c0342009-10-26 18:07:30 +000075// DARWIN2: 0: input, "{{.*}}.s", assembler-with-cpp
76// DARWIN2: 1: preprocessor, {0}, assembler
77// DARWIN2: 2: assembler, {1}, object
Daniel Dunbare33bea42009-03-20 23:39:23 +000078