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: "-flto-visibility-public-std"
17 // CHECK-MT: "--dependent-lib=libcmt"
18 // CHECK-MT: "--dependent-lib=oldnames"
19 
20 // RUN: %clang_cl -### /MTd -- %s 2>&1 | FileCheck -check-prefix=CHECK-MTd %s
21 // RUN: %clang_cl -### /LD /MTd -- %s 2>&1 | FileCheck -check-prefix=CHECK-MTd %s
22 // CHECK-MTd: "-D_DEBUG"
23 // CHECK-MTd: "-D_MT"
24 // CHECK-MTd-NOT: "-D_DLL"
25 // CHECK-MTd: "-flto-visibility-public-std"
26 // CHECK-MTd: "--dependent-lib=libcmtd"
27 // CHECK-MTd: "--dependent-lib=oldnames"
28 
29 // RUN: %clang_cl -### /MD -- %s 2>&1 | FileCheck -check-prefix=CHECK-MD %s
30 // CHECK-MD-NOT: "-D_DEBUG"
31 // CHECK-MD: "-D_MT"
32 // CHECK-MD: "-D_DLL"
33 // CHECK-MD: "--dependent-lib=msvcrt"
34 // CHECK-MD: "--dependent-lib=oldnames"
35 
36 // RUN: %clang_cl -### /MDd -- %s 2>&1 | FileCheck -check-prefix=CHECK-MDd %s
37 // CHECK-MDd: "-D_DEBUG"
38 // CHECK-MDd: "-D_MT"
39 // CHECK-MDd: "-D_DLL"
40 // CHECK-MDd: "--dependent-lib=msvcrtd"
41 // CHECK-MDd: "--dependent-lib=oldnames"
42 
43 // RUN: %clang_cl -### /LD -- %s 2>&1 | FileCheck -check-prefix=CHECK-LD %s
44 // RUN: %clang_cl -### /LD /MT -- %s 2>&1 | FileCheck -check-prefix=CHECK-LD %s
45 // CHECK-LD-NOT: "-D_DEBUG"
46 // CHECK-LD: "-D_MT"
47 // CHECK-LD-NOT: "-D_DLL"
48 // CHECK-LD: "--dependent-lib=libcmt"
49 
50 // RUN: %clang_cl -### /LDd -- %s 2>&1 | FileCheck -check-prefix=CHECK-LDd %s
51 // RUN: %clang_cl -### /LDd /MTd -- %s 2>&1 | FileCheck -check-prefix=CHECK-LDd %s
52 // CHECK-LDd: "-D_DEBUG"
53 // CHECK-LDd: "-D_MT"
54 // CHECK-LDd-NOT: "-D_DLL"
55 // CHECK-LDd: "--dependent-lib=libcmtd"
56 
57 // RUN: %clang_cl -### /LDd /MT -- %s 2>&1 | FileCheck -check-prefix=CHECK-LDdMT %s
58 // RUN: %clang_cl -### /MT /LDd -- %s 2>&1 | FileCheck -check-prefix=CHECK-LDdMT %s
59 // CHECK-LDdMT: "-D_DEBUG"
60 // CHECK-LDdMT: "-D_MT"
61 // CHECK-LDdMT-NOT: "-D_DLL"
62 // CHECK-LDdMT: "--dependent-lib=libcmt"
63 
64 // RUN: %clang_cl -### /LD /MD -- %s 2>&1 | FileCheck -check-prefix=CHECK-LDMD %s
65 // RUN: %clang_cl -### /MD /LD -- %s 2>&1 | FileCheck -check-prefix=CHECK-LDMD %s
66 // CHECK-LDMD-NOT: "-D_DEBUG"
67 // CHECK-LDMD: "-D_MT"
68 // CHECK-LDMD: "-D_DLL"
69 // CHECK-LDMD: "--dependent-lib=msvcrt"
70 
71 // RUN: %clang_cl -### /LDd /MD -- %s 2>&1 | FileCheck -check-prefix=CHECK-LDdMD %s
72 // RUN: %clang_cl -### /MD /LDd -- %s 2>&1 | FileCheck -check-prefix=CHECK-LDdMD %s
73 // CHECK-LDdMD: "-D_DEBUG"
74 // CHECK-LDdMD: "-D_MT"
75 // CHECK-LDdMD: "-D_DLL"
76 // CHECK-LDdMD: "--dependent-lib=msvcrt"
77 
78 // RUN: %clang_cl -### /LD /MDd -- %s 2>&1 | FileCheck -check-prefix=CHECK-LDMDd %s
79 // RUN: %clang_cl -### /MDd /LD -- %s 2>&1 | FileCheck -check-prefix=CHECK-LDMDd %s
80 // RUN: %clang_cl -### /LDd /MDd -- %s 2>&1 | FileCheck -check-prefix=CHECK-LDMDd %s
81 // RUN: %clang_cl -### /MDd /LDd -- %s 2>&1 | FileCheck -check-prefix=CHECK-LDMDd %s
82 // CHECK-LDMDd: "-D_DEBUG"
83 // CHECK-LDMDd: "-D_MT"
84 // CHECK-LDMDd: "-D_DLL"
85 // CHECK-LDMDd: "--dependent-lib=msvcrtd"
86 
87 // RUN: %clang_cl /MD /MT -### -- %s 2>&1 | FileCheck -check-prefix=MTOVERRIDE %s
88 // MTOVERRIDE: "--dependent-lib=libcmt"
89 
90 // RUN: %clang_cl -### /Zl -- %s 2>&1 | FileCheck -check-prefix=CHECK-MTZl %s
91 // RUN: %clang_cl -### /MT /Zl -- %s 2>&1 | FileCheck -check-prefix=CHECK-MTZl %s
92 // CHECK-MTZl-NOT: "-D_DEBUG"
93 // CHECK-MTZl: "-D_MT"
94 // CHECK-MTZl-NOT: "-D_DLL"
95 // CHECK-MTZl-SAME: "-D_VC_NODEFAULTLIB"
96 // CHECK-MTZl-NOT: "--dependent-lib=libcmt"
97 // CHECK-MTZl-NOT: "--dependent-lib=oldnames"
98