2013-08-03 06:24:50 +08:00
|
|
|
// Note: %s must be preceded by --, otherwise it may be interpreted as a
|
|
|
|
// command-line option, e.g. on Mac where %s is commonly under /Users.
|
2013-08-01 04:51:53 +08:00
|
|
|
|
2013-08-03 06:24:50 +08:00
|
|
|
|
|
|
|
// Alias options:
|
|
|
|
|
2014-06-12 03:44:53 +08:00
|
|
|
// RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=c %s
|
|
|
|
// c: -c
|
|
|
|
|
|
|
|
// RUN: %clang_cl /C -### -- %s 2>&1 | FileCheck -check-prefix=C %s
|
|
|
|
// C: error: invalid argument '-C' only allowed with '/E, /P or /EP'
|
|
|
|
|
|
|
|
// RUN: %clang_cl /C /P -### -- %s 2>&1 | FileCheck -check-prefix=C_P %s
|
|
|
|
// C_P: "-E"
|
|
|
|
// C_P: "-C"
|
2013-08-03 06:24:50 +08:00
|
|
|
|
2017-04-28 01:19:07 +08:00
|
|
|
// RUN: %clang_cl /d1reportAllClassLayout -### -- %s 2>&1 | FileCheck -check-prefix=d1reportAllClassLayout %s
|
|
|
|
// d1reportAllClassLayout: -fdump-record-layouts
|
|
|
|
|
2016-01-13 07:31:58 +08:00
|
|
|
// RUN: %clang_cl /Dfoo=bar /D bar=baz /DMYDEF#value /DMYDEF2=foo#bar /DMYDEF3#a=b /DMYDEF4# \
|
2016-01-13 07:17:03 +08:00
|
|
|
// RUN: -### -- %s 2>&1 | FileCheck -check-prefix=D %s
|
2013-08-03 06:24:50 +08:00
|
|
|
// D: "-D" "foo=bar"
|
2016-01-13 07:17:03 +08:00
|
|
|
// D: "-D" "bar=baz"
|
|
|
|
// D: "-D" "MYDEF=value"
|
|
|
|
// D: "-D" "MYDEF2=foo#bar"
|
|
|
|
// D: "-D" "MYDEF3=a=b"
|
2016-01-13 07:31:58 +08:00
|
|
|
// D: "-D" "MYDEF4="
|
2013-08-03 06:24:50 +08:00
|
|
|
|
2013-12-21 02:40:46 +08:00
|
|
|
// RUN: %clang_cl /E -### -- %s 2>&1 | FileCheck -check-prefix=E %s
|
|
|
|
// E: "-E"
|
|
|
|
// E: "-o" "-"
|
|
|
|
|
2014-06-14 04:59:54 +08:00
|
|
|
// RUN: %clang_cl /EP -### -- %s 2>&1 | FileCheck -check-prefix=EP %s
|
|
|
|
// EP: "-E"
|
|
|
|
// EP: "-P"
|
|
|
|
// EP: "-o" "-"
|
|
|
|
|
2015-04-09 06:55:09 +08:00
|
|
|
// RUN: %clang_cl /fp:fast /fp:except -### -- %s 2>&1 | FileCheck -check-prefix=fpexcept %s
|
|
|
|
// fpexcept-NOT: -menable-unsafe-fp-math
|
|
|
|
|
|
|
|
// RUN: %clang_cl /fp:fast /fp:except /fp:except- -### -- %s 2>&1 | FileCheck -check-prefix=fpexcept_ %s
|
|
|
|
// fpexcept_: -menable-unsafe-fp-math
|
|
|
|
|
|
|
|
// RUN: %clang_cl /fp:precise /fp:fast -### -- %s 2>&1 | FileCheck -check-prefix=fpfast %s
|
|
|
|
// fpfast: -menable-unsafe-fp-math
|
|
|
|
// fpfast: -ffast-math
|
|
|
|
|
|
|
|
// RUN: %clang_cl /fp:fast /fp:precise -### -- %s 2>&1 | FileCheck -check-prefix=fpprecise %s
|
|
|
|
// fpprecise-NOT: -menable-unsafe-fp-math
|
|
|
|
// fpprecise-NOT: -ffast-math
|
|
|
|
|
|
|
|
// RUN: %clang_cl /fp:fast /fp:strict -### -- %s 2>&1 | FileCheck -check-prefix=fpstrict %s
|
|
|
|
// fpstrict-NOT: -menable-unsafe-fp-math
|
|
|
|
// fpstrict-NOT: -ffast-math
|
|
|
|
|
2016-08-26 02:24:35 +08:00
|
|
|
// RUN: %clang_cl /Z7 -gcolumn-info -### -- %s 2>&1 | FileCheck -check-prefix=gcolumn %s
|
|
|
|
// gcolumn: -dwarf-column-info
|
|
|
|
|
|
|
|
// RUN: %clang_cl /Z7 -gno-column-info -### -- %s 2>&1 | FileCheck -check-prefix=gnocolumn %s
|
|
|
|
// gnocolumn-NOT: -dwarf-column-info
|
|
|
|
|
|
|
|
// RUN: %clang_cl /Z7 -### -- %s 2>&1 | FileCheck -check-prefix=gdefcolumn %s
|
|
|
|
// gdefcolumn-NOT: -dwarf-column-info
|
|
|
|
|
2016-11-30 11:25:36 +08:00
|
|
|
// RUN: %clang_cl -### /FA -fprofile-instr-generate -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE %s
|
|
|
|
// RUN: %clang_cl -### /FA -fprofile-instr-generate=/tmp/somefile.profraw -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE-FILE %s
|
|
|
|
// RUN: %clang_cl -### /FA -fprofile-instr-generate -fprofile-instr-use -- %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
|
|
|
|
// RUN: %clang_cl -### /FA -fprofile-instr-generate -fprofile-instr-use=file -- %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MIX-GEN-USE %s
|
|
|
|
// CHECK-PROFILE-GENERATE: "-fprofile-instrument=clang"
|
|
|
|
// CHECK-PROFILE-GENERATE-FILE: "-fprofile-instrument-path=/tmp/somefile.profraw"
|
|
|
|
// CHECK-NO-MIX-GEN-USE: '{{[a-z=-]*}}' not allowed with '{{[a-z=-]*}}'
|
|
|
|
|
|
|
|
// RUN: %clang_cl -### /FA -fprofile-instr-use -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE %s
|
|
|
|
// RUN: %clang_cl -### /FA -fprofile-instr-use=/tmp/somefile.prof -- %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-USE-FILE %s
|
|
|
|
// CHECK-PROFILE-USE: "-fprofile-instrument-use-path=default.profdata"
|
|
|
|
// CHECK-PROFILE-USE-FILE: "-fprofile-instrument-use-path=/tmp/somefile.prof"
|
|
|
|
|
2015-05-20 12:39:56 +08:00
|
|
|
// RUN: %clang_cl /GA -### -- %s 2>&1 | FileCheck -check-prefix=GA %s
|
|
|
|
// GA: -ftls-model=local-exec
|
|
|
|
|
2013-08-03 06:24:50 +08:00
|
|
|
// RTTI is on by default; just check that we don't error.
|
|
|
|
// RUN: %clang_cl /Zs /GR -- %s 2>&1
|
|
|
|
|
|
|
|
// RUN: %clang_cl /GR- -### -- %s 2>&1 | FileCheck -check-prefix=GR_ %s
|
|
|
|
// GR_: -fno-rtti
|
|
|
|
|
2016-06-16 04:34:33 +08:00
|
|
|
// Security Buffer Check is on by default.
|
|
|
|
// RUN: %clang_cl -### -- %s 2>&1 | FileCheck -check-prefix=GS-default %s
|
|
|
|
// GS-default: "-stack-protector" "2"
|
|
|
|
|
|
|
|
// RUN: %clang_cl /GS -### -- %s 2>&1 | FileCheck -check-prefix=GS %s
|
|
|
|
// GS: "-stack-protector" "2"
|
|
|
|
|
|
|
|
// RUN: %clang_cl /GS- -### -- %s 2>&1 | FileCheck -check-prefix=GS_ %s
|
|
|
|
// GS_-NOT: -stack-protector
|
|
|
|
|
2014-03-24 01:47:22 +08:00
|
|
|
// RUN: %clang_cl /Gy -### -- %s 2>&1 | FileCheck -check-prefix=Gy %s
|
|
|
|
// Gy: -ffunction-sections
|
|
|
|
|
|
|
|
// RUN: %clang_cl /Gy /Gy- -### -- %s 2>&1 | FileCheck -check-prefix=Gy_ %s
|
|
|
|
// Gy_-NOT: -ffunction-sections
|
|
|
|
|
2015-01-21 03:45:50 +08:00
|
|
|
// RUN: %clang_cl /Gs -### -- %s 2>&1 | FileCheck -check-prefix=Gs %s
|
2018-09-26 15:39:04 +08:00
|
|
|
// Gs: "-mstack-probe-size=4096"
|
2015-01-21 03:45:50 +08:00
|
|
|
// RUN: %clang_cl /Gs0 -### -- %s 2>&1 | FileCheck -check-prefix=Gs0 %s
|
|
|
|
// Gs0: "-mstack-probe-size=0"
|
|
|
|
// RUN: %clang_cl /Gs4096 -### -- %s 2>&1 | FileCheck -check-prefix=Gs4096 %s
|
|
|
|
// Gs4096: "-mstack-probe-size=4096"
|
|
|
|
|
2014-04-08 00:14:38 +08:00
|
|
|
// RUN: %clang_cl /Gw -### -- %s 2>&1 | FileCheck -check-prefix=Gw %s
|
|
|
|
// Gw: -fdata-sections
|
|
|
|
|
|
|
|
// RUN: %clang_cl /Gw /Gw- -### -- %s 2>&1 | FileCheck -check-prefix=Gw_ %s
|
|
|
|
// Gw_-NOT: -fdata-sections
|
|
|
|
|
2013-09-27 01:41:14 +08:00
|
|
|
// RUN: %clang_cl /Imyincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_I %s
|
|
|
|
// RUN: %clang_cl /I myincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_I %s
|
|
|
|
// SLASH_I: "-I" "myincludedir"
|
2013-08-03 06:24:50 +08:00
|
|
|
|
2016-04-13 03:04:37 +08:00
|
|
|
// RUN: %clang_cl /imsvcmyincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_imsvc %s
|
|
|
|
// RUN: %clang_cl /imsvc myincludedir -### -- %s 2>&1 | FileCheck -check-prefix=SLASH_imsvc %s
|
|
|
|
// Clang's resource header directory should be first:
|
2016-04-14 23:32:24 +08:00
|
|
|
// SLASH_imsvc: "-internal-isystem" "{{[^"]*}}lib{{(64)?/|\\\\}}clang{{[^"]*}}include"
|
2016-04-13 03:04:37 +08:00
|
|
|
// SLASH_imsvc: "-internal-isystem" "myincludedir"
|
|
|
|
|
2013-08-03 06:24:50 +08:00
|
|
|
// RUN: %clang_cl /J -### -- %s 2>&1 | FileCheck -check-prefix=J %s
|
|
|
|
// J: -fno-signed-char
|
|
|
|
|
|
|
|
// RUN: %clang_cl /Ofoo -### -- %s 2>&1 | FileCheck -check-prefix=O %s
|
2015-07-27 15:32:11 +08:00
|
|
|
// O: /Ofoo
|
2013-08-03 06:24:50 +08:00
|
|
|
|
|
|
|
// RUN: %clang_cl /Ob0 -### -- %s 2>&1 | FileCheck -check-prefix=Ob0 %s
|
|
|
|
// Ob0: -fno-inline
|
|
|
|
|
2016-05-25 04:40:51 +08:00
|
|
|
// RUN: %clang_cl /Ob2 -### -- %s 2>&1 | FileCheck -check-prefix=Ob2 %s
|
2016-05-25 05:23:29 +08:00
|
|
|
// RUN: %clang_cl /Odb2 -### -- %s 2>&1 | FileCheck -check-prefix=Ob2 %s
|
2016-05-25 08:43:45 +08:00
|
|
|
// RUN: %clang_cl /O2 /Ob2 -### -- %s 2>&1 | FileCheck -check-prefix=Ob2 %s
|
|
|
|
// Ob2-NOT: warning: argument unused during compilation: '/O2'
|
2016-05-25 04:40:51 +08:00
|
|
|
// Ob2: -finline-functions
|
|
|
|
|
2016-06-23 00:56:16 +08:00
|
|
|
// RUN: %clang_cl /Ob1 -### -- %s 2>&1 | FileCheck -check-prefix=Ob1 %s
|
|
|
|
// RUN: %clang_cl /Odb1 -### -- %s 2>&1 | FileCheck -check-prefix=Ob1 %s
|
|
|
|
// Ob1: -finline-hint-functions
|
|
|
|
|
2013-08-03 06:24:50 +08:00
|
|
|
// RUN: %clang_cl /Od -### -- %s 2>&1 | FileCheck -check-prefix=Od %s
|
|
|
|
// Od: -O0
|
|
|
|
|
2013-08-09 07:44:01 +08:00
|
|
|
// RUN: %clang_cl /Oi- /Oi -### -- %s 2>&1 | FileCheck -check-prefix=Oi %s
|
|
|
|
// Oi-NOT: -fno-builtin
|
|
|
|
|
|
|
|
// RUN: %clang_cl /Oi- -### -- %s 2>&1 | FileCheck -check-prefix=Oi_ %s
|
|
|
|
// Oi_: -fno-builtin
|
|
|
|
|
2015-10-03 15:15:28 +08:00
|
|
|
// RUN: %clang_cl /Os --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Os %s
|
|
|
|
// RUN: %clang_cl /Os --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Os %s
|
2015-07-27 15:32:11 +08:00
|
|
|
// Os-NOT: -mdisable-fp-elim
|
|
|
|
// Os: -momit-leaf-frame-pointer
|
2013-08-03 06:24:50 +08:00
|
|
|
// Os: -Os
|
|
|
|
|
2015-10-03 15:15:28 +08:00
|
|
|
// RUN: %clang_cl /Ot --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ot %s
|
|
|
|
// RUN: %clang_cl /Ot --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ot %s
|
2015-07-27 15:32:11 +08:00
|
|
|
// Ot-NOT: -mdisable-fp-elim
|
|
|
|
// Ot: -momit-leaf-frame-pointer
|
2013-08-03 06:24:50 +08:00
|
|
|
// Ot: -O2
|
|
|
|
|
2015-10-03 15:15:28 +08:00
|
|
|
// RUN: %clang_cl /Ox --target=i686-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s
|
|
|
|
// RUN: %clang_cl /Ox --target=x86_64-pc-windows-msvc -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s
|
2015-07-27 15:32:11 +08:00
|
|
|
// Ox-NOT: -mdisable-fp-elim
|
|
|
|
// Ox: -momit-leaf-frame-pointer
|
|
|
|
// Ox: -O2
|
|
|
|
|
2015-08-25 08:46:45 +08:00
|
|
|
// RUN: %clang_cl --target=i686-pc-win32 /O2sy- -### -- %s 2>&1 | FileCheck -check-prefix=PR24003 %s
|
2015-07-27 15:32:11 +08:00
|
|
|
// PR24003: -mdisable-fp-elim
|
|
|
|
// PR24003: -momit-leaf-frame-pointer
|
|
|
|
// PR24003: -Os
|
2013-08-03 06:24:50 +08:00
|
|
|
|
2016-03-23 23:37:41 +08:00
|
|
|
// RUN: %clang_cl --target=i686-pc-win32 -Werror /Oy- /O2 -### -- %s 2>&1 | FileCheck -check-prefix=Oy_2 %s
|
2016-01-22 07:01:11 +08:00
|
|
|
// Oy_2: -momit-leaf-frame-pointer
|
|
|
|
// Oy_2: -O2
|
|
|
|
|
2019-02-07 20:46:49 +08:00
|
|
|
// RUN: %clang_cl --target=aarch64-pc-windows-msvc -Werror /Oy- /O2 -### -- %s 2>&1 | FileCheck -check-prefix=Oy_aarch64 %s
|
|
|
|
// Oy_aarch64: -mdisable-fp-elim
|
|
|
|
// Oy_aarch64: -O2
|
|
|
|
|
2017-10-03 08:14:03 +08:00
|
|
|
// RUN: %clang_cl --target=i686-pc-win32 -Werror /O2 /O2 -### -- %s 2>&1 | FileCheck -check-prefix=O2O2 %s
|
|
|
|
// O2O2: "-O2"
|
|
|
|
|
2016-03-23 23:37:41 +08:00
|
|
|
// RUN: %clang_cl /Zs -Werror /Oy -- %s 2>&1
|
2013-08-03 06:24:50 +08:00
|
|
|
|
2016-03-23 23:37:41 +08:00
|
|
|
// RUN: %clang_cl --target=i686-pc-win32 -Werror /Oy- -### -- %s 2>&1 | FileCheck -check-prefix=Oy_ %s
|
2013-08-03 06:24:50 +08:00
|
|
|
// Oy_: -mdisable-fp-elim
|
|
|
|
|
2015-05-14 13:19:17 +08:00
|
|
|
// RUN: %clang_cl /Qvec -### -- %s 2>&1 | FileCheck -check-prefix=Qvec %s
|
|
|
|
// Qvec: -vectorize-loops
|
|
|
|
|
|
|
|
// RUN: %clang_cl /Qvec /Qvec- -### -- %s 2>&1 | FileCheck -check-prefix=Qvec_ %s
|
|
|
|
// Qvec_-NOT: -vectorize-loops
|
|
|
|
|
2013-08-09 08:32:23 +08:00
|
|
|
// RUN: %clang_cl /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes %s
|
|
|
|
// showIncludes: --show-includes
|
|
|
|
|
2014-07-22 07:42:07 +08:00
|
|
|
// RUN: %clang_cl /E /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s
|
|
|
|
// RUN: %clang_cl /EP /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s
|
2017-10-21 03:18:30 +08:00
|
|
|
// RUN: %clang_cl /E /EP /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s
|
2018-05-04 23:58:31 +08:00
|
|
|
// RUN: %clang_cl /EP /P /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes_E %s
|
|
|
|
// showIncludes_E-NOT: warning: argument unused during compilation: '--show-includes'
|
2017-10-21 03:18:30 +08:00
|
|
|
|
2016-08-24 00:47:09 +08:00
|
|
|
// /source-charset: should warn on everything except UTF-8.
|
|
|
|
// RUN: %clang_cl /source-charset:utf-16 -### -- %s 2>&1 | FileCheck -check-prefix=source-charset-utf-16 %s
|
|
|
|
// source-charset-utf-16: invalid value 'utf-16'
|
|
|
|
|
2016-08-27 05:11:43 +08:00
|
|
|
// /execution-charset: should warn on everything except UTF-8.
|
|
|
|
// RUN: %clang_cl /execution-charset:utf-16 -### -- %s 2>&1 | FileCheck -check-prefix=execution-charset-utf-16 %s
|
|
|
|
// execution-charset-utf-16: invalid value 'utf-16'
|
|
|
|
//
|
2013-08-03 06:24:50 +08:00
|
|
|
// RUN: %clang_cl /Umymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
|
|
|
|
// RUN: %clang_cl /U mymacro -### -- %s 2>&1 | FileCheck -check-prefix=U %s
|
|
|
|
// U: "-U" "mymacro"
|
|
|
|
|
2016-08-27 05:51:14 +08:00
|
|
|
// RUN: %clang_cl /validate-charset -### -- %s 2>&1 | FileCheck -check-prefix=validate-charset %s
|
|
|
|
// validate-charset: -Winvalid-source-encoding
|
|
|
|
|
|
|
|
// RUN: %clang_cl /validate-charset- -### -- %s 2>&1 | FileCheck -check-prefix=validate-charset_ %s
|
|
|
|
// validate-charset_: -Wno-invalid-source-encoding
|
|
|
|
|
2014-03-24 01:47:18 +08:00
|
|
|
// RUN: %clang_cl /vd2 -### -- %s 2>&1 | FileCheck -check-prefix=VD2 %s
|
|
|
|
// VD2: -vtordisp-mode=2
|
|
|
|
|
2014-02-12 05:05:00 +08:00
|
|
|
// RUN: %clang_cl /vmg -### -- %s 2>&1 | FileCheck -check-prefix=VMG %s
|
|
|
|
// VMG: "-fms-memptr-rep=virtual"
|
|
|
|
|
|
|
|
// RUN: %clang_cl /vmg /vms -### -- %s 2>&1 | FileCheck -check-prefix=VMS %s
|
|
|
|
// VMS: "-fms-memptr-rep=single"
|
|
|
|
|
|
|
|
// RUN: %clang_cl /vmg /vmm -### -- %s 2>&1 | FileCheck -check-prefix=VMM %s
|
|
|
|
// VMM: "-fms-memptr-rep=multiple"
|
|
|
|
|
|
|
|
// RUN: %clang_cl /vmg /vmv -### -- %s 2>&1 | FileCheck -check-prefix=VMV %s
|
|
|
|
// VMV: "-fms-memptr-rep=virtual"
|
|
|
|
|
|
|
|
// RUN: %clang_cl /vmg /vmb -### -- %s 2>&1 | FileCheck -check-prefix=VMB %s
|
|
|
|
// VMB: '/vmg' not allowed with '/vmb'
|
|
|
|
|
|
|
|
// RUN: %clang_cl /vmg /vmm /vms -### -- %s 2>&1 | FileCheck -check-prefix=VMX %s
|
|
|
|
// VMX: '/vms' not allowed with '/vmm'
|
|
|
|
|
2015-02-14 09:35:12 +08:00
|
|
|
// RUN: %clang_cl /volatile:iso -### -- %s 2>&1 | FileCheck -check-prefix=VOLATILE-ISO %s
|
|
|
|
// VOLATILE-ISO-NOT: "-fms-volatile"
|
|
|
|
|
|
|
|
// RUN: %clang_cl /volatile:ms -### -- %s 2>&1 | FileCheck -check-prefix=VOLATILE-MS %s
|
|
|
|
// VOLATILE-MS: "-fms-volatile"
|
|
|
|
|
2013-08-03 06:24:50 +08:00
|
|
|
// RUN: %clang_cl /W0 -### -- %s 2>&1 | FileCheck -check-prefix=W0 %s
|
|
|
|
// W0: -w
|
|
|
|
|
|
|
|
// RUN: %clang_cl /W1 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
|
|
|
|
// RUN: %clang_cl /W2 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
|
|
|
|
// RUN: %clang_cl /W3 -### -- %s 2>&1 | FileCheck -check-prefix=W1 %s
|
2015-12-12 06:31:16 +08:00
|
|
|
// RUN: %clang_cl /W4 -### -- %s 2>&1 | FileCheck -check-prefix=W4 %s
|
2017-11-28 07:42:20 +08:00
|
|
|
// RUN: %clang_cl /Wall -### -- %s 2>&1 | FileCheck -check-prefix=Weverything %s
|
2013-08-03 06:24:50 +08:00
|
|
|
// W1: -Wall
|
2015-12-12 06:31:16 +08:00
|
|
|
// W4: -WCL4
|
2017-11-28 07:42:20 +08:00
|
|
|
// Weverything: -Weverything
|
2013-08-03 06:24:50 +08:00
|
|
|
|
|
|
|
// RUN: %clang_cl /WX -### -- %s 2>&1 | FileCheck -check-prefix=WX %s
|
|
|
|
// WX: -Werror
|
|
|
|
|
|
|
|
// RUN: %clang_cl /WX- -### -- %s 2>&1 | FileCheck -check-prefix=WX_ %s
|
|
|
|
// WX_: -Wno-error
|
|
|
|
|
|
|
|
// RUN: %clang_cl /w -### -- %s 2>&1 | FileCheck -check-prefix=w %s
|
|
|
|
// w: -w
|
|
|
|
|
2014-07-26 01:30:10 +08:00
|
|
|
// RUN: %clang_cl /Zp -### -- %s 2>&1 | FileCheck -check-prefix=ZP %s
|
|
|
|
// ZP: -fpack-struct=1
|
|
|
|
|
|
|
|
// RUN: %clang_cl /Zp2 -### -- %s 2>&1 | FileCheck -check-prefix=ZP2 %s
|
|
|
|
// ZP2: -fpack-struct=2
|
|
|
|
|
2013-08-03 06:24:50 +08:00
|
|
|
// RUN: %clang_cl /Zs -### -- %s 2>&1 | FileCheck -check-prefix=Zs %s
|
|
|
|
// Zs: -fsyntax-only
|
|
|
|
|
2013-09-27 01:41:14 +08:00
|
|
|
// RUN: %clang_cl /FIasdf.h -### -- %s 2>&1 | FileCheck -check-prefix=FI %s
|
|
|
|
// FI: "-include" "asdf.h"
|
|
|
|
|
2013-10-30 03:42:01 +08:00
|
|
|
// RUN: %clang_cl /FI asdf.h -### -- %s 2>&1 | FileCheck -check-prefix=FI_ %s
|
|
|
|
// FI_: "-include" "asdf.h"
|
|
|
|
|
2016-02-29 09:40:36 +08:00
|
|
|
// RUN: %clang_cl /TP /c -### -- %s 2>&1 | FileCheck -check-prefix=NO-GX %s
|
2016-02-23 01:44:51 +08:00
|
|
|
// NO-GX-NOT: "-fcxx-exceptions" "-fexceptions"
|
|
|
|
|
2016-02-29 09:40:36 +08:00
|
|
|
// RUN: %clang_cl /TP /c /GX -### -- %s 2>&1 | FileCheck -check-prefix=GX %s
|
2016-02-20 17:23:44 +08:00
|
|
|
// GX: "-fcxx-exceptions" "-fexceptions"
|
|
|
|
|
2016-02-29 09:40:36 +08:00
|
|
|
// RUN: %clang_cl /TP /c /GX /GX- -### -- %s 2>&1 | FileCheck -check-prefix=GX_ %s
|
2016-02-20 17:23:44 +08:00
|
|
|
// GX_-NOT: "-fcxx-exceptions" "-fexceptions"
|
|
|
|
|
2018-02-20 18:47:14 +08:00
|
|
|
// RUN: %clang_cl /d1PP -### -- %s 2>&1 | FileCheck -check-prefix=d1PP %s
|
|
|
|
// d1PP: -dD
|
|
|
|
|
2013-09-04 07:18:43 +08:00
|
|
|
// We forward any unrecognized -W diagnostic options to cc1.
|
|
|
|
// RUN: %clang_cl -Wunused-pragmas -### -- %s 2>&1 | FileCheck -check-prefix=WJoined %s
|
|
|
|
// WJoined: "-cc1"
|
|
|
|
// WJoined: "-Wunused-pragmas"
|
2013-08-03 06:24:50 +08:00
|
|
|
|
2014-04-10 04:07:39 +08:00
|
|
|
// We recognize -f[no-]strict-aliasing.
|
|
|
|
// RUN: %clang_cl -c -### -- %s 2>&1 | FileCheck -check-prefix=DEFAULTSTRICT %s
|
|
|
|
// DEFAULTSTRICT: "-relaxed-aliasing"
|
|
|
|
// RUN: %clang_cl -c -fstrict-aliasing -### -- %s 2>&1 | FileCheck -check-prefix=STRICT %s
|
|
|
|
// STRICT-NOT: "-relaxed-aliasing"
|
|
|
|
// RUN: %clang_cl -c -fno-strict-aliasing -### -- %s 2>&1 | FileCheck -check-prefix=NOSTRICT %s
|
|
|
|
// NOSTRICT: "-relaxed-aliasing"
|
|
|
|
|
2017-01-05 03:15:53 +08:00
|
|
|
// We recognize -f[no-]delayed-template-parsing.
|
2017-04-18 05:28:36 +08:00
|
|
|
// /Zc:twoPhase[-] has the opposite meaning.
|
2017-01-05 03:15:53 +08:00
|
|
|
// RUN: %clang_cl -c -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDDEFAULT %s
|
|
|
|
// DELAYEDDEFAULT: "-fdelayed-template-parsing"
|
|
|
|
// RUN: %clang_cl -c -fdelayed-template-parsing -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDON %s
|
2017-04-18 05:28:36 +08:00
|
|
|
// RUN: %clang_cl -c /Zc:twoPhase- -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDON %s
|
2017-01-05 03:15:53 +08:00
|
|
|
// DELAYEDON: "-fdelayed-template-parsing"
|
|
|
|
// RUN: %clang_cl -c -fno-delayed-template-parsing -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDOFF %s
|
2017-04-18 05:28:36 +08:00
|
|
|
// RUN: %clang_cl -c /Zc:twoPhase -### -- %s 2>&1 | FileCheck -check-prefix=DELAYEDOFF %s
|
2017-01-05 03:15:53 +08:00
|
|
|
// DELAYEDOFF-NOT: "-fdelayed-template-parsing"
|
|
|
|
|
2014-04-04 09:36:55 +08:00
|
|
|
// For some warning ids, we can map from MSVC warning to Clang warning.
|
2015-12-16 01:07:16 +08:00
|
|
|
// RUN: %clang_cl -wd4005 -wd4100 -wd4910 -wd4996 -### -- %s 2>&1 | FileCheck -check-prefix=Wno %s
|
2015-02-18 07:28:19 +08:00
|
|
|
// Wno: "-cc1"
|
|
|
|
// Wno: "-Wno-macro-redefined"
|
2015-12-16 01:07:16 +08:00
|
|
|
// Wno: "-Wno-unused-parameter"
|
2015-06-12 02:14:11 +08:00
|
|
|
// Wno: "-Wno-dllexport-explicit-instantiation-decl"
|
2015-12-16 01:07:16 +08:00
|
|
|
// Wno: "-Wno-deprecated-declarations"
|
2013-09-17 08:03:41 +08:00
|
|
|
|
2013-08-03 06:24:50 +08:00
|
|
|
// Ignored options. Check that we don't get "unused during compilation" errors.
|
2015-03-03 06:09:05 +08:00
|
|
|
// RUN: %clang_cl /c \
|
2013-11-16 02:29:58 +08:00
|
|
|
// RUN: /analyze- \
|
2015-09-19 04:49:33 +08:00
|
|
|
// RUN: /bigobj \
|
2014-12-14 06:24:16 +08:00
|
|
|
// RUN: /cgthreads4 \
|
|
|
|
// RUN: /cgthreads8 \
|
2016-03-30 03:41:02 +08:00
|
|
|
// RUN: /d2FastFail \
|
2014-11-15 02:24:08 +08:00
|
|
|
// RUN: /d2Zi+ \
|
2013-11-16 02:29:58 +08:00
|
|
|
// RUN: /errorReport:foo \
|
2016-08-27 05:11:43 +08:00
|
|
|
// RUN: /execution-charset:utf-8 \
|
2016-03-22 01:19:31 +08:00
|
|
|
// RUN: /FC \
|
2015-02-26 03:17:50 +08:00
|
|
|
// RUN: /Fdfoo \
|
2013-11-16 02:29:58 +08:00
|
|
|
// RUN: /FS \
|
2014-12-14 06:13:23 +08:00
|
|
|
// RUN: /Gd \
|
2013-11-16 02:29:58 +08:00
|
|
|
// RUN: /GF \
|
|
|
|
// RUN: /GS- \
|
|
|
|
// RUN: /kernel- \
|
|
|
|
// RUN: /nologo \
|
2018-04-20 21:10:44 +08:00
|
|
|
// RUN: /Og \
|
2015-03-03 06:09:05 +08:00
|
|
|
// RUN: /openmp- \
|
2018-01-24 23:18:12 +08:00
|
|
|
// RUN: /permissive- \
|
2013-11-16 02:29:58 +08:00
|
|
|
// RUN: /RTC1 \
|
|
|
|
// RUN: /sdl \
|
|
|
|
// RUN: /sdl- \
|
2016-08-24 00:47:09 +08:00
|
|
|
// RUN: /source-charset:utf-8 \
|
2016-08-27 05:26:29 +08:00
|
|
|
// RUN: /utf-8 \
|
2013-11-16 02:29:58 +08:00
|
|
|
// RUN: /vmg \
|
2014-12-14 06:44:46 +08:00
|
|
|
// RUN: /volatile:iso \
|
2013-11-16 02:29:58 +08:00
|
|
|
// RUN: /w12345 \
|
|
|
|
// RUN: /wd1234 \
|
2018-04-20 21:10:44 +08:00
|
|
|
// RUN: /Zc:__cplusplus \
|
|
|
|
// RUN: /Zc:auto \
|
|
|
|
// RUN: /Zc:forScope \
|
|
|
|
// RUN: /Zc:inline \
|
|
|
|
// RUN: /Zc:rvalueCast \
|
|
|
|
// RUN: /Zc:ternary \
|
|
|
|
// RUN: /Zc:wchar_t \
|
|
|
|
// RUN: /Zm \
|
2014-11-15 02:24:08 +08:00
|
|
|
// RUN: /Zo \
|
|
|
|
// RUN: /Zo- \
|
2014-03-29 04:45:05 +08:00
|
|
|
// RUN: -### -- %s 2>&1 | FileCheck -check-prefix=IGNORED %s
|
|
|
|
// IGNORED-NOT: argument unused during compilation
|
2014-11-15 02:24:08 +08:00
|
|
|
// IGNORED-NOT: no such file or directory
|
2015-03-03 06:09:05 +08:00
|
|
|
// Don't confuse /openmp- with the /o flag:
|
|
|
|
// IGNORED-NOT: "-o" "penmp-.obj"
|
2013-08-03 06:24:50 +08:00
|
|
|
|
2013-09-17 08:03:41 +08:00
|
|
|
// Ignored options and compile-only options are ignored for link jobs.
|
2013-09-17 08:50:43 +08:00
|
|
|
// RUN: touch %t.obj
|
2013-09-17 08:03:41 +08:00
|
|
|
// RUN: %clang_cl /nologo -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
|
|
|
|
// RUN: %clang_cl /Dfoo -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
|
|
|
|
// RUN: %clang_cl /MD -### -- %t.obj 2>&1 | FileCheck -check-prefix=LINKUNUSED %s
|
|
|
|
// LINKUNUSED-NOT: argument unused during compilation
|
|
|
|
|
2013-09-05 18:09:03 +08:00
|
|
|
// Support ignoring warnings about unused arguments.
|
|
|
|
// RUN: %clang_cl /Abracadabra -Qunused-arguments -### -- %s 2>&1 | FileCheck -check-prefix=UNUSED %s
|
2014-03-29 04:45:05 +08:00
|
|
|
// UNUSED-NOT: argument unused during compilation
|
2013-09-05 18:09:03 +08:00
|
|
|
|
2013-08-03 06:24:50 +08:00
|
|
|
// Unsupported but parsed options. Check that we don't error on them.
|
|
|
|
// (/Zs is for syntax-only)
|
2013-11-16 02:29:58 +08:00
|
|
|
// RUN: %clang_cl /Zs \
|
|
|
|
// RUN: /AIfoo \
|
2019-01-25 06:26:51 +08:00
|
|
|
// RUN: /AI foo_does_not_exist \
|
2018-01-24 23:18:12 +08:00
|
|
|
// RUN: /Bt \
|
|
|
|
// RUN: /Bt+ \
|
2013-11-16 02:29:58 +08:00
|
|
|
// RUN: /clr:pure \
|
|
|
|
// RUN: /docname \
|
|
|
|
// RUN: /EHsc \
|
|
|
|
// RUN: /F \
|
|
|
|
// RUN: /FA \
|
|
|
|
// RUN: /FAc \
|
|
|
|
// RUN: /Fafilename \
|
|
|
|
// RUN: /FAs \
|
|
|
|
// RUN: /FAu \
|
|
|
|
// RUN: /favor:blend \
|
|
|
|
// RUN: /Fifoo \
|
|
|
|
// RUN: /Fmfoo \
|
|
|
|
// RUN: /FpDebug\main.pch \
|
|
|
|
// RUN: /Frfoo \
|
|
|
|
// RUN: /FRfoo \
|
|
|
|
// RUN: /FU foo \
|
|
|
|
// RUN: /Fx \
|
|
|
|
// RUN: /G1 \
|
|
|
|
// RUN: /G2 \
|
|
|
|
// RUN: /GA \
|
|
|
|
// RUN: /Gd \
|
|
|
|
// RUN: /Ge \
|
|
|
|
// RUN: /Gh \
|
|
|
|
// RUN: /GH \
|
|
|
|
// RUN: /GL \
|
|
|
|
// RUN: /GL- \
|
|
|
|
// RUN: /Gm \
|
|
|
|
// RUN: /Gm- \
|
|
|
|
// RUN: /Gr \
|
|
|
|
// RUN: /GS \
|
|
|
|
// RUN: /GT \
|
|
|
|
// RUN: /GX \
|
2014-12-14 06:06:23 +08:00
|
|
|
// RUN: /Gv \
|
2013-11-16 02:29:58 +08:00
|
|
|
// RUN: /Gz \
|
|
|
|
// RUN: /GZ \
|
|
|
|
// RUN: /H \
|
|
|
|
// RUN: /homeparams \
|
|
|
|
// RUN: /hotpatch \
|
2018-08-06 19:34:46 +08:00
|
|
|
// RUN: /JMC \
|
2013-11-16 02:29:58 +08:00
|
|
|
// RUN: /kernel \
|
|
|
|
// RUN: /LN \
|
|
|
|
// RUN: /MP \
|
|
|
|
// RUN: /o foo.obj \
|
|
|
|
// RUN: /ofoo.obj \
|
|
|
|
// RUN: /openmp \
|
|
|
|
// RUN: /Qfast_transcendentals \
|
|
|
|
// RUN: /QIfist \
|
|
|
|
// RUN: /Qimprecise_fwaits \
|
|
|
|
// RUN: /Qpar \
|
|
|
|
// RUN: /Qvec-report:2 \
|
|
|
|
// RUN: /u \
|
|
|
|
// RUN: /V \
|
2014-12-14 06:44:46 +08:00
|
|
|
// RUN: /volatile:ms \
|
2013-11-16 02:29:58 +08:00
|
|
|
// RUN: /wfoo \
|
|
|
|
// RUN: /WL \
|
|
|
|
// RUN: /Wp64 \
|
|
|
|
// RUN: /X \
|
|
|
|
// RUN: /Y- \
|
|
|
|
// RUN: /Yc \
|
|
|
|
// RUN: /Ycstdafx.h \
|
|
|
|
// RUN: /Yd \
|
|
|
|
// RUN: /Yl- \
|
|
|
|
// RUN: /Ylfoo \
|
|
|
|
// RUN: /Yustdafx.h \
|
|
|
|
// RUN: /Z7 \
|
|
|
|
// RUN: /Za \
|
|
|
|
// RUN: /Ze \
|
|
|
|
// RUN: /Zg \
|
|
|
|
// RUN: /Zi \
|
|
|
|
// RUN: /ZI \
|
|
|
|
// RUN: /Zl \
|
|
|
|
// RUN: /ZW:nostdlib \
|
|
|
|
// RUN: -- %s 2>&1
|
2013-08-20 02:32:59 +08:00
|
|
|
|
|
|
|
// We support -Xclang for forwarding options to cc1.
|
|
|
|
// RUN: %clang_cl -Xclang hellocc1 -### -- %s 2>&1 | FileCheck -check-prefix=Xclang %s
|
|
|
|
// Xclang: "-cc1"
|
|
|
|
// Xclang: "hellocc1"
|
2013-09-17 08:03:41 +08:00
|
|
|
|
2017-01-28 01:09:41 +08:00
|
|
|
// Files under /Users are often confused with the /U flag. (This could happen
|
|
|
|
// for other flags too, but this is the one people run into.)
|
|
|
|
// RUN: %clang_cl /c /Users/me/myfile.c -### 2>&1 | FileCheck -check-prefix=SlashU %s
|
|
|
|
// SlashU: warning: '/Users/me/myfile.c' treated as the '/U' option
|
|
|
|
// SlashU: note: Use '--' to treat subsequent arguments as filenames
|
|
|
|
|
2014-07-02 06:24:56 +08:00
|
|
|
// RTTI is on by default. /GR- controls -fno-rtti-data.
|
|
|
|
// RUN: %clang_cl /c /GR- -### -- %s 2>&1 | FileCheck -check-prefix=NoRTTI %s
|
|
|
|
// NoRTTI: "-fno-rtti-data"
|
|
|
|
// NoRTTI-NOT: "-fno-rtti"
|
2014-02-26 02:36:22 +08:00
|
|
|
// RUN: %clang_cl /c /GR -### -- %s 2>&1 | FileCheck -check-prefix=RTTI %s
|
2014-07-02 06:24:56 +08:00
|
|
|
// RTTI-NOT: "-fno-rtti-data"
|
2014-02-26 02:36:22 +08:00
|
|
|
// RTTI-NOT: "-fno-rtti"
|
|
|
|
|
2015-03-22 16:39:22 +08:00
|
|
|
// thread safe statics are off for versions < 19.
|
2016-05-14 07:20:11 +08:00
|
|
|
// RUN: %clang_cl /c -### -fms-compatibility-version=18 -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
|
2015-03-22 16:39:22 +08:00
|
|
|
// RUN: %clang_cl /Zc:threadSafeInit /Zc:threadSafeInit- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s
|
|
|
|
// NoThreadSafeStatics: "-fno-threadsafe-statics"
|
|
|
|
|
|
|
|
// RUN: %clang_cl /Zc:threadSafeInit /c -### -- %s 2>&1 | FileCheck -check-prefix=ThreadSafeStatics %s
|
|
|
|
// ThreadSafeStatics-NOT: "-fno-threadsafe-statics"
|
|
|
|
|
Add /Zc:DllexportInlines option to clang-cl
Summary:
This CL adds /Zc:DllexportInlines flag to clang-cl.
When Zc:DllexportInlines- is specified, inline class member function is not exported if the function does not have local static variables.
By not exporting inline function, code for those functions are not generated and that reduces both compile time and obj size. Also this flag does not import inline functions from dllimported class if the function does not have local static variables.
On my 24C48T windows10 machine, build performance of chrome target in chromium repository is like below.
These stats are come with 'target_cpu="x86" enable_nacl = false is_component_build=true dcheck_always_on=true` build config and applied
* https://chromium-review.googlesource.com/c/chromium/src/+/1212379
* https://chromium-review.googlesource.com/c/v8/v8/+/1186017
Below stats were taken with this patch applied on https://github.com/llvm-project/llvm-project-20170507/commit/a05115cd4c57ff76b0f529e38118765b58ed7f2e
| config | build time | speedup | build dir size |
| with patch, PCH on, debug | 1h10m0s | x1.13 | 35.6GB |
| without patch, PCH on, debug | 1h19m17s | | 49.0GB |
| with patch, PCH off, debug | 1h15m45s | x1.16 | 33.7GB |
| without patch, PCH off, debug | 1h28m10s | | 52.3GB |
| with patch, PCH on, release | 1h13m13s | x1.22 | 26.2GB |
| without patch, PCH on, release | 1h29m57s | | 37.5GB |
| with patch, PCH off, release | 1h23m38s | x1.32 | 23.7GB |
| without patch, PCH off, release | 1h50m50s | | 38.7GB |
This patch reduced obj size and the number of exported symbols largely, that improved link time too.
e.g. link time stats of blink_core.dll become like below
| | cold disk cache | warm disk cache |
| with patch, PCH on, debug | 71s | 30s |
| without patch, PCH on, debug | 111s | 48s |
This patch's implementation is based on Nico Weber's patch. I modified to support static local variable, added tests and took stats.
Bug: https://bugs.llvm.org/show_bug.cgi?id=33628
Reviewers: hans, thakis, rnk, javed.absar
Reviewed By: hans
Subscribers: kristof.beyls, smeenai, dschuff, probinson, cfe-commits, eraman
Differential Revision: https://reviews.llvm.org/D51340
llvm-svn: 346069
2018-11-03 14:45:00 +08:00
|
|
|
// RUN: %clang_cl /Zc:dllexportInlines- /c -### -- %s 2>&1 | FileCheck -check-prefix=NoDllExportInlines %s
|
|
|
|
// NoDllExportInlines: "-fno-dllexport-inlines"
|
|
|
|
// RUN: %clang_cl /Zc:dllexportInlines /c -### -- %s 2>&1 | FileCheck -check-prefix=DllExportInlines %s
|
|
|
|
// DllExportInlines-NOT: "-fno-dllexport-inlines"
|
2018-11-09 21:25:45 +08:00
|
|
|
// RUN: %clang_cl /fallback /Zc:dllexportInlines- /c -### -- %s 2>&1 | FileCheck -check-prefix=DllExportInlinesFallback %s
|
2018-11-13 12:14:09 +08:00
|
|
|
// DllExportInlinesFallback: error: option '/Zc:dllexportInlines-' is ABI-changing and not compatible with '/fallback'
|
Add /Zc:DllexportInlines option to clang-cl
Summary:
This CL adds /Zc:DllexportInlines flag to clang-cl.
When Zc:DllexportInlines- is specified, inline class member function is not exported if the function does not have local static variables.
By not exporting inline function, code for those functions are not generated and that reduces both compile time and obj size. Also this flag does not import inline functions from dllimported class if the function does not have local static variables.
On my 24C48T windows10 machine, build performance of chrome target in chromium repository is like below.
These stats are come with 'target_cpu="x86" enable_nacl = false is_component_build=true dcheck_always_on=true` build config and applied
* https://chromium-review.googlesource.com/c/chromium/src/+/1212379
* https://chromium-review.googlesource.com/c/v8/v8/+/1186017
Below stats were taken with this patch applied on https://github.com/llvm-project/llvm-project-20170507/commit/a05115cd4c57ff76b0f529e38118765b58ed7f2e
| config | build time | speedup | build dir size |
| with patch, PCH on, debug | 1h10m0s | x1.13 | 35.6GB |
| without patch, PCH on, debug | 1h19m17s | | 49.0GB |
| with patch, PCH off, debug | 1h15m45s | x1.16 | 33.7GB |
| without patch, PCH off, debug | 1h28m10s | | 52.3GB |
| with patch, PCH on, release | 1h13m13s | x1.22 | 26.2GB |
| without patch, PCH on, release | 1h29m57s | | 37.5GB |
| with patch, PCH off, release | 1h23m38s | x1.32 | 23.7GB |
| without patch, PCH off, release | 1h50m50s | | 38.7GB |
This patch reduced obj size and the number of exported symbols largely, that improved link time too.
e.g. link time stats of blink_core.dll become like below
| | cold disk cache | warm disk cache |
| with patch, PCH on, debug | 71s | 30s |
| without patch, PCH on, debug | 111s | 48s |
This patch's implementation is based on Nico Weber's patch. I modified to support static local variable, added tests and took stats.
Bug: https://bugs.llvm.org/show_bug.cgi?id=33628
Reviewers: hans, thakis, rnk, javed.absar
Reviewed By: hans
Subscribers: kristof.beyls, smeenai, dschuff, probinson, cfe-commits, eraman
Differential Revision: https://reviews.llvm.org/D51340
llvm-svn: 346069
2018-11-03 14:45:00 +08:00
|
|
|
|
2015-08-06 02:51:13 +08:00
|
|
|
// RUN: %clang_cl /Zi /c -### -- %s 2>&1 | FileCheck -check-prefix=Zi %s
|
|
|
|
// Zi: "-gcodeview"
|
2016-02-11 05:28:38 +08:00
|
|
|
// Zi: "-debug-info-kind=limited"
|
2015-08-06 02:51:13 +08:00
|
|
|
|
|
|
|
// RUN: %clang_cl /Z7 /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7 %s
|
|
|
|
// Z7: "-gcodeview"
|
2016-02-11 05:28:38 +08:00
|
|
|
// Z7: "-debug-info-kind=limited"
|
2015-10-08 12:24:12 +08:00
|
|
|
|
2016-07-10 05:49:16 +08:00
|
|
|
// RUN: %clang_cl /Zd /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7GMLT %s
|
2016-03-19 02:42:56 +08:00
|
|
|
// Z7GMLT: "-gcodeview"
|
|
|
|
// Z7GMLT: "-debug-info-kind=line-tables-only"
|
|
|
|
|
2016-08-10 01:23:56 +08:00
|
|
|
// RUN: %clang_cl -gline-tables-only /c -### -- %s 2>&1 | FileCheck -check-prefix=ZGMLT %s
|
|
|
|
// ZGMLT: "-gcodeview"
|
|
|
|
// ZGMLT: "-debug-info-kind=line-tables-only"
|
|
|
|
|
2015-12-22 06:09:34 +08:00
|
|
|
// RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=BreproDefault %s
|
|
|
|
// BreproDefault: "-mincremental-linker-compatible"
|
|
|
|
|
|
|
|
// RUN: %clang_cl /Brepro- /Brepro /c '-###' -- %s 2>&1 | FileCheck -check-prefix=Brepro %s
|
2016-08-24 03:32:02 +08:00
|
|
|
// Brepro-NOT: "-mincremental-linker-compatible"
|
2015-12-22 06:09:34 +08:00
|
|
|
|
|
|
|
// RUN: %clang_cl /Brepro /Brepro- /c '-###' -- %s 2>&1 | FileCheck -check-prefix=Brepro_ %s
|
2016-08-24 03:32:02 +08:00
|
|
|
// Brepro_: "-mincremental-linker-compatible"
|
2015-12-22 06:09:34 +08:00
|
|
|
|
2015-10-08 12:24:12 +08:00
|
|
|
// This test was super sneaky: "/Z7" means "line-tables", but "-gdwarf" occurs
|
|
|
|
// later on the command line, so it should win. Interestingly the cc1 arguments
|
|
|
|
// came out right, but had wrong semantics, because an invariant assumed by
|
|
|
|
// CompilerInvocation was violated: it expects that at most one of {gdwarfN,
|
|
|
|
// line-tables-only} appear. If you assume that, then you can safely use
|
|
|
|
// Args.hasArg to test whether a boolean flag is present without caring
|
|
|
|
// where it appeared. And for this test, it appeared to the left of -gdwarf
|
|
|
|
// which made it "win". This test could not detect that bug.
|
2015-08-06 02:51:13 +08:00
|
|
|
// RUN: %clang_cl /Z7 -gdwarf /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7_gdwarf %s
|
|
|
|
// Z7_gdwarf: "-gcodeview"
|
2015-10-08 12:24:12 +08:00
|
|
|
// Z7_gdwarf: "-debug-info-kind=limited"
|
|
|
|
// Z7_gdwarf: "-dwarf-version=4"
|
2015-08-06 02:51:13 +08:00
|
|
|
|
2015-05-18 12:49:30 +08:00
|
|
|
// RUN: %clang_cl -fmsc-version=1800 -TP -### -- %s 2>&1 | FileCheck -check-prefix=CXX11 %s
|
|
|
|
// CXX11: -std=c++11
|
|
|
|
|
|
|
|
// RUN: %clang_cl -fmsc-version=1900 -TP -### -- %s 2>&1 | FileCheck -check-prefix=CXX14 %s
|
|
|
|
// CXX14: -std=c++14
|
|
|
|
|
2016-06-27 10:32:12 +08:00
|
|
|
// RUN: %clang_cl -fmsc-version=1900 -TP -std:c++14 -### -- %s 2>&1 | FileCheck -check-prefix=STDCXX14 %s
|
|
|
|
// STDCXX14: -std=c++14
|
|
|
|
|
2017-10-16 01:27:58 +08:00
|
|
|
// RUN: %clang_cl -fmsc-version=1900 -TP -std:c++17 -### -- %s 2>&1 | FileCheck -check-prefix=STDCXX17 %s
|
2017-10-16 02:01:28 +08:00
|
|
|
// STDCXX17: -std=c++17
|
2017-10-16 01:27:58 +08:00
|
|
|
|
2016-06-27 10:32:12 +08:00
|
|
|
// RUN: %clang_cl -fmsc-version=1900 -TP -std:c++latest -### -- %s 2>&1 | FileCheck -check-prefix=STDCXXLATEST %s
|
2017-10-16 01:27:58 +08:00
|
|
|
// STDCXXLATEST: -std=c++2a
|
2016-06-27 10:32:12 +08:00
|
|
|
|
2015-08-11 02:16:32 +08:00
|
|
|
// RUN: env CL="/Gy" %clang_cl -### -- %s 2>&1 | FileCheck -check-prefix=ENV-CL %s
|
|
|
|
// ENV-CL: "-ffunction-sections"
|
|
|
|
|
|
|
|
// RUN: env CL="/Gy" _CL_="/Gy- -- %s" %clang_cl -### 2>&1 | FileCheck -check-prefix=ENV-_CL_ %s
|
|
|
|
// ENV-_CL_-NOT: "-ffunction-sections"
|
|
|
|
|
2016-09-06 18:48:27 +08:00
|
|
|
// RUN: env CL="%s" _CL_="%s" not %clang --rsp-quoting=windows -c
|
|
|
|
|
2017-02-28 03:40:19 +08:00
|
|
|
// RUN: %clang_cl -### /c -flto -- %s 2>&1 | FileCheck -check-prefix=LTO %s
|
|
|
|
// LTO: -flto
|
|
|
|
|
|
|
|
// RUN: %clang_cl -### /c -flto=thin -- %s 2>&1 | FileCheck -check-prefix=LTO-THIN %s
|
|
|
|
// LTO-THIN: -flto=thin
|
|
|
|
|
|
|
|
// RUN: %clang_cl -### -Fe%t.exe -entry:main -flto -- %s 2>&1 | FileCheck -check-prefix=LTO-WITHOUT-LLD %s
|
|
|
|
// LTO-WITHOUT-LLD: LTO requires -fuse-ld=lld
|
|
|
|
|
2018-08-10 17:49:21 +08:00
|
|
|
// RUN: %clang_cl -### -- %s 2>&1 | FileCheck -check-prefix=NOCFGUARD %s
|
|
|
|
// RUN: %clang_cl /guard:cf- -### -- %s 2>&1 | FileCheck -check-prefix=NOCFGUARD %s
|
2018-09-18 21:07:55 +08:00
|
|
|
// NOCFGUARD-NOT: -cfguard
|
2018-08-10 17:49:21 +08:00
|
|
|
|
|
|
|
// RUN: %clang_cl /guard:cf -### -- %s 2>&1 | FileCheck -check-prefix=CFGUARD %s
|
|
|
|
// RUN: %clang_cl /guard:cf,nochecks -### -- %s 2>&1 | FileCheck -check-prefix=CFGUARD %s
|
|
|
|
// RUN: %clang_cl /guard:nochecks -### -- %s 2>&1 | FileCheck -check-prefix=CFGUARD %s
|
|
|
|
// CFGUARD: -cfguard
|
|
|
|
|
|
|
|
// RUN: %clang_cl /guard:foo -### -- %s 2>&1 | FileCheck -check-prefix=CFGUARDINVALID %s
|
|
|
|
// CFGUARDINVALID: invalid value 'foo' in '/guard:'
|
|
|
|
|
2014-07-17 00:03:56 +08:00
|
|
|
// Accept "core" clang options.
|
2015-04-11 19:44:44 +08:00
|
|
|
// (/Zs is for syntax-only, -Werror makes it fail hard on unknown options)
|
2014-07-17 00:29:00 +08:00
|
|
|
// RUN: %clang_cl \
|
|
|
|
// RUN: --driver-mode=cl \
|
2018-07-24 05:29:43 +08:00
|
|
|
// RUN: -fblocks \
|
2018-08-10 19:40:50 +08:00
|
|
|
// RUN: -fcrash-diagnostics-dir=/foo \
|
2018-08-17 21:37:57 +08:00
|
|
|
// RUN: -fno-crash-diagnostics \
|
2018-07-24 05:29:43 +08:00
|
|
|
// RUN: -fno-blocks \
|
|
|
|
// RUN: -fbuiltin \
|
|
|
|
// RUN: -fno-builtin \
|
|
|
|
// RUN: -fno-builtin-strcpy \
|
2015-04-11 20:27:56 +08:00
|
|
|
// RUN: -fcolor-diagnostics \
|
|
|
|
// RUN: -fno-color-diagnostics \
|
2018-05-29 22:48:30 +08:00
|
|
|
// RUN: -fcoverage-mapping \
|
|
|
|
// RUN: -fno-coverage-mapping \
|
2015-04-12 15:12:19 +08:00
|
|
|
// RUN: -fdiagnostics-color \
|
|
|
|
// RUN: -fno-diagnostics-color \
|
2015-04-22 07:12:03 +08:00
|
|
|
// RUN: -fdiagnostics-parseable-fixits \
|
2016-08-26 23:45:36 +08:00
|
|
|
// RUN: -fdiagnostics-absolute-paths \
|
2014-07-17 00:29:00 +08:00
|
|
|
// RUN: -ferror-limit=10 \
|
2014-07-17 00:03:56 +08:00
|
|
|
// RUN: -fmsc-version=1800 \
|
2014-07-17 00:29:00 +08:00
|
|
|
// RUN: -fno-strict-aliasing \
|
|
|
|
// RUN: -fstrict-aliasing \
|
2015-04-15 18:02:21 +08:00
|
|
|
// RUN: -fsyntax-only \
|
2015-10-09 07:13:28 +08:00
|
|
|
// RUN: -fms-compatibility \
|
|
|
|
// RUN: -fno-ms-compatibility \
|
|
|
|
// RUN: -fms-extensions \
|
|
|
|
// RUN: -fno-ms-extensions \
|
2017-01-13 06:40:13 +08:00
|
|
|
// RUN: -Xclang -disable-llvm-passes \
|
2016-09-15 06:31:24 +08:00
|
|
|
// RUN: -resource-dir asdf \
|
|
|
|
// RUN: -resource-dir=asdf \
|
2015-04-11 19:44:44 +08:00
|
|
|
// RUN: -Wunused-variable \
|
|
|
|
// RUN: -fmacro-backtrace-limit=0 \
|
2016-09-10 00:42:50 +08:00
|
|
|
// RUN: -fstandalone-debug \
|
|
|
|
// RUN: -flimit-debug-info \
|
2016-10-05 05:00:57 +08:00
|
|
|
// RUN: -flto \
|
2018-05-01 03:04:04 +08:00
|
|
|
// RUN: -fmerge-all-constants \
|
clang-cl: Expose -no-canonical-prefixes
-no-canonical-prefixes is a weird flag: In gcc, it controls whether realpath()
is called on the path of the driver binary. It's needed to support some
usecases where gcc is symlinked to, see
https://gcc.gnu.org/ml/gcc/2011-01/msg00429.html for some background.
In clang, the resource dir is found relative to the compiler binary, and
without -no-canonical-prefixes that's an absolute path. For clang, the main use
case for -no-canonical-prefixes is to make the -resource-dir path added by the
driver relative instead of absolute. Making it relative seems like the better
default, but since neither clang not gcc have -canonical-prefixes without no-
which makes changing the default tricky, and since some symlink behaviors do
depend on the realpath() call at least for gcc, just expose
-no-canonical-prefixes in clang-cl mode.
Alternatively we could default to no-canonical-prefix-mode for clang-cl since
it's less likely to be used in symlinked scenarios, but since you already need
to about -no-canonical-prefixes for the non-clang-cl bits of your build, not
hooking this of driver mode seems better to me.
https://reviews.llvm.org/D47480
llvm-svn: 333761
2018-06-01 22:59:57 +08:00
|
|
|
// RUN: -no-canonical-prefixes \
|
2018-09-11 01:54:32 +08:00
|
|
|
// RUN: -march=skylake \
|
2019-02-22 05:53:12 +08:00
|
|
|
// RUN: -fbracket-depth=123 \
|
2017-10-23 23:54:44 +08:00
|
|
|
// RUN: --version \
|
2015-04-11 19:44:44 +08:00
|
|
|
// RUN: -Werror /Zs -- %s 2>&1
|
2014-07-17 00:03:56 +08:00
|
|
|
|
2018-11-08 19:27:04 +08:00
|
|
|
// Accept clang options under the /clang: flag.
|
|
|
|
// The first test case ensures that the SLP vectorizer is on by default and that
|
|
|
|
// it's being turned off by the /clang:-fno-slp-vectorize flag.
|
|
|
|
|
|
|
|
// RUN: %clang_cl -O2 -### -- %s 2>&1 | FileCheck -check-prefix=NOCLANG %s
|
|
|
|
// NOCLANG: "--dependent-lib=libcmt"
|
|
|
|
// NOCLANG-SAME: "-vectorize-slp"
|
|
|
|
// NOCLANG-NOT: "--dependent-lib=msvcrt"
|
|
|
|
|
|
|
|
// RUN: %clang_cl -O2 -MD /clang:-fno-slp-vectorize /clang:-MD /clang:-MF /clang:my_dependency_file.dep -### -- %s 2>&1 | FileCheck -check-prefix=CLANG %s
|
|
|
|
// CLANG: "--dependent-lib=msvcrt"
|
|
|
|
// CLANG-SAME: "-dependency-file" "my_dependency_file.dep"
|
|
|
|
// CLANG-NOT: "--dependent-lib=libcmt"
|
|
|
|
// CLANG-NOT: "-vectorize-slp"
|
2013-10-11 06:36:20 +08:00
|
|
|
|
2013-09-17 08:03:41 +08:00
|
|
|
void f() { }
|