blob: 0967d33816fea1600f1aa1257162d12a84453478 [file] [log] [blame]
Daniel Dunbar83dd21f2009-03-13 17:57:10 +00001// Basic compilation for various types of files.
Daniel Dunbar7ec3daf2009-03-24 03:07:05 +00002// RUN: clang -ccc-host-triple 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> %t &&
Daniel Dunbar73bf6a92009-03-13 21:03:35 +00003// RUN: grep '0: input, ".*phases.c", c' %t &&
Daniel Dunbar83dd21f2009-03-13 17:57:10 +00004// RUN: grep -F '1: preprocessor, {0}, cpp-output' %t &&
5// RUN: grep -F '2: compiler, {1}, assembler' %t &&
6// RUN: grep -F '3: assembler, {2}, object' %t &&
Daniel Dunbar73bf6a92009-03-13 21:03:35 +00007// RUN: grep '4: input, ".*phases.c", objective-c' %t &&
Daniel Dunbar83dd21f2009-03-13 17:57:10 +00008// RUN: grep -F '5: preprocessor, {4}, objective-c-cpp-output' %t &&
9// RUN: grep -F '6: compiler, {5}, assembler' %t &&
10// RUN: grep -F '7: assembler, {6}, object' %t &&
Daniel Dunbar73bf6a92009-03-13 21:03:35 +000011// RUN: grep '8: input, ".*phases.c", c++' %t &&
Daniel Dunbar83dd21f2009-03-13 17:57:10 +000012// RUN: grep -F '9: preprocessor, {8}, c++-cpp-output' %t &&
13// RUN: grep -F '10: compiler, {9}, assembler' %t &&
14// RUN: grep -F '11: assembler, {10}, object' %t &&
Daniel Dunbar73bf6a92009-03-13 21:03:35 +000015// RUN: grep '12: input, ".*phases.c", assembler' %t &&
Daniel Dunbar83dd21f2009-03-13 17:57:10 +000016// RUN: grep -F '13: assembler, {12}, object' %t &&
Daniel Dunbar73bf6a92009-03-13 21:03:35 +000017// RUN: grep '14: input, ".*phases.c", assembler-with-cpp' %t &&
Daniel Dunbar83dd21f2009-03-13 17:57:10 +000018// RUN: grep -F '15: preprocessor, {14}, assembler' %t &&
19// RUN: grep -F '16: assembler, {15}, object' %t &&
Daniel Dunbar73bf6a92009-03-13 21:03:35 +000020// RUN: grep '17: input, ".*phases.c", c' %t &&
Daniel Dunbar83dd21f2009-03-13 17:57:10 +000021// RUN: grep -F '18: preprocessor, {17}, cpp-output' %t &&
22// RUN: grep -F '19: compiler, {18}, assembler' %t &&
23// RUN: grep -F '20: assembler, {19}, object' %t &&
24// RUN: grep -F '21: linker, {3, 7, 11, 13, 16, 20}, image' %t &&
25
Daniel Dunbar83df91b2009-03-13 20:45:03 +000026// Universal linked image.
Daniel Dunbar7ec3daf2009-03-24 03:07:05 +000027// RUN: clang -ccc-host-triple i386-apple-darwin9 -ccc-print-phases -x c %s -arch ppc -arch i386 2> %t &&
Daniel Dunbar73bf6a92009-03-13 21:03:35 +000028// RUN: grep '0: input, ".*phases.c", c' %t &&
Daniel Dunbar83df91b2009-03-13 20:45:03 +000029// RUN: grep -F '1: preprocessor, {0}, cpp-output' %t &&
30// RUN: grep -F '2: compiler, {1}, assembler' %t &&
31// RUN: grep -F '3: assembler, {2}, object' %t &&
32// RUN: grep -F '4: linker, {3}, image' %t &&
33// RUN: grep -F '5: bind-arch, "ppc", {4}, image' %t &&
34// RUN: grep -F '6: bind-arch, "i386", {4}, image' %t &&
35// RUN: grep -F '7: lipo, {5, 6}, image' %t &&
36
37// Universal object file.
Daniel Dunbar7ec3daf2009-03-24 03:07:05 +000038// RUN: clang -ccc-host-triple i386-apple-darwin9 -ccc-print-phases -c -x c %s -arch ppc -arch i386 2> %t &&
Daniel Dunbar73bf6a92009-03-13 21:03:35 +000039// RUN: grep '0: input, ".*phases.c", c' %t &&
Daniel Dunbar83df91b2009-03-13 20:45:03 +000040// RUN: grep -F '1: preprocessor, {0}, cpp-output' %t &&
41// RUN: grep -F '2: compiler, {1}, assembler' %t &&
42// RUN: grep -F '3: assembler, {2}, object' %t &&
43// RUN: grep -F '4: bind-arch, "ppc", {3}, object' %t &&
44// RUN: grep -F '5: bind-arch, "i386", {3}, object' %t &&
45// RUN: grep -F '6: lipo, {4, 5}, object' %t &&
46
Daniel Dunbarbaf07752009-03-17 21:29:52 +000047// Arch defaulting
Daniel Dunbar7ec3daf2009-03-24 03:07:05 +000048// RUN: clang -ccc-host-triple i386-apple-darwin9 -ccc-print-phases -c -x assembler %s 2> %t &&
Daniel Dunbarbaf07752009-03-17 21:29:52 +000049// RUN: grep -F '2: bind-arch, "i386", {1}, object' %t &&
Daniel Dunbar7ec3daf2009-03-24 03:07:05 +000050// RUN: clang -ccc-host-triple i386-apple-darwin9 -ccc-print-phases -c -x assembler %s -m32 -m64 2> %t &&
Daniel Dunbarbaf07752009-03-17 21:29:52 +000051// RUN: grep -F '2: bind-arch, "x86_64", {1}, object' %t &&
Daniel Dunbar7ec3daf2009-03-24 03:07:05 +000052// RUN: clang -ccc-host-triple x86_64-apple-darwin9 -ccc-print-phases -c -x assembler %s 2> %t &&
Daniel Dunbarbaf07752009-03-17 21:29:52 +000053// RUN: grep -F '2: bind-arch, "x86_64", {1}, object' %t &&
Daniel Dunbar7ec3daf2009-03-24 03:07:05 +000054// RUN: clang -ccc-host-triple x86_64-apple-darwin9 -ccc-print-phases -c -x assembler %s -m64 -m32 2> %t &&
Daniel Dunbarbaf07752009-03-17 21:29:52 +000055// RUN: grep -F '2: bind-arch, "i386", {1}, object' %t &&
56
Daniel Dunbar1a172b82009-03-17 23:26:35 +000057// Analyzer
Daniel Dunbar7ec3daf2009-03-24 03:07:05 +000058// RUN: clang -ccc-host-triple i386-unknown-unknown -ccc-print-phases --analyze %s 2> %t &&
Daniel Dunbar1a172b82009-03-17 23:26:35 +000059// RUN: grep '0: input, ".*phases.c", c' %t &&
60// RUN: grep -F '1: preprocessor, {0}, cpp-output' %t &&
61// RUN: grep -F '2: analyzer, {1}, plist' %t &&
62
63// Precompiler
Daniel Dunbar7ec3daf2009-03-24 03:07:05 +000064// RUN: clang -ccc-host-triple i386-unknown-unknown -ccc-print-phases -x c-header %s 2> %t &&
Daniel Dunbare247cba2009-03-17 23:30:47 +000065// RUN: grep '0: input, ".*phases.c", c-header' %t &&
66// RUN: grep -F '1: preprocessor, {0}, c-header-cpp-output' %t &&
Daniel Dunbar1a172b82009-03-17 23:26:35 +000067// RUN: grep -F '2: precompiler, {1}, precompiled-header' %t &&
68
Daniel Dunbare33bea42009-03-20 23:39:23 +000069// Darwin overrides the handling for .s
70// RUN: touch %t.s &&
Daniel Dunbar7ec3daf2009-03-24 03:07:05 +000071// RUN: clang -ccc-host-triple i386-unknown-unknown -ccc-print-phases -c %t.s 2> %t &&
Daniel Dunbare33bea42009-03-20 23:39:23 +000072// RUN: grep '0: input, ".*\.s", assembler' %t &&
73// RUN: grep -F '1: assembler, {0}, object' %t &&
Daniel Dunbar7ec3daf2009-03-24 03:07:05 +000074// RUN: clang -ccc-host-triple i386-apple-darwin9 -ccc-print-phases -c %t.s 2> %t &&
Daniel Dunbare33bea42009-03-20 23:39:23 +000075// RUN: grep '0: input, ".*\.s", assembler-with-cpp' %t &&
76// RUN: grep -F '1: preprocessor, {0}, assembler' %t &&
77// RUN: grep -F '2: assembler, {1}, object' %t &&
78
Daniel Dunbar83dd21f2009-03-13 17:57:10 +000079// RUN: true