1 // Note: %s must be preceded by --, otherwise it may be interpreted as a
2 // command-line option, e.g. on Mac where %s is commonly under /Users.
3 
4 // First check that regular clang doesn't do any of this stuff.
5 // RUN: %clang -### %s 2>&1 | FileCheck -check-prefix=CHECK-CLANG %s
6 // CHECK-CLANG-NOT: "-D_DEBUG"
7 // CHECK-CLANG-NOT: "-D_MT"
8 // CHECK-CLANG-NOT: "-D_DLL"
9 // CHECK-CLANG-NOT: --dependent-lib
10 
11 // RUN: %clang_cl -### -- %s 2>&1 | FileCheck -check-prefix=CHECK-MT %s
12 // RUN: %clang_cl -### /MT -- %s 2>&1 | FileCheck -check-prefix=CHECK-MT %s
13 // CHECK-MT-NOT: "-D_DEBUG"
14 // CHECK-MT: "-D_MT"
15 // CHECK-MT-NOT: "-D_DLL"
16 // CHECK-MT: "--dependent-lib=libcmt"
17 // CHECK-MT: "--dependent-lib=oldnames"
18 
19 // RUN: %clang_cl -### /MTd -- %s 2>&1 | FileCheck -check-prefix=CHECK-MTd %s
20 // RUN: %clang_cl -### /LD /MTd -- %s 2>&1 | FileCheck -check-prefix=CHECK-MTd %s
21 // CHECK-MTd: "-D_DEBUG"
22 // CHECK-MTd: "-D_MT"
23 // CHECK-MTd-NOT: "-D_DLL"
24 // CHECK-MTd: "--dependent-lib=libcmtd"
25 // CHECK-MTd: "--dependent-lib=oldnames"
26 
27 // RUN: %clang_cl -### /MD -- %s 2>&1 | FileCheck -check-prefix=CHECK-MD %s
28 // CHECK-MD-NOT: "-D_DEBUG"
29 // CHECK-MD: "-D_MT"
30 // CHECK-MD: "-D_DLL"
31 // CHECK-MD: "--dependent-lib=msvcrt"
32 // CHECK-MD: "--dependent-lib=oldnames"
33 
34 // RUN: %clang_cl -### /MDd -- %s 2>&1 | FileCheck -check-prefix=CHECK-MDd %s
35 // CHECK-MDd: "-D_DEBUG"
36 // CHECK-MDd: "-D_MT"
37 // CHECK-MDd: "-D_DLL"
38 // CHECK-MDd: "--dependent-lib=msvcrtd"
39 // CHECK-MDd: "--dependent-lib=oldnames"
40 
41 // RUN: %clang_cl -### /LD -- %s 2>&1 | FileCheck -check-prefix=CHECK-LD %s
42 // RUN: %clang_cl -### /LD /MT -- %s 2>&1 | FileCheck -check-prefix=CHECK-LD %s
43 // CHECK-LD-NOT: "-D_DEBUG"
44 // CHECK-LD: "-D_MT"
45 // CHECK-LD-NOT: "-D_DLL"
46 // CHECK-LD: "--dependent-lib=libcmt"
47 
48 // RUN: %clang_cl -### /LDd -- %s 2>&1 | FileCheck -check-prefix=CHECK-LDd %s
49 // RUN: %clang_cl -### /LDd /MTd -- %s 2>&1 | FileCheck -check-prefix=CHECK-LDd %s
50 // CHECK-LDd: "-D_DEBUG"
51 // CHECK-LDd: "-D_MT"
52 // CHECK-LDd-NOT: "-D_DLL"
53 // CHECK-LDd: "--dependent-lib=libcmtd"
54 
55 // RUN: %clang_cl -### /LDd /MT -- %s 2>&1 | FileCheck -check-prefix=CHECK-LDdMT %s
56 // RUN: %clang_cl -### /MT /LDd -- %s 2>&1 | FileCheck -check-prefix=CHECK-LDdMT %s
57 // CHECK-LDdMT: "-D_DEBUG"
58 // CHECK-LDdMT: "-D_MT"
59 // CHECK-LDdMT-NOT: "-D_DLL"
60 // CHECK-LDdMT: "--dependent-lib=libcmt"
61 
62 // RUN: %clang_cl -### /LD /MD -- %s 2>&1 | FileCheck -check-prefix=CHECK-LDMD %s
63 // RUN: %clang_cl -### /MD /LD -- %s 2>&1 | FileCheck -check-prefix=CHECK-LDMD %s
64 // CHECK-LDMD-NOT: "-D_DEBUG"
65 // CHECK-LDMD: "-D_MT"
66 // CHECK-LDMD: "-D_DLL"
67 // CHECK-LDMD: "--dependent-lib=msvcrt"
68 
69 // RUN: %clang_cl -### /LDd /MD -- %s 2>&1 | FileCheck -check-prefix=CHECK-LDdMD %s
70 // RUN: %clang_cl -### /MD /LDd -- %s 2>&1 | FileCheck -check-prefix=CHECK-LDdMD %s
71 // CHECK-LDdMD: "-D_DEBUG"
72 // CHECK-LDdMD: "-D_MT"
73 // CHECK-LDdMD: "-D_DLL"
74 // CHECK-LDdMD: "--dependent-lib=msvcrt"
75 
76 // RUN: %clang_cl -### /LD /MDd -- %s 2>&1 | FileCheck -check-prefix=CHECK-LDMDd %s
77 // RUN: %clang_cl -### /MDd /LD -- %s 2>&1 | FileCheck -check-prefix=CHECK-LDMDd %s
78 // RUN: %clang_cl -### /LDd /MDd -- %s 2>&1 | FileCheck -check-prefix=CHECK-LDMDd %s
79 // RUN: %clang_cl -### /MDd /LDd -- %s 2>&1 | FileCheck -check-prefix=CHECK-LDMDd %s
80 // CHECK-LDMDd: "-D_DEBUG"
81 // CHECK-LDMDd: "-D_MT"
82 // CHECK-LDMDd: "-D_DLL"
83 // CHECK-LDMDd: "--dependent-lib=msvcrtd"
84 
85 // RUN: %clang_cl /MD /MT -### -- %s 2>&1 | FileCheck -check-prefix=MTOVERRIDE %s
86 // MTOVERRIDE: "--dependent-lib=libcmt"
87 
88 // RUN: %clang_cl -### /Zl -- %s 2>&1 | FileCheck -check-prefix=CHECK-MTZl %s
89 // RUN: %clang_cl -### /MT /Zl -- %s 2>&1 | FileCheck -check-prefix=CHECK-MTZl %s
90 // CHECK-MTZl-NOT: "-D_DEBUG"
91 // CHECK-MTZl: "-D_MT"
92 // CHECK-MTZl-NOT: "-D_DLL"
93 // CHECK-MTZl-SAME: "-D_VC_NODEFAULTLIB"
94 // CHECK-MTZl-NOT: "--dependent-lib=libcmt"
95 // CHECK-MTZl-NOT: "--dependent-lib=oldnames"
96