xref: /minix3/external/bsd/llvm/dist/clang/test/Driver/cl-outputs.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // Don't attempt slash switches on msys bash.
2*f4a2713aSLionel Sambuc // REQUIRES: shell-preserves-root
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc // Note: %s must be preceded by --, otherwise it may be interpreted as a
5*f4a2713aSLionel Sambuc // command-line option, e.g. on Mac where %s is commonly under /Users.
6*f4a2713aSLionel Sambuc 
7*f4a2713aSLionel Sambuc // RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=DEFAULT %s
8*f4a2713aSLionel Sambuc // DEFAULT: "-o" "cl-outputs.obj"
9*f4a2713aSLionel Sambuc 
10*f4a2713aSLionel Sambuc // RUN: %clang_cl /Foa -### -- %s 2>&1 | FileCheck -check-prefix=FoNAME %s
11*f4a2713aSLionel Sambuc // FoNAME:  "-o" "a.obj"
12*f4a2713aSLionel Sambuc 
13*f4a2713aSLionel Sambuc // RUN: %clang_cl /Foa.ext /Fob.ext -### -- %s 2>&1 | FileCheck -check-prefix=FoNAMEEXT %s
14*f4a2713aSLionel Sambuc // FoNAMEEXT:  "-o" "b.ext"
15*f4a2713aSLionel Sambuc 
16*f4a2713aSLionel Sambuc // RUN: %clang_cl /Fofoo.dir/ -### -- %s 2>&1 | FileCheck -check-prefix=FoDIR %s
17*f4a2713aSLionel Sambuc // FoDIR:  "-o" "foo.dir{{[/\\]+}}cl-outputs.obj"
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc // RUN: %clang_cl /Fofoo.dir/a -### -- %s 2>&1 | FileCheck -check-prefix=FoDIRNAME %s
20*f4a2713aSLionel Sambuc // FoDIRNAME:  "-o" "foo.dir{{[/\\]+}}a.obj"
21*f4a2713aSLionel Sambuc 
22*f4a2713aSLionel Sambuc // RUN: %clang_cl /Fofoo.dir/a.ext -### -- %s 2>&1 | FileCheck -check-prefix=FoDIRNAMEEXT %s
23*f4a2713aSLionel Sambuc // FoDIRNAMEEXT:  "-o" "foo.dir{{[/\\]+}}a.ext"
24*f4a2713aSLionel Sambuc 
25*f4a2713aSLionel Sambuc // RUN: %clang_cl /Fo.. -### -- %s 2>&1 | FileCheck -check-prefix=FoCRAZY %s
26*f4a2713aSLionel Sambuc // FoCRAZY:  "-o" "..obj"
27*f4a2713aSLionel Sambuc 
28*f4a2713aSLionel Sambuc // RUN: %clang_cl /Fo -### 2>&1 | FileCheck -check-prefix=FoMISSINGARG %s
29*f4a2713aSLionel Sambuc // FoMISSINGARG: error: argument to '/Fo' is missing (expected 1 value)
30*f4a2713aSLionel Sambuc 
31*f4a2713aSLionel Sambuc // RUN: %clang_cl /Foa.obj -### -- %s %s 2>&1 | FileCheck -check-prefix=CHECK-MULTIPLESOURCEERROR %s
32*f4a2713aSLionel Sambuc // CHECK-MULTIPLESOURCEERROR: error: cannot specify '/Foa.obj' when compiling multiple source files
33*f4a2713aSLionel Sambuc 
34*f4a2713aSLionel Sambuc // RUN: %clang_cl /Fomydir/ -### -- %s %s 2>&1 | FileCheck -check-prefix=CHECK-MULTIPLESOURCEOK %s
35*f4a2713aSLionel Sambuc // CHECK-MULTIPLESOURCEOK: "-o" "mydir{{[/\\]+}}cl-outputs.obj"
36*f4a2713aSLionel Sambuc 
37*f4a2713aSLionel Sambuc 
38*f4a2713aSLionel Sambuc // RUN: %clang_cl -### -- %s 2>&1 | FileCheck -check-prefix=DEFAULTEXE %s
39*f4a2713aSLionel Sambuc // DEFAULTEXE: cl-outputs.exe
40*f4a2713aSLionel Sambuc 
41*f4a2713aSLionel Sambuc // RUN: %clang_cl /LD -### -- %s 2>&1 | FileCheck -check-prefix=DEFAULTDLL %s
42*f4a2713aSLionel Sambuc // RUN: %clang_cl /LDd -### -- %s 2>&1 | FileCheck -check-prefix=DEFAULTDLL %s
43*f4a2713aSLionel Sambuc // DEFAULTDLL: "-out:cl-outputs.dll"
44*f4a2713aSLionel Sambuc // DEFAULTDLL: "-implib:cl-outputs.lib"
45*f4a2713aSLionel Sambuc 
46*f4a2713aSLionel Sambuc // RUN: %clang_cl /Fefoo -### -- %s 2>&1 | FileCheck -check-prefix=FeNOEXT %s
47*f4a2713aSLionel Sambuc // FeNOEXT: "-out:foo.exe"
48*f4a2713aSLionel Sambuc 
49*f4a2713aSLionel Sambuc // RUN: %clang_cl /Fefoo /LD -### -- %s 2>&1 | FileCheck -check-prefix=FeNOEXTDLL %s
50*f4a2713aSLionel Sambuc // RUN: %clang_cl /Fefoo /LDd -### -- %s 2>&1 | FileCheck -check-prefix=FeNOEXTDLL %s
51*f4a2713aSLionel Sambuc // FeNOEXTDLL: "-out:foo.dll"
52*f4a2713aSLionel Sambuc // FeNOEXTDLL: "-implib:foo.lib"
53*f4a2713aSLionel Sambuc 
54*f4a2713aSLionel Sambuc // RUN: %clang_cl /Fefoo.ext -### -- %s 2>&1 | FileCheck -check-prefix=FeEXT %s
55*f4a2713aSLionel Sambuc // FeEXT: "-out:foo.ext"
56*f4a2713aSLionel Sambuc 
57*f4a2713aSLionel Sambuc // RUN: %clang_cl /LD /Fefoo.ext -### -- %s 2>&1 | FileCheck -check-prefix=FeEXTDLL %s
58*f4a2713aSLionel Sambuc // RUN: %clang_cl /LDd /Fefoo.ext -### -- %s 2>&1 | FileCheck -check-prefix=FeEXTDLL %s
59*f4a2713aSLionel Sambuc // FeEXTDLL: "-out:foo.ext"
60*f4a2713aSLionel Sambuc // FeEXTDLL: "-implib:foo.lib"
61*f4a2713aSLionel Sambuc 
62*f4a2713aSLionel Sambuc // RUN: %clang_cl /Fefoo.dir/ -### -- %s 2>&1 | FileCheck -check-prefix=FeDIR %s
63*f4a2713aSLionel Sambuc // FeDIR: "-out:foo.dir{{[/\\]+}}cl-outputs.exe"
64*f4a2713aSLionel Sambuc 
65*f4a2713aSLionel Sambuc // RUN: %clang_cl /LD /Fefoo.dir/ -### -- %s 2>&1 | FileCheck -check-prefix=FeDIRDLL %s
66*f4a2713aSLionel Sambuc // RUN: %clang_cl /LDd /Fefoo.dir/ -### -- %s 2>&1 | FileCheck -check-prefix=FeDIRDLL %s
67*f4a2713aSLionel Sambuc // FeDIRDLL: "-out:foo.dir{{[/\\]+}}cl-outputs.dll"
68*f4a2713aSLionel Sambuc // FeDIRDLL: "-implib:foo.dir{{[/\\]+}}cl-outputs.lib"
69*f4a2713aSLionel Sambuc 
70*f4a2713aSLionel Sambuc // RUN: %clang_cl /Fefoo.dir/a -### -- %s 2>&1 | FileCheck -check-prefix=FeDIRNAME %s
71*f4a2713aSLionel Sambuc // FeDIRNAME: "-out:foo.dir{{[/\\]+}}a.exe"
72*f4a2713aSLionel Sambuc 
73*f4a2713aSLionel Sambuc // RUN: %clang_cl /LD /Fefoo.dir/a -### -- %s 2>&1 | FileCheck -check-prefix=FeDIRNAMEDLL %s
74*f4a2713aSLionel Sambuc // RUN: %clang_cl /LDd /Fefoo.dir/a -### -- %s 2>&1 | FileCheck -check-prefix=FeDIRNAMEDLL %s
75*f4a2713aSLionel Sambuc // FeDIRNAMEDLL: "-out:foo.dir{{[/\\]+}}a.dll"
76*f4a2713aSLionel Sambuc // FeDIRNAMEDLL: "-implib:foo.dir{{[/\\]+}}a.lib"
77*f4a2713aSLionel Sambuc 
78*f4a2713aSLionel Sambuc // RUN: %clang_cl /Fefoo.dir/a.ext -### -- %s 2>&1 | FileCheck -check-prefix=FeDIRNAMEEXT %s
79*f4a2713aSLionel Sambuc // FeDIRNAMEEXT: "-out:foo.dir{{[/\\]+}}a.ext"
80*f4a2713aSLionel Sambuc 
81*f4a2713aSLionel Sambuc // RUN: %clang_cl /LD /Fefoo.dir/a.ext -### -- %s 2>&1 | FileCheck -check-prefix=FeDIRNAMEEXTDLL %s
82*f4a2713aSLionel Sambuc // RUN: %clang_cl /LDd /Fefoo.dir/a.ext -### -- %s 2>&1 | FileCheck -check-prefix=FeDIRNAMEEXTDLL %s
83*f4a2713aSLionel Sambuc // FeDIRNAMEEXTDLL: "-out:foo.dir{{[/\\]+}}a.ext"
84*f4a2713aSLionel Sambuc // FeDIRNAMEEXTDLL: "-implib:foo.dir{{[/\\]+}}a.lib"
85*f4a2713aSLionel Sambuc 
86*f4a2713aSLionel Sambuc // RUN: %clang_cl /Fe -### 2>&1 | FileCheck -check-prefix=FeMISSINGARG %s
87*f4a2713aSLionel Sambuc // FeMISSINGARG: error: argument to '/Fe' is missing (expected 1 value)
88*f4a2713aSLionel Sambuc 
89*f4a2713aSLionel Sambuc // RUN: %clang_cl /Fefoo /Febar -### -- %s 2>&1 | FileCheck -check-prefix=FeOVERRIDE %s
90*f4a2713aSLionel Sambuc // FeOVERRIDE: "-out:bar.exe"
91*f4a2713aSLionel Sambuc 
92*f4a2713aSLionel Sambuc 
93*f4a2713aSLionel Sambuc // RUN: %clang_cl /FA -### -- %s 2>&1 | FileCheck -check-prefix=FA %s
94*f4a2713aSLionel Sambuc // FA: "-o" "cl-outputs.asm"
95*f4a2713aSLionel Sambuc // RUN: %clang_cl /FA /Fafoo -### -- %s 2>&1 | FileCheck -check-prefix=FaNAME %s
96*f4a2713aSLionel Sambuc // RUN: %clang_cl /Fafoo -### -- %s 2>&1 | FileCheck -check-prefix=FaNAME %s
97*f4a2713aSLionel Sambuc // FaNAME:  "-o" "foo.asm"
98*f4a2713aSLionel Sambuc // RUN: %clang_cl /FA /Faa.ext /Fab.ext -### -- %s 2>&1 | FileCheck -check-prefix=FaNAMEEXT %s
99*f4a2713aSLionel Sambuc // FaNAMEEXT:  "-o" "b.ext"
100*f4a2713aSLionel Sambuc // RUN: %clang_cl /FA /Fafoo.dir/ -### -- %s 2>&1 | FileCheck -check-prefix=FaDIR %s
101*f4a2713aSLionel Sambuc // FaDIR:  "-o" "foo.dir{{[/\\]+}}cl-outputs.asm"
102*f4a2713aSLionel Sambuc // RUN: %clang_cl /FA /Fafoo.dir/a -### -- %s 2>&1 | FileCheck -check-prefix=FaDIRNAME %s
103*f4a2713aSLionel Sambuc // FaDIRNAME:  "-o" "foo.dir{{[/\\]+}}a.asm"
104*f4a2713aSLionel Sambuc // RUN: %clang_cl /FA /Fafoo.dir/a.ext -### -- %s 2>&1 | FileCheck -check-prefix=FaDIRNAMEEXT %s
105*f4a2713aSLionel Sambuc // FaDIRNAMEEXT:  "-o" "foo.dir{{[/\\]+}}a.ext"
106*f4a2713aSLionel Sambuc // RUN: %clang_cl /Faa.asm -### -- %s %s 2>&1 | FileCheck -check-prefix=FaMULTIPLESOURCE %s
107*f4a2713aSLionel Sambuc // FaMULTIPLESOURCE: error: cannot specify '/Faa.asm' when compiling multiple source files
108