diff options
Diffstat (limited to 'test/Driver')
71 files changed, 1357 insertions, 241 deletions
diff --git a/test/Driver/Inputs/resource_dir/lib/linux/libclang_rt.msan_cxx-x86_64.a.syms b/test/Driver/Inputs/resource_dir/lib/linux/libclang_rt.msan_cxx-x86_64.a.syms new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/resource_dir/lib/linux/libclang_rt.msan_cxx-x86_64.a.syms diff --git a/test/Driver/Inputs/resource_dir/lib/linux/libclang_rt.tsan_cxx-x86_64.a.syms b/test/Driver/Inputs/resource_dir/lib/linux/libclang_rt.tsan_cxx-x86_64.a.syms new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/resource_dir/lib/linux/libclang_rt.tsan_cxx-x86_64.a.syms diff --git a/test/Driver/aarch64-cpus.c b/test/Driver/aarch64-cpus.c index 1627660..43e3ccd 100644 --- a/test/Driver/aarch64-cpus.c +++ b/test/Driver/aarch64-cpus.c @@ -40,6 +40,20 @@ // RUN: %clang -target arm64 -mlittle-endian -mtune=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA57 %s // ARM64-CA57: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "cortex-a57" +// RUN: %clang -target aarch64 -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CA72 %s +// RUN: %clang -target aarch64 -mlittle-endian -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CA72 %s +// RUN: %clang -target aarch64_be -mlittle-endian -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CA72 %s +// RUN: %clang -target aarch64 -mtune=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CA72 %s +// RUN: %clang -target aarch64 -mlittle-endian -mtune=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CA72 %s +// RUN: %clang -target aarch64_be -mlittle-endian -mtune=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CA72 %s +// CA72: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a72" + +// RUN: %clang -target arm64 -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA72 %s +// RUN: %clang -target arm64 -mlittle-endian -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA72 %s +// RUN: %clang -target arm64 -mtune=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA72 %s +// RUN: %clang -target arm64 -mlittle-endian -mtune=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA72 %s +// ARM64-CA72: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "cortex-a72" + // RUN: %clang -target aarch64_be -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC-BE %s // RUN: %clang -target aarch64 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC-BE %s // RUN: %clang -target aarch64_be -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC-BE %s @@ -61,6 +75,39 @@ // RUN: %clang -target aarch64_be -mbig-endian -mtune=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57-BE %s // CA57-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "cortex-a57" +// RUN: %clang -target aarch64_be -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CA72-BE %s +// RUN: %clang -target aarch64 -mbig-endian -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CA72-BE %s +// RUN: %clang -target aarch64_be -mbig-endian -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CA72-BE %s +// RUN: %clang -target aarch64_be -mtune=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CA72-BE %s +// RUN: %clang -target aarch64 -mbig-endian -mtune=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CA72-BE %s +// RUN: %clang -target aarch64_be -mbig-endian -mtune=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CA72-BE %s +// CA72-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "cortex-a72" + // RUN: %clang -target aarch64 -mcpu=cortex-a57 -mtune=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=MCPU-MTUNE %s // RUN: %clang -target aarch64 -mtune=cortex-a53 -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=MCPU-MTUNE %s +// RUN: %clang -target aarch64 -mcpu=cortex-a72 -mtune=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=MCPU-MTUNE %s +// RUN: %clang -target aarch64 -mtune=cortex-a53 -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=MCPU-MTUNE %s // MCPU-MTUNE: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a53" + +// RUN: %clang -target aarch64 -march=armv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A %s +// RUN: %clang -target aarch64 -march=armv8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A %s +// RUN: %clang -target aarch64 -mlittle-endian -march=armv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A %s +// RUN: %clang -target aarch64 -mlittle-endian -march=armv8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A %s +// RUN: %clang -target aarch64_be -mlittle-endian -march=armv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A %s +// RUN: %clang -target aarch64_be -mlittle-endian -march=armv8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A %s +// GENERICV81A: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8.1a" + +// RUN: %clang -target arm64 -march=armv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERICV81A %s +// RUN: %clang -target arm64 -march=armv8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERICV81A %s +// RUN: %clang -target arm64 -mlittle-endian -march=armv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERICV81A %s +// RUN: %clang -target arm64 -mlittle-endian -march=armv8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERICV81A %s +// ARM64-GENERICV81A: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8.1a" + +// RUN: %clang -target aarch64_be -march=armv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s +// RUN: %clang -target aarch64_be -march=armv8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s +// RUN: %clang -target aarch64 -mbig-endian -march=armv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s +// RUN: %clang -target aarch64 -mbig-endian -march=armv8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s +// RUN: %clang -target aarch64_be -mbig-endian -march=armv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s +// RUN: %clang -target aarch64_be -mbig-endian -march=armv8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s +// GENERICV81A-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8.1a" + diff --git a/test/Driver/arm-cortex-cpus.c b/test/Driver/arm-cortex-cpus.c index b1f2533..5052f3b 100644 --- a/test/Driver/arm-cortex-cpus.c +++ b/test/Driver/arm-cortex-cpus.c @@ -56,8 +56,16 @@ // CHECK-V6Z: "-cc1"{{.*}} "-triple" "armv6-{{.*}} "-target-cpu" "arm1176jzf-s" // FIXME %clang -target armv6z -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6Z-THUMB %s -// FIXME %clang -target arm arch=armv6z -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6Z-THUMB %s -// CHECK-V6Z-THUMB: "-cc1"{{.*}} "-triple" "thumbv6-{{.*}} "-target-cpu" "arm1176jzfs" +// FIXME %clang -target arm -march=armv6z -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6Z-THUMB %s +// CHECK-V6Z-THUMB: "-cc1"{{.*}} "-triple" "thumbv6-{{.*}} "-target-cpu" "arm1176jzf-s" + +// RUN: %clang -target armv6k -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6K %s +// RUN: %clang -target arm -march=armv6k -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6K %s +// CHECK-V6K: "-cc1"{{.*}} "-triple" "armv6k-{{.*}} "-target-cpu" "arm1176jzf-s" + +// RUN: %clang -target armv6k -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6K-THUMB %s +// RUN: %clang -target arm -march=armv6k -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6K-THUMB %s +// CHECK-V6K-THUMB: "-cc1"{{.*}} "-triple" "thumbv6k-{{.*}} "-target-cpu" "arm1176jzf-s" // RUN: %clang -target armv6t2 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6T2 %s // RUN: %clang -target arm -march=armv6t2 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6T2 %s @@ -69,6 +77,8 @@ // RUN: %clang -target armv6m -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6M %s // RUN: %clang -target arm -march=armv6m -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6M %s +// RUN: %clang -target armv6sm -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6M %s +// RUN: %clang -target arm -march=armv6sm -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6M %s // CHECK-V6M: "-cc1"{{.*}} "-triple" "thumbv6m-{{.*}} "-target-cpu" "cortex-m0" // RUN: %clang -target armv6m -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V6M-BIG %s @@ -156,11 +166,63 @@ // RUN: %clang -target arm -march=armebv8a -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V8A-THUMB %s // CHECK-BE-V8A-THUMB: "-cc1"{{.*}} "-triple" "thumbebv8-{{.*}}" "-target-cpu" "cortex-a53" -// ================== Check default CPU on bogus architecture +// RUN: %clang -target arm -march=armv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A %s +// RUN: %clang -target armv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A %s +// RUN: %clang -target arm -march=armv8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A %s +// RUN: %clang -target arm -march=armv8.1a -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A %s +// RUN: %clang -target armv8.1a -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A %s +// RUN: %clang -target arm -march=armv8.1a -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A %s +// RUN: %clang -target arm -mlittle-endian -march=armv8.1-a -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A %s +// CHECK-V81A: "-cc1"{{.*}} "-triple" "armv8.1a-{{.*}}" "-target-cpu" "generic" "-target-feature" "+v8.1a" + +// RUN: %clang -target armebv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V81A %s +// RUN: %clang -target armeb -march=armebv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V81A %s +// RUN: %clang -target armeb -march=armebv8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V81A %s +// RUN: %clang -target armv8.1a -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V81A %s +// RUN: %clang -target arm -march=armebv8.1a -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V81A %s +// RUN: %clang -target arm -march=armebv8.1-a -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V81A %s +// CHECK-BE-V81A: "-cc1"{{.*}} "-triple" "armebv8.1a-{{.*}}" "-target-cpu" "generic" "-target-feature" "+v8.1a" + +// RUN: %clang -target armv8.1a -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A-THUMB %s +// RUN: %clang -target arm -march=armv8.1a -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A-THUMB %s +// RUN: %clang -target arm -march=armv8.1-a -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A-THUMB %s +// RUN: %clang -target armv8.1a -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A-THUMB %s +// RUN: %clang -target arm -march=armv8.1a -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A-THUMB %s +// RUN: %clang -target arm -march=armv8.1-a -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-V81A-THUMB %s +// CHECK-V81A-THUMB: "-cc1"{{.*}} "-triple" "thumbv8.1a-{{.*}}" "-target-cpu" "generic" "-target-feature" "+v8.1a" + +// RUN: %clang -target armebv8.1a -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V81A-THUMB %s +// RUN: %clang -target armeb -march=armebv8.1a -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V81A-THUMB %s +// RUN: %clang -target armeb -march=armebv8.1-a -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V81A-THUMB %s +// RUN: %clang -target armv8.1a -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V81A-THUMB %s +// RUN: %clang -target arm -march=armebv8.1a -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V81A-THUMB %s +// RUN: %clang -target arm -march=armebv8.1-a -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-V81A-THUMB %s +// CHECK-BE-V81A-THUMB: "-cc1"{{.*}} "-triple" "thumbebv8.1a-{{.*}}" "-target-cpu" "generic" "-target-feature" "+v8.1a" + +// ================== Check that a bogus architecture gives an error // RUN: %clang -target arm -march=armbogusv6 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BOGUS %s -// CHECK-BOGUS: "-cc1"{{.*}} "-triple" "armv4t-{{.*}} "-target-cpu" "arm7tdmi" +// CHECK-BOGUS: error: the clang compiler does not support '-march=armbogusv6' // RUN: %clang -target arm---eabihf -march=armbogusv7 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BOGUS-HF %s -// CHECK-BOGUS-HF: "-cc1"{{.*}} "-triple" "armv6-{{.*}} "-target-cpu" "arm1176jzf-s" +// CHECK-BOGUS-HF: error: the clang compiler does not support '-march=armbogusv7' + +// ================== Check that a bogus CPU gives an error +// RUN: %clang -target arm -mcpu=bogus -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BOGUS-CPU %s +// CHECK-BOGUS-CPU: error: the clang compiler does not support '-mcpu=bogus' + +// ================== Check default Architecture on each ARM11 CPU +// RUN: %clang -target arm-linux-gnueabi -mcpu=arm1136j-s -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6 %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=arm1136jf-s -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6 %s +// CHECK-CPUV6: "-cc1"{{.*}} "-triple" "armv6-{{.*}} + +// RUN: %clang -target arm-linux-gnueabi -mcpu=arm1176jz-s -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6K %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=arm1176jzf-s -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6K %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=mpcore -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6K %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=mpcorenovfp -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6K %s +// CHECK-CPUV6K: "-cc1"{{.*}} "-triple" "armv6k-{{.*}} + +// RUN: %clang -target arm-linux-gnueabi -mcpu=arm1156t2-s -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6T2 %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=arm1156t2f-s -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6T2 %s +// CHECK-CPUV6T2: "-cc1"{{.*}} "-triple" "armv6t2-{{.*}} // ================== Check default Architecture on each Cortex CPU // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-a5 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7A %s @@ -228,10 +290,15 @@ // CHECK-BE-CPUV7A-THUMB: "-cc1"{{.*}} "-triple" "thumbebv7-{{.*}} // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-m0 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6M %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-m0plus -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6M %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-m1 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6M %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=sc000 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV6M %s // CHECK-CPUV6M: "-cc1"{{.*}} "-triple" "thumbv6m-{{.*}} // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-m3 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7M %s // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-m3 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7M %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=sc300 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7M %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=sc300 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7M %s // CHECK-CPUV7M: "-cc1"{{.*}} "-triple" "thumbv7m-{{.*}} // RUN: %clang -target armeb-linux-gnueabi -mcpu=cortex-m3 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7M %s @@ -251,49 +318,73 @@ // CHECK-BE-CPUV7EM: "-cc1"{{.*}} "-triple" "thumbebv7em-{{.*}} // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r4 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7R %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r4f -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7R %s // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r5 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7R %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r7 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7R %s // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r4 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7R %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r4f -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7R %s // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r5 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7R %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r7 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7R %s // CHECK-CPUV7R: "-cc1"{{.*}} "-triple" "armv7r-{{.*}} // RUN: %clang -target armeb-linux-gnueabi -mcpu=cortex-r4 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R %s +// RUN: %clang -target armeb-linux-gnueabi -mcpu=cortex-r4f -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R %s // RUN: %clang -target armeb-linux-gnueabi -mcpu=cortex-r5 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R %s +// RUN: %clang -target armeb-linux-gnueabi -mcpu=cortex-r7 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R %s // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r4 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r4f -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R %s // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r5 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r7 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R %s // CHECK-BE-CPUV7R: "-cc1"{{.*}} "-triple" "armebv7r-{{.*}} // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r4 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7R-THUMB %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r4f -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7R-THUMB %s // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r5 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7R-THUMB %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r7 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7R-THUMB %s // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r4 -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7R-THUMB %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r4f -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7R-THUMB %s // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r5 -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7R-THUMB %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r7 -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV7R-THUMB %s // CHECK-CPUV7R-THUMB: "-cc1"{{.*}} "-triple" "thumbv7r-{{.*}} // RUN: %clang -target armeb-linux-gnueabi -mcpu=cortex-r4 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R-THUMB %s +// RUN: %clang -target armeb-linux-gnueabi -mcpu=cortex-r4f -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R-THUMB %s // RUN: %clang -target armeb-linux-gnueabi -mcpu=cortex-r5 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R-THUMB %s +// RUN: %clang -target armeb-linux-gnueabi -mcpu=cortex-r7 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R-THUMB %s // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r4 -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R-THUMB %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r4f -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R-THUMB %s // RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r5 -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R-THUMB %s +// RUN: %clang -target arm-linux-gnueabi -mcpu=cortex-r7 -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV7R-THUMB %s // CHECK-BE-CPUV7R-THUMB: "-cc1"{{.*}} "-triple" "thumbebv7r-{{.*}} // RUN: %clang -target arm -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s // RUN: %clang -target arm -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s +// RUN: %clang -target arm -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s // RUN: %clang -target arm -mcpu=cortex-a53 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s // RUN: %clang -target arm -mcpu=cortex-a57 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s +// RUN: %clang -target arm -mcpu=cortex-a72 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A %s // CHECK-CPUV8A: "-cc1"{{.*}} "-triple" "armv8-{{.*}} // RUN: %clang -target armeb -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s // RUN: %clang -target armeb -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s +// RUN: %clang -target armeb -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s // RUN: %clang -target arm -mcpu=cortex-a53 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s // RUN: %clang -target arm -mcpu=cortex-a57 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s +// RUN: %clang -target arm -mcpu=cortex-a72 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A %s // CHECK-BE-CPUV8A: "-cc1"{{.*}} "-triple" "armebv8-{{.*}} // RUN: %clang -target arm -mcpu=cortex-a53 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s // RUN: %clang -target arm -mcpu=cortex-a57 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s +// RUN: %clang -target arm -mcpu=cortex-a72 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s // RUN: %clang -target arm -mcpu=cortex-a53 -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s // RUN: %clang -target arm -mcpu=cortex-a57 -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s +// RUN: %clang -target arm -mcpu=cortex-a72 -mlittle-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-CPUV8A-THUMB %s // CHECK-CPUV8A-THUMB: "-cc1"{{.*}} "-triple" "thumbv8-{{.*}} // RUN: %clang -target armeb -mcpu=cortex-a53 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A-THUMB %s // RUN: %clang -target armeb -mcpu=cortex-a57 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A-THUMB %s +// RUN: %clang -target armeb -mcpu=cortex-a72 -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A-THUMB %s // RUN: %clang -target arm -mcpu=cortex-a53 -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A-THUMB %s // RUN: %clang -target arm -mcpu=cortex-a57 -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A-THUMB %s +// RUN: %clang -target arm -mcpu=cortex-a72 -mbig-endian -mthumb -### -c %s 2>&1 | FileCheck -check-prefix=CHECK-BE-CPUV8A-THUMB %s // CHECK-BE-CPUV8A-THUMB: "-cc1"{{.*}} "-triple" "thumbebv8-{{.*}} diff --git a/test/Driver/arm-mfpu.c b/test/Driver/arm-mfpu.c index 64d7d0b..d941a3c 100644 --- a/test/Driver/arm-mfpu.c +++ b/test/Driver/arm-mfpu.c @@ -35,8 +35,8 @@ // RUN: | FileCheck --check-prefix=CHECK-VFP3-D16 %s // RUN: %clang -target arm-linux-eabi -mfpu=vfpv3-d16 %s -### -o %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-VFP3-D16 %s -// CHECK-VFP3-D16: "-target-feature" "+vfp3" // CHECK-VFP3-D16: "-target-feature" "+d16" +// CHECK-VFP3-D16: "-target-feature" "+vfp3" // CHECK-VFP3-D16: "-target-feature" "-neon" // RUN: %clang -target arm-linux-eabi -mfpu=vfp4 %s -### -o %t.o 2>&1 \ @@ -50,26 +50,26 @@ // RUN: | FileCheck --check-prefix=CHECK-VFP4-D16 %s // RUN: %clang -target arm-linux-eabi -mfpu=vfpv4-d16 %s -### -o %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-VFP4-D16 %s -// CHECK-VFP4-D16: "-target-feature" "+vfp4" // CHECK-VFP4-D16: "-target-feature" "+d16" +// CHECK-VFP4-D16: "-target-feature" "+vfp4" // CHECK-VFP4-D16: "-target-feature" "-neon" // RUN: %clang -target arm-linux-eabi -mfpu=fp4-sp-d16 %s -### -o %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-FP4-SP-D16 %s // RUN: %clang -target arm-linux-eabi -mfpu=fpv4-sp-d16 %s -### -o %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-FP4-SP-D16 %s -// CHECK-FP4-SP-D16: "-target-feature" "+vfp4" -// CHECK-FP4-SP-D16: "-target-feature" "+d16" // CHECK-FP4-SP-D16: "-target-feature" "+fp-only-sp" +// CHECK-FP4-SP-D16: "-target-feature" "+d16" +// CHECK-FP4-SP-D16: "-target-feature" "+vfp4" // CHECK-FP4-SP-D16: "-target-feature" "-neon" // RUN: %clang -target arm-linux-eabi -mfpu=fp5-sp-d16 %s -### -o %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-FP5-SP-D16 %s // RUN: %clang -target arm-linux-eabi -mfpu=fpv5-sp-d16 %s -### -o %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-FP5-SP-D16 %s -// CHECK-FP5-SP-D16: "-target-feature" "+fp-armv8" // CHECK-FP5-SP-D16: "-target-feature" "+fp-only-sp" // CHECK-FP5-SP-D16: "-target-feature" "+d16" +// CHECK-FP5-SP-D16: "-target-feature" "+fp-armv8" // CHECK-FP5-SP-D16: "-target-feature" "-neon" // CHECK-FP5-SP-D16: "-target-feature" "-crypto" @@ -77,8 +77,8 @@ // RUN: | FileCheck --check-prefix=CHECK-FP5-DP-D16 %s // RUN: %clang -target arm-linux-eabi -mfpu=fpv5-dp-d16 %s -### -o %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-FP5-DP-D16 %s -// CHECK-FP5-DP-D16: "-target-feature" "+fp-armv8" // CHECK-FP5-DP-D16: "-target-feature" "+d16" +// CHECK-FP5-DP-D16: "-target-feature" "+fp-armv8" // CHECK-FP5-DP-D16: "-target-feature" "-neon" // CHECK-FP5-DP-D16: "-target-feature" "-crypto" @@ -88,7 +88,6 @@ // RUN: %clang -target arm-linux-eabi -mfpu=neon-vfpv3 %s -### -o %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NEON-VFPV3 %s -// CHECK-NEON-VFPV3: "-target-feature" "+vfp3" // CHECK-NEON-VFPV3: "-target-feature" "+neon" // RUN: %clang -target arm-linux-eabi -mfpu=neon-vfpv4 %s -### -o %t.o 2>&1 \ @@ -141,7 +140,7 @@ // RUN: %clang -target arm-linux-gnueabihf %s -### 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-HF %s -// CHECK-HF: "-target-cpu" "arm1136jf-s" +// CHECK-HF: "-target-cpu" "arm1176jzf-s" // RUN: %clang -target armv7-apple-darwin -x assembler %s -### -c 2>&1 \ // RUN: | FileCheck --check-prefix=ASM %s diff --git a/test/Driver/biarch.c b/test/Driver/biarch.c index 1f0982e..80c42fe 100644 --- a/test/Driver/biarch.c +++ b/test/Driver/biarch.c @@ -11,7 +11,7 @@ // RUN: grep '"-cc1" "-triple" "x86_64--netbsd"' %t // RUN: %clang -target armv6--netbsd-eabihf -m32 %s -### 2> %t -// RUN: grep '"-cc1" "-triple" "armv6--netbsd-eabihf"' %t +// RUN: grep '"-cc1" "-triple" "armv6k--netbsd-eabihf"' %t // RUN: %clang -target sparcv9--netbsd -m32 %s -### 2> %t // RUN: grep '"-cc1" "-triple" "sparc--netbsd"' %t diff --git a/test/Driver/cl-eh.cpp b/test/Driver/cl-eh.cpp index 8a3450a..a71491e 100644 --- a/test/Driver/cl-eh.cpp +++ b/test/Driver/cl-eh.cpp @@ -5,18 +5,23 @@ // command-line option, e.g. on Mac where %s is commonly under /Users. // RUN: %clang_cl /c /EHsc -### -- %s 2>&1 | FileCheck -check-prefix=EHsc %s +// EHsc: "-fcxx-exceptions" // EHsc: "-fexceptions" // RUN: %clang_cl /c /EHs-c- -### -- %s 2>&1 | FileCheck -check-prefix=EHs_c_ %s +// EHs_c_-NOT: "-fcxx-exceptions" // EHs_c_-NOT: "-fexceptions" // RUN: %clang_cl /c /EHs- /EHc- -### -- %s 2>&1 | FileCheck -check-prefix=EHs_EHc_ %s +// EHs_EHc_-NOT: "-fcxx-exceptions" // EHs_EHc_-NOT: "-fexceptions" // RUN: %clang_cl /c /EHs- /EHs -### -- %s 2>&1 | FileCheck -check-prefix=EHs_EHs %s +// EHs_EHs: "-fcxx-exceptions" // EHs_EHs: "-fexceptions" // RUN: %clang_cl /c /EHs- /EHsa -### -- %s 2>&1 | FileCheck -check-prefix=EHs_EHa %s +// EHs_EHa: "-fcxx-exceptions" // EHs_EHa: "-fexceptions" // RUN: %clang_cl /c /EHinvalid -### -- %s 2>&1 | FileCheck -check-prefix=EHinvalid %s diff --git a/test/Driver/cl-inputs.c b/test/Driver/cl-inputs.c index b0265df..6320009 100644 --- a/test/Driver/cl-inputs.c +++ b/test/Driver/cl-inputs.c @@ -59,4 +59,9 @@ // LIBINPUT2: link.exe" // LIBINPUT2-NOT: "cl-test2.lib" +// RUN: %clang_cl -### -- %s /nonexisting.lib 2>&1 | FileCheck -check-prefix=LIBINPUT3 %s +// LIBINPUT3: error: no such file or directory: '/nonexisting.lib' +// LIBINPUT3: link.exe" +// LIBINPUT3-NOT: "/nonexisting.lib" + void f(); diff --git a/test/Driver/cl-options.c b/test/Driver/cl-options.c index d9fcaf4..244e686 100644 --- a/test/Driver/cl-options.c +++ b/test/Driver/cl-options.c @@ -30,6 +30,27 @@ // EP: "-P" // EP: "-o" "-" +// 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 + +// RUN: %clang_cl /GA -### -- %s 2>&1 | FileCheck -check-prefix=GA %s +// GA: -ftls-model=local-exec + // RTTI is on by default; just check that we don't error. // RUN: %clang_cl /Zs /GR -- %s 2>&1 @@ -42,6 +63,13 @@ // RUN: %clang_cl /Gy /Gy- -### -- %s 2>&1 | FileCheck -check-prefix=Gy_ %s // Gy_-NOT: -ffunction-sections +// RUN: %clang_cl /Gs -### -- %s 2>&1 | FileCheck -check-prefix=Gs %s +// Gs: "-mstack-probe-size=0" +// 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" + // RUN: %clang_cl /Gw -### -- %s 2>&1 | FileCheck -check-prefix=Gw %s // Gw: -fdata-sections @@ -84,6 +112,12 @@ // RUN: %clang_cl /Oy- -### -- %s 2>&1 | FileCheck -check-prefix=Oy_ %s // Oy_: -mdisable-fp-elim +// 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 + // RUN: %clang_cl /showIncludes -### -- %s 2>&1 | FileCheck -check-prefix=showIncludes %s // showIncludes: --show-includes @@ -116,6 +150,12 @@ // RUN: %clang_cl /vmg /vmm /vms -### -- %s 2>&1 | FileCheck -check-prefix=VMX %s // VMX: '/vms' not allowed with '/vmm' +// 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" + // RUN: %clang_cl /W0 -### -- %s 2>&1 | FileCheck -check-prefix=W0 %s // W0: -w @@ -164,18 +204,19 @@ // NOSTRICT: "-relaxed-aliasing" // For some warning ids, we can map from MSVC warning to Clang warning. -// RUN: %clang_cl -wd4005 -### -- %s 2>&1 | FileCheck -check-prefix=wd4005 %s -// wd4005: "-cc1" -// wd4005: "-Wno-macro-redefined" +// RUN: %clang_cl -wd4005 -wd4996 -### -- %s 2>&1 | FileCheck -check-prefix=Wno %s +// Wno: "-cc1" +// Wno: "-Wno-macro-redefined" +// Wno: "-Wno-deprecated-declarations" // Ignored options. Check that we don't get "unused during compilation" errors. -// (/Zs is for syntax-only) -// RUN: %clang_cl /Zs \ +// RUN: %clang_cl /c \ // RUN: /analyze- \ // RUN: /cgthreads4 \ // RUN: /cgthreads8 \ // RUN: /d2Zi+ \ // RUN: /errorReport:foo \ +// RUN: /Fdfoo \ // RUN: /FS \ // RUN: /Gd \ // RUN: /GF \ @@ -184,6 +225,7 @@ // RUN: /nologo \ // RUN: /Ob1 \ // RUN: /Ob2 \ +// RUN: /openmp- \ // RUN: /RTC1 \ // RUN: /sdl \ // RUN: /sdl- \ @@ -196,6 +238,8 @@ // RUN: -### -- %s 2>&1 | FileCheck -check-prefix=IGNORED %s // IGNORED-NOT: argument unused during compilation // IGNORED-NOT: no such file or directory +// Don't confuse /openmp- with the /o flag: +// IGNORED-NOT: "-o" "penmp-.obj" // Ignored options and compile-only options are ignored for link jobs. // RUN: touch %t.obj @@ -223,11 +267,9 @@ // RUN: /FAu \ // RUN: /favor:blend \ // RUN: /FC \ -// RUN: /Fdfoo \ // RUN: /Fifoo \ // RUN: /Fmfoo \ // RUN: /FpDebug\main.pch \ -// RUN: /fp:precise \ // RUN: /Frfoo \ // RUN: /FRfoo \ // RUN: /FU foo \ @@ -245,7 +287,6 @@ // RUN: /Gm- \ // RUN: /Gr \ // RUN: /GS \ -// RUN: /Gs1000 \ // RUN: /GT \ // RUN: /GX \ // RUN: /Gv \ @@ -302,17 +343,38 @@ // RTTI-NOT: "-fno-rtti-data" // RTTI-NOT: "-fno-rtti" +// thread safe statics are off for versions < 19. +// RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=NoThreadSafeStatics %s +// 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" + +// 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 + // Accept "core" clang options. -// (/Zs is for syntax-only) +// (/Zs is for syntax-only, -Werror makes it fail hard on unknown options) // RUN: %clang_cl \ // RUN: --driver-mode=cl \ +// RUN: -fcolor-diagnostics \ +// RUN: -fno-color-diagnostics \ +// RUN: -fdiagnostics-color \ +// RUN: -fno-diagnostics-color \ +// RUN: -fdiagnostics-parseable-fixits \ // RUN: -ferror-limit=10 \ // RUN: -fmsc-version=1800 \ // RUN: -fno-strict-aliasing \ // RUN: -fstrict-aliasing \ +// RUN: -fsyntax-only \ // RUN: -mllvm -disable-llvm-optzns \ -// RUN: -Wunused-variables \ -// RUN: /Zs -- %s 2>&1 +// RUN: -Wunused-variable \ +// RUN: -fmacro-backtrace-limit=0 \ +// RUN: -Werror /Zs -- %s 2>&1 void f() { } diff --git a/test/Driver/cl-zc.cpp b/test/Driver/cl-zc.cpp index 639095f..85eacff 100644 --- a/test/Driver/cl-zc.cpp +++ b/test/Driver/cl-zc.cpp @@ -15,6 +15,12 @@ // RUN: %clang_cl /c -### /Zc:trigraphs- -- %s 2>&1 | FileCheck -check-prefix=TRIGRAPHS-OFF %s // TRIGRAPHS-OFF: "-fno-trigraphs" +// RUN: %clang_cl /c -### /Zc:sizedDealloc -- %s 2>&1 | FileCheck -check-prefix=SIZED-DEALLOC-ON %s +// SIZED-DEALLOC-ON: "-fsized-deallocation" + +// RUN: %clang_cl /c -### /Zc:sizedDealloc- -- %s 2>&1 | FileCheck -check-prefix=SIZED-DEALLOC-OFF %s +// SIZED-DEALLOC-OFF-NOT: "-fsized-deallocation" + // RUN: %clang_cl /c -### -- %s 2>&1 | FileCheck -check-prefix=STRICTSTRINGS-DEFAULT %s // STRICTSTRINGS-DEFAULT-NOT: -Werror=c++11-compat-deprecated-writable-strings // RUN: %clang_cl /c -### /Zc:strictStrings -- %s 2>&1 | FileCheck -check-prefix=STRICTSTRINGS-ON %s diff --git a/test/Driver/clang-exception-flags.cpp b/test/Driver/clang-exception-flags.cpp index 90a9ebf..a5faed2 100644 --- a/test/Driver/clang-exception-flags.cpp +++ b/test/Driver/clang-exception-flags.cpp @@ -1,4 +1,6 @@ -// RUN: %clang -### %s 2>&1 | FileCheck %s -check-prefix=DEFAULT +// We force the target to unknown because clang's default behavior for +// exception handling is target dependent. +// RUN: %clang -### -target unknown %s 2>&1 | FileCheck %s -check-prefix=DEFAULT // DEFAULT: "-cc1" {{.*}} "-fcxx-exceptions" "-fexceptions" // // RUN: %clang -### -fexceptions %s 2>&1 | FileCheck %s -check-prefix=ON1 @@ -21,3 +23,6 @@ // // RUN: %clang -### -fexceptions -fno-cxx-exceptions %s 2>&1 | FileCheck %s -check-prefix=OFF4 // OFF4-NOT: "-cc1" {{.*}} "-fcxx-exceptions" +// +// RUN: %clang -### -target x86_64-scei-ps4 %s 2>&1 | FileCheck %s -check-prefix=PS4-OFF +// PS4-OFF-NOT: "-cc1" {{.*}} "-f{{(cxx-)?}}exceptions" diff --git a/test/Driver/clang_f_opts.c b/test/Driver/clang_f_opts.c index 3ca9f28..68890a7 100644 --- a/test/Driver/clang_f_opts.c +++ b/test/Driver/clang_f_opts.c @@ -383,10 +383,25 @@ // CHECK-NO-WARNING1-NOT: optimization flag '-finline-limit=1000' is not supported // CHECK-NO-WARNING2-NOT: optimization flag '-finline-limit' is not supported +// RUN: %clang -### -S -fsigned-char %s 2>&1 | FileCheck -check-prefix=CHAR-SIGN1 %s +// CHAR-SIGN1-NOT: -fno-signed-char -// RUN: %clang -### -fshort-wchar -fno-short-wchar %s 2>&1 | FileCheck -check-prefix=CHECK-WCHAR1 %s -// RUN: %clang -### -fno-short-wchar -fshort-wchar %s 2>&1 | FileCheck -check-prefix=CHECK-WCHAR2 %s +// RUN: %clang -### -S -funsigned-char %s 2>&1 | FileCheck -check-prefix=CHAR-SIGN2 %s +// CHAR-SIGN2: -fno-signed-char + +// RUN: %clang -### -S -fno-signed-char %s 2>&1 | FileCheck -check-prefix=CHAR-SIGN3 %s +// CHAR-SIGN3: -fno-signed-char + +// RUN: %clang -### -S -fno-unsigned-char %s 2>&1 | FileCheck -check-prefix=CHAR-SIGN4 %s +// CHAR-SIGN4-NOT: -fno-signed-char + +// RUN: %clang -### -fshort-wchar -fno-short-wchar %s 2>&1 | FileCheck -check-prefix=CHECK-WCHAR1 -check-prefix=DELIMITERS %s +// RUN: %clang -### -fno-short-wchar -fshort-wchar %s 2>&1 | FileCheck -check-prefix=CHECK-WCHAR2 -check-prefix=DELIMITERS %s +// Make sure we don't match the -NOT lines with the linker invocation. +// Delimiters match the start of the cc1 and the start of the linker lines +// DELIMITERS: {{^ *"}} // CHECK-WCHAR1: -fno-short-wchar // CHECK-WCHAR1-NOT: -fshort-wchar // CHECK-WCHAR2: -fshort-wchar // CHECK-WCHAR2-NOT: -fno-short-wchar +// DELIMITERS: {{^ *"}} diff --git a/test/Driver/cloudabi.c b/test/Driver/cloudabi.c new file mode 100644 index 0000000..99a2bc2 --- /dev/null +++ b/test/Driver/cloudabi.c @@ -0,0 +1,3 @@ +// RUN: %clang %s -### -target x86_64-unknown-cloudabi 2>&1 | FileCheck %s +// CHECK: "-cc1" "-triple" "x86_64-unknown-cloudabi" {{.*}} "-ffunction-sections" "-fdata-sections" +// CHECK: "-Bstatic" "--eh-frame-hdr" "--gc-sections" "-o" "a.out" "crt0.o" "crtbegin.o" "{{.*}}" "{{.*}}" "-lc" "-lcompiler_rt" "crtend.o" diff --git a/test/Driver/cloudabi.cpp b/test/Driver/cloudabi.cpp new file mode 100644 index 0000000..c3b68ae --- /dev/null +++ b/test/Driver/cloudabi.cpp @@ -0,0 +1,3 @@ +// RUN: %clangxx %s -### -target x86_64-unknown-cloudabi 2>&1 | FileCheck %s +// CHECK: "-cc1" "-triple" "x86_64-unknown-cloudabi" {{.*}} "-ffunction-sections" "-fdata-sections" +// CHECK: "-Bstatic" "--eh-frame-hdr" "--gc-sections" "-o" "a.out" "crt0.o" "crtbegin.o" "{{.*}}" "{{.*}}" "-lc++" "-lc++abi" "-lunwind" "-lc" "-lcompiler_rt" "crtend.o" diff --git a/test/Driver/coverage-ld.c b/test/Driver/coverage-ld.c index 0e39249..1eda5f1 100644 --- a/test/Driver/coverage-ld.c +++ b/test/Driver/coverage-ld.c @@ -26,3 +26,12 @@ // // CHECK-FREEBSD-X86-64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-FREEBSD-X86-64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}freebsd{{/|\\\\}}libclang_rt.profile-x86_64.a" +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target arm-linux-androideabi --coverage \ +// RUN: -resource-dir=%S/Inputs/resource_dir \ +// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \ +// RUN: | FileCheck --check-prefix=CHECK-ANDROID-ARM %s +// +// CHECK-ANDROID-ARM: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}" +// CHECK-ANDROID-ARM: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}libclang_rt.profile-arm-android.a" diff --git a/test/Driver/crash-report-modules.m b/test/Driver/crash-report-modules.m index 84b1604..66ebaa7 100644 --- a/test/Driver/crash-report-modules.m +++ b/test/Driver/crash-report-modules.m @@ -2,7 +2,7 @@ // RUN: mkdir %t // RUN: not env FORCE_CLANG_DIAGNOSTICS_CRASH= TMPDIR=%t TEMP=%t TMP=%t \ -// RUN: %clang -fsyntax-only %s -I %S/Inputs/module \ +// RUN: %clang -fsyntax-only %s -I %S/Inputs/module -isysroot /tmp/ \ // RUN: -fmodules -fmodules-cache-path=/tmp/ -DFOO=BAR 2>&1 | FileCheck %s // RUN: FileCheck --check-prefix=CHECKSRC %s -input-file %t/crash-report-*.m @@ -25,7 +25,10 @@ const int x = MODULE_MACRO; // CHECKSRC: @import simple; // CHECKSRC: const int x = 10; -// CHECKSH: "-cc1" +// CHECKSH: # Crash reproducer +// CHECKSH-NEXT: # Original command: {{.*$}} +// CHECKSH-NEXT: "-cc1" +// CHECKSH: "-isysroot" "/tmp/" // CHECKSH: "-D" "FOO=BAR" // CHECKSH-NOT: "-fmodules-cache-path=/tmp/" // CHECKSH: "crash-report-modules-{{[^ ]*}}.m" diff --git a/test/Driver/crash-report.c b/test/Driver/crash-report.c index 3370da8..5caad79 100644 --- a/test/Driver/crash-report.c +++ b/test/Driver/crash-report.c @@ -18,7 +18,9 @@ // CHECK-NEXT: note: diagnostic msg: {{.*}}crash-report-{{.*}}.c FOO // CHECKSRC: FOO -// CHECKSH: "-cc1" +// CHECKSH: # Crash reproducer +// CHECKSH-NEXT: # Original command: {{.*$}} +// CHECKSH-NEXT: "-cc1" // CHECKSH: "-main-file-name" "crash-report.c" // CHECKSH: "-D" "FOO=BAR" // CHECKSH-NOT: "-F/tmp/" diff --git a/test/Driver/cuda-simple.cu b/test/Driver/cuda-simple.cu new file mode 100644 index 0000000..99d4bfd --- /dev/null +++ b/test/Driver/cuda-simple.cu @@ -0,0 +1,23 @@ +// Verify that we can parse a simple CUDA file with or without -save-temps +// http://llvm.org/PR22936 +// RUN: %clang -Werror -fsyntax-only -c %s +// +// Verify that we pass -x cuda-cpp-output to compiler after +// preprocessing a CUDA file +// RUN: %clang -Werror -### -save-temps -c %s 2>&1 | FileCheck %s +// CHECK: "-cc1" +// CHECK: "-E" +// CHECK: "-x" "cuda" +// CHECK-NEXT: "-cc1" +// CHECK: "-x" "cuda-cpp-output" +// +// Verify that compiler accepts CUDA syntax with "-x cuda-cpp-output". +// RUN: %clang -Werror -fsyntax-only -x cuda-cpp-output -c %s + +int cudaConfigureCall(int, int); +__attribute__((global)) void kernel() {} + +void func() { + kernel<<<1,1>>>(); +} + diff --git a/test/Driver/darwin-debug-flags.c b/test/Driver/darwin-debug-flags.c index abe3f69..17b0bba 100644 --- a/test/Driver/darwin-debug-flags.c +++ b/test/Driver/darwin-debug-flags.c @@ -5,11 +5,11 @@ // <rdar://problem/12955296> // RUN: %clang -### -target i386-apple-darwin9 -c -g %t.s 2>&1 | FileCheck -check-prefix=P %s -// CHECK: !0 = !{ -// CHECK: -I path\5C with\5C \5C\5Cspaces -// CHECK: -g -Os -// CHECK: -mmacosx-version-min=10.5.0 -// CHECK: [ DW_TAG_compile_unit ] +// CHECK: !0 = !DICompileUnit( +// CHECK-SAME: flags: +// CHECK-SAME: -I path\5C with\5C \5C\5Cspaces +// CHECK-SAME: -g -Os +// CHECK-SAME: -mmacosx-version-min=10.5.0 int x; diff --git a/test/Driver/darwin-ld.c b/test/Driver/darwin-ld.c index d3d0f1d..a5f9608 100644 --- a/test/Driver/darwin-ld.c +++ b/test/Driver/darwin-ld.c @@ -204,3 +204,9 @@ // RUN: FileCheck -check-prefix=LINK_IOS_SIMULATOR_VERSION_MIN %s < %t.log // LINK_IPHONEOS_VERSION_MIN: -iphoneos_version_min // LINK_IOS_SIMULATOR_VERSION_MIN: -ios_simulator_version_min + +// Check -iframework gets forward to ld as -F +// RUN: %clang -target x86_64-apple-darwin %s -iframework Bar -framework Foo -### 2>&1 | \ +// RUN: FileCheck --check-prefix=LINK-IFRAMEWORK %s +// LINK-IFRAMEWORK: {{ld(.exe)?"}} +// LINK-IFRAMEWORK: "-FBar" diff --git a/test/Driver/darwin-sanitizer-ld.c b/test/Driver/darwin-sanitizer-ld.c index 500fec4..fb318eb 100644 --- a/test/Driver/darwin-sanitizer-ld.c +++ b/test/Driver/darwin-sanitizer-ld.c @@ -35,8 +35,10 @@ // RUN: | FileCheck --check-prefix=CHECK-UBSAN %s // CHECK-UBSAN: "{{.*}}ld{{(.exe)?}}" -// CHECK-UBSAN: libclang_rt.ubsan_osx.a" // CHECK-UBSAN: stdc++ +// CHECK-UBSAN: libclang_rt.ubsan_osx_dynamic.dylib" +// CHECK-UBSAN: "-rpath" "@executable_path" +// CHECK-UBSAN: "-rpath" "{{.*}}lib{{.*}}darwin" // RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \ // RUN: -fsanitize=bounds -fsanitize-undefined-trap-on-error \ @@ -52,7 +54,9 @@ // CHECK-DYN-UBSAN: "{{.*}}ld{{(.exe)?}}" // CHECK-DYN-UBSAN: "-dylib" -// CHECK-DYN-UBSAN: libclang_rt.ubsan_osx.a +// CHECK-DYN-UBSAN: libclang_rt.ubsan_osx_dynamic.dylib" +// CHECK-DYN-UBSAN: "-rpath" "@executable_path" +// CHECK-DYN-UBSAN: "-rpath" "{{.*}}lib{{.*}}darwin" // RUN: %clang -no-canonical-prefixes -### -target x86_64-darwin \ // RUN: -fsanitize=bounds -fsanitize-undefined-trap-on-error \ @@ -60,4 +64,4 @@ // RUN: | FileCheck --check-prefix=CHECK-DYN-BOUNDS %s // CHECK-DYN-BOUNDS: "{{.*}}ld{{(.exe)?}}" -// CHECK-DYN-BOUNDS-NOT: libclang_rt.ubsan_osx.a +// CHECK-DYN-BOUNDS-NOT: ubsan_osx diff --git a/test/Driver/darwin-version.c b/test/Driver/darwin-version.c index 2478a99..3e7496b 100644 --- a/test/Driver/darwin-version.c +++ b/test/Driver/darwin-version.c @@ -1,31 +1,52 @@ -// RUN: env MACOSX_DEPLOYMENT_TARGET=10.1 \ -// RUN: %clang -target i386-apple-darwin9 -DTEST0 -E %s -#ifdef TEST0 -#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1010 -#error Invalid version -#endif -#endif +// RUN: %clang -target armv6-apple-darwin9 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX %s +// CHECK-VERSION-OSX: "armv6k-apple-macosx10.5.0" +// RUN: %clang -target armv6-apple-darwin9 -miphoneos-version-min=2.0 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS2 %s +// CHECK-VERSION-IOS2: "armv6k-apple-ios2.0.0" +// RUN: %clang -target armv6-apple-darwin9 -miphoneos-version-min=2.2 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS22 %s +// CHECK-VERSION-IOS22: "armv6k-apple-ios2.2.0" +// RUN: %clang -target armv6-apple-darwin9 -miphoneos-version-min=3.0 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS3 %s +// CHECK-VERSION-IOS3: "armv6k-apple-ios3.0.0" +// RUN: %clang -target i686-apple-darwin8 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX4 %s +// RUN: %clang -target i686-apple-darwin9 -mmacosx-version-min=10.4 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX4 %s +// CHECK-VERSION-OSX4: "i386-apple-macosx10.4.0" +// RUN: %clang -target i686-apple-darwin9 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX5 %s +// RUN: %clang -target i686-apple-darwin9 -mmacosx-version-min=10.5 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX5 %s +// CHECK-VERSION-OSX5: "i386-apple-macosx10.5.0" +// RUN: %clang -target i686-apple-darwin10 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX6 %s +// RUN: %clang -target i686-apple-darwin9 -mmacosx-version-min=10.6 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX6 %s +// CHECK-VERSION-OSX6: "i386-apple-macosx10.6.0" +// RUN: %clang -target x86_64-apple-darwin14 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX10 %s +// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min=10.10 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX10 %s +// CHECK-VERSION-OSX10: "x86_64-apple-macosx10.10.0" +// RUN: %clang -target x86_64-apple-macosx -mmacosx-version-min= -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-MISSING %s +// CHECK-VERSION-MISSING: invalid version number +// Check environment variable gets interpreted correctly +// RUN: env MACOSX_DEPLOYMENT_TARGET=10.5 \ +// RUN: %clang -target i386-apple-darwin9 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX5 %s // RUN: env IPHONEOS_DEPLOYMENT_TARGET=2.0 \ -// RUN: %clang -target i386-apple-darwin9 -DTEST1 -E %s -#ifdef TEST1 -#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ != 20000 -#error Invalid version -#endif -#endif - -// RUN: env IPHONEOS_DEPLOYMENT_TARGET=2.3.1 \ -// RUN: %clang -target i386-apple-darwin9 -DTEST2 -E %s -#ifdef TEST2 -#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ != 20301 -#error Invalid version -#endif -#endif +// RUN: %clang -target armv6-apple-darwin9 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS2 %s // RUN: env MACOSX_DEPLOYMENT_TARGET=10.4.10 \ -// RUN: %clang -target i386-apple-darwin9 -DTEST3 -E %s -#ifdef TEST3 -#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1049 -#error Invalid version -#endif -#endif +// RUN: %clang -target i386-apple-darwin9 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-OSX49 %s +// CHECK-VERSION-OSX49: "i386-apple-macosx10.4.10" +// RUN: env IPHONEOS_DEPLOYMENT_TARGET=2.3.1 \ +// RUN: %clang -target armv6-apple-darwin9 -c %s -### 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-VERSION-IOS231 %s +// CHECK-VERSION-IOS231: "armv6k-apple-ios2.3.1" diff --git a/test/Driver/debug-comp-dir.S b/test/Driver/debug-comp-dir.S index daf895c..5bf3b92 100644 --- a/test/Driver/debug-comp-dir.S +++ b/test/Driver/debug-comp-dir.S @@ -1,8 +1,2 @@ // RUN: cd %S && %clang -### -g %s -c 2>&1 | FileCheck -check-prefix=CHECK-PWD %s // CHECK-PWD: {{"-fdebug-compilation-dir" ".*Driver.*"}} - -// "PWD=/foo gcc" wouldn't necessarily work. You would need to pick a different -// path to the same directory (try a symlink). - -// This depends on host's behavior how $PWD would be set. -// REQUIRES: shell diff --git a/test/Driver/debug.c b/test/Driver/debug.c index daf895c..5bf3b92 100644 --- a/test/Driver/debug.c +++ b/test/Driver/debug.c @@ -1,8 +1,2 @@ // RUN: cd %S && %clang -### -g %s -c 2>&1 | FileCheck -check-prefix=CHECK-PWD %s // CHECK-PWD: {{"-fdebug-compilation-dir" ".*Driver.*"}} - -// "PWD=/foo gcc" wouldn't necessarily work. You would need to pick a different -// path to the same directory (try a symlink). - -// This depends on host's behavior how $PWD would be set. -// REQUIRES: shell diff --git a/test/Driver/fast-math.c b/test/Driver/fast-math.c index 690d7a1..24c3038 100644 --- a/test/Driver/fast-math.c +++ b/test/Driver/fast-math.c @@ -25,6 +25,36 @@ // CHECK-NO-INFS-NO-FAST-MATH: "-cc1" // CHECK-NO-INFS-NO-FAST-MATH-NOT: "-menable-no-infs" // +// RUN: %clang -### -fno-signed-zeros -c %s 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-SIGNED-ZEROS %s +// CHECK-NO-SIGNED-ZEROS: "-cc1" +// CHECK-NO-SIGNED-ZEROS: "-fno-signed-zeros" +// +// RUN: %clang -### -fno-fast-math -fno-signed-zeros -c %s 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-FAST-MATH-NO-SIGNED-ZEROS %s +// CHECK-NO-FAST-MATH-NO-SIGNED-ZEROS: "-cc1" +// CHECK-NO-FAST-MATH-NO-SIGNED-ZEROS: "-fno-signed-zeros" +// +// RUN: %clang -### -fno-signed-zeros -fno-fast-math -c %s 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-SIGNED-ZEROS-NO-FAST-MATH %s +// CHECK-NO-SIGNED-ZEROS-NO-FAST-MATH: "-cc1" +// CHECK-NO-SIGNED-ZEROS-NO-FAST-MATH-NOT: "-fno-signed-zeros" +// +// RUN: %clang -### -freciprocal-math -c %s 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-RECIPROCAL-MATH %s +// CHECK-RECIPROCAL-MATH: "-cc1" +// CHECK-RECIPROCAL-MATH: "-freciprocal-math" +// +// RUN: %clang -### -fno-fast-math -freciprocal-math -c %s 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-FAST-MATH-RECIPROCAL-MATH %s +// CHECK-NO-FAST-MATH-RECIPROCAL-MATH: "-cc1" +// CHECK-NO-FAST-MATH-RECIPROCAL-MATH: "-freciprocal-math" +// +// RUN: %clang -### -freciprocal-math -fno-fast-math -c %s 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-RECIPROCAL-MATH-NO-FAST-MATH %s +// CHECK-RECIPROCAL-MATH-NO-FAST-MATH: "-cc1" +// CHECK-RECIPROCAL-MATH-NO-FAST-MATH-NOT: "-freciprocal-math" +// // RUN: %clang -### -fno-honor-nans -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NO-NANS %s // CHECK-NO-NANS: "-cc1" diff --git a/test/Driver/frame-pointer-elim.c b/test/Driver/frame-pointer-elim.c index 286cd6e..5355cbe 100644 --- a/test/Driver/frame-pointer-elim.c +++ b/test/Driver/frame-pointer-elim.c @@ -26,5 +26,10 @@ // RUN: FileCheck --check-prefix=OMIT_LEAF %s // OMIT_LEAF: "-momit-leaf-frame-pointer" +// On the PS4, we default to omitting the frame pointer on leaf functions +// (OMIT_LEAF check line is above) +// RUN: %clang -### -target x86_64-scei-ps4 -S %s 2>&1 | \ +// RUN: FileCheck --check-prefix=OMIT_LEAF %s + void f0() {} void f1() { f0(); } diff --git a/test/Driver/fsanitize-blacklist.c b/test/Driver/fsanitize-blacklist.c index 690bc87..c7180ded 100644 --- a/test/Driver/fsanitize-blacklist.c +++ b/test/Driver/fsanitize-blacklist.c @@ -3,18 +3,25 @@ // PR12920 // REQUIRES: clang-driver, shell +// Make sure we don't match the -NOT lines with the linker invocation. +// Delimiters match the start of the cc1 and the start of the linker lines +// for fragile tests. +// DELIMITERS: {{^ *"}} + // RUN: echo "fun:foo" > %t.good +// RUN: echo "fun:bar" > %t.second // RUN: echo "badline" > %t.bad -// RUN: %clang -fsanitize=address -fsanitize-blacklist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BLACKLIST -// CHECK-BLACKLIST: -fsanitize-blacklist +// RUN: %clang -fsanitize=address -fsanitize-blacklist=%t.good -fsanitize-blacklist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BLACKLIST +// CHECK-BLACKLIST: -fsanitize-blacklist={{.*}}.good +// CHECK-BLACKLIST: -fsanitize-blacklist={{.*}}.second // Ignore -fsanitize-blacklist flag if there is no -fsanitize flag. -// RUN: %clang -fsanitize-blacklist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE +// RUN: %clang -fsanitize-blacklist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE --check-prefix=DELIMITERS // CHECK-NO-SANITIZE-NOT: -fsanitize-blacklist // Flag -fno-sanitize-blacklist wins if it is specified later. -// RUN: %clang -fsanitize=address -fsanitize-blacklist=%t.good -fno-sanitize-blacklist %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-BLACKLIST +// RUN: %clang -fsanitize=address -fsanitize-blacklist=%t.good -fno-sanitize-blacklist %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-BLACKLIST --check-prefix=DELIMITERS // CHECK-NO-BLACKLIST-NOT: -fsanitize-blacklist // Driver barks on unexisting blacklist files. @@ -22,5 +29,13 @@ // CHECK-NO-SUCH-FILE: error: no such file or directory: 'unexisting.txt' // Driver properly reports malformed blacklist files. -// RUN: %clang -fsanitize=address -fsanitize-blacklist=%t.bad %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BAD-BLACKLIST -// CHECK-BAD-BLACKLIST: error: malformed sanitizer blacklist +// RUN: %clang -fsanitize=address -fsanitize-blacklist=%t.second -fsanitize-blacklist=%t.bad -fsanitize-blacklist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BAD-BLACKLIST +// CHECK-BAD-BLACKLIST: error: malformed sanitizer blacklist: 'error parsing file '{{.*}}.bad': malformed line 1: 'badline'' + +// -fno-sanitize-blacklist disables all blacklists specified earlier. +// RUN: %clang -fsanitize=address -fsanitize-blacklist=%t.good -fno-sanitize-blacklist -fsanitize-blacklist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ONLY-FIRST-DISABLED +// CHECK-ONLY_FIRST-DISABLED-NOT: good +// CHECK-ONLY-FIRST-DISABLED: -fsanitize-blacklist={{.*}}.second +// CHECK-ONLY_FIRST-DISABLED-NOT: good + +// DELIMITERS: {{^ *"}} diff --git a/test/Driver/fsanitize-coverage.c b/test/Driver/fsanitize-coverage.c new file mode 100644 index 0000000..51ab97a --- /dev/null +++ b/test/Driver/fsanitize-coverage.c @@ -0,0 +1,70 @@ +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=0 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-0 +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=edge -fsanitize-coverage=0 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-0 +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-0 +// CHECK-SANITIZE-COVERAGE-0-NOT: fsanitize-coverage-type + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1 +// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1 +// RUN: %clang -target x86_64-linux-gnu -fsanitize=leak -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1 +// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1 +// RUN: %clang -target x86_64-linux-gnu -fsanitize=bool -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1 +// RUN: %clang -target x86_64-linux-gnu -fsanitize=dataflow -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1 +// CHECK-SANITIZE-COVERAGE-1: fsanitize-coverage-type=1 + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=2 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-2 +// CHECK-SANITIZE-COVERAGE-2: fsanitize-coverage-type=2 + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=3 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-3 +// CHECK-SANITIZE-COVERAGE-3: fsanitize-coverage-type=3 + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=4 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-4 +// CHECK-SANITIZE-COVERAGE-4: fsanitize-coverage-type=3 +// CHECK-SANITIZE-COVERAGE-4: fsanitize-coverage-indirect-calls + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=5 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-5 +// CHECK-SANITIZE-COVERAGE-5: error: unsupported argument '5' to option 'fsanitize-coverage=' + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-UNUSED +// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-UNUSED +// CHECK-SANITIZE-COVERAGE-UNUSED: argument unused during compilation: '-fsanitize-coverage=1' + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=1 -fno-sanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-SAN-DISABLED +// CHECK-SANITIZE-COVERAGE-SAN-DISABLED-NOT: argument unused + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=edge,indirect-calls,trace-bb,trace-cmp,8bit-counters %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FEATURES +// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-type=3 +// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-indirect-calls +// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-trace-bb +// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-trace-cmp +// CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-8bit-counters + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func,edge,indirect-calls,trace-bb,trace-cmp -fno-sanitize-coverage=edge,indirect-calls,trace-bb %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MASK +// CHECK-MASK: -fsanitize-coverage-type=1 +// CHECK-MASK: -fsanitize-coverage-trace-cmp +// CHECK-MASK-NOT: -fsanitize-coverage- + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=foobar %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-INVALID-VALUE +// CHECK-INVALID-VALUE: error: unsupported argument 'foobar' to option 'fsanitize-coverage=' + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func -fsanitize-coverage=edge %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-INCOMPATIBLE +// CHECK-INCOMPATIBLE: error: invalid argument '-fsanitize-coverage=func' not allowed with '-fsanitize-coverage=edge' + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=8bit-counters %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-TYPE +// CHECK-MISSING-TYPE: error: invalid argument '-fsanitize-coverage=8bit-counters' only allowed with '-fsanitize-coverage=(func|bb|edge)' + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=trace-cmp,indirect-calls %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-TYPE-NECESSARY +// CHECK-NO-TYPE-NECESSARY-NOT: error: +// CHECK-NO-TYPE-NECESSARY: -fsanitize-coverage-indirect-calls +// CHECK-NO-TYPE-NECESSARY: -fsanitize-coverage-trace-cmp + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=1 -fsanitize-coverage=trace-cmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-EXTEND-LEGACY +// CHECK-EXTEND-LEGACY: -fsanitize-coverage-type=1 +// CHECK-EXTEND-LEGACY: -fsanitize-coverage-trace-cmp + +// RUN: %clang_cl -fsanitize=address -fsanitize-coverage=1 -c -### -- %s 2>&1 | FileCheck %s -check-prefix=CLANG-CL-COVERAGE +// CLANG-CL-COVERAGE-NOT: error: +// CLANG-CL-COVERAGE-NOT: warning: +// CLANG-CL-COVERAGE-NOT: argument unused +// CLANG-CL-COVERAGE-NOT: unknown argument +// CLANG-CL-COVERAGE: -fsanitize=address +// CLANG-CL-COVERAGE: -fsanitize-coverage-type=1 diff --git a/test/Driver/fsanitize.c b/test/Driver/fsanitize.c index 1988503..fff59a3 100644 --- a/test/Driver/fsanitize.c +++ b/test/Driver/fsanitize.c @@ -1,16 +1,16 @@ // RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined-trap -fsanitize-undefined-trap-on-error %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-TRAP // RUN: %clang -target x86_64-linux-gnu -fsanitize-undefined-trap-on-error -fsanitize=undefined-trap %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-TRAP -// CHECK-UNDEFINED-TRAP: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|shift|unreachable|return|vla-bound|alignment|null|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute|nonnull-attribute),?){16}"}} +// CHECK-UNDEFINED-TRAP: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute|nonnull-attribute),?){17}"}} // CHECK-UNDEFINED-TRAP: "-fsanitize-undefined-trap-on-error" // RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED -// CHECK-UNDEFINED: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|function|shift|unreachable|return|vla-bound|alignment|null|vptr|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute|nonnull-attribute),?){18}"}} +// CHECK-UNDEFINED: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|function|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|vptr|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute|nonnull-attribute),?){19}"}} // RUN: %clang -target x86_64-apple-darwin10 -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-DARWIN -// CHECK-UNDEFINED-DARWIN: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|shift|unreachable|return|vla-bound|alignment|null|vptr|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute|nonnull-attribute),?){17}"}} +// CHECK-UNDEFINED-DARWIN: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|vptr|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute|nonnull-attribute),?){18}"}} // RUN: %clang -target x86_64-linux-gnu -fsanitize=integer %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-INTEGER -// CHECK-INTEGER: "-fsanitize={{((signed-integer-overflow|unsigned-integer-overflow|integer-divide-by-zero|shift),?){4}"}} +// CHECK-INTEGER: "-fsanitize={{((signed-integer-overflow|unsigned-integer-overflow|integer-divide-by-zero|shift-base|shift-exponent),?){5}"}} // RUN: %clang -fsanitize=bounds -### -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix=CHECK-BOUNDS // CHECK-BOUNDS: "-fsanitize={{((array-bounds|local-bounds),?){2}"}} @@ -22,7 +22,10 @@ // CHECK-FNO-SANITIZE-ALL: "-fsanitize=thread" // RUN: %clang -target x86_64-linux-gnu -fsanitize=thread,undefined -fno-sanitize=thread -fno-sanitize=float-cast-overflow,vptr,bool,enum %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-PARTIAL-UNDEFINED -// CHECK-PARTIAL-UNDEFINED: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|function|shift|unreachable|return|vla-bound|alignment|null|object-size|array-bounds|returns-nonnull-attribute|nonnull-attribute),?){14}"}} +// CHECK-PARTIAL-UNDEFINED: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|function|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|object-size|array-bounds|returns-nonnull-attribute|nonnull-attribute),?){15}"}} + +// RUN: %clang -target x86_64-linux-gnu -fsanitize=shift -fno-sanitize=shift-base %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-FSANITIZE-SHIFT-PARTIAL +// CHECK-FSANITIZE-SHIFT-PARTIAL: "-fsanitize=shift-exponent" // RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fsanitize-undefined-trap-on-error %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-TRAP-ON-ERROR-UNDEF // CHECK-UNDEFINED-TRAP-ON-ERROR-UNDEF: '-fsanitize=undefined' not allowed with '-fsanitize-undefined-trap-on-error' @@ -31,9 +34,11 @@ // CHECK-UNDEFINED-TRAP-ON-ERROR-VPTR: '-fsanitize=vptr' not allowed with '-fsanitize-undefined-trap-on-error' // RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-NO-RTTI -// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-NO-RTTI // CHECK-VPTR-NO-RTTI: '-fsanitize=vptr' not allowed with '-fno-rtti' +// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-NO-RTTI +// CHECK-UNDEFINED-NO-RTTI-NOT: vptr + // RUN: %clang -target x86_64-linux-gnu -fsanitize=address,thread -fno-rtti %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANA-SANT // CHECK-SANA-SANT: '-fsanitize=address' not allowed with '-fsanitize=thread' @@ -55,6 +60,9 @@ // RUN: %clang -target x86_64-linux-gnu -fsanitize-memory-track-origins -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ONLY-TRACK-ORIGINS // CHECK-ONLY-TRACK-ORIGINS: warning: argument unused during compilation: '-fsanitize-memory-track-origins' +// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fno-sanitize=memory -fsanitize-memory-track-origins -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACK-ORIGINS-DISABLED-MSAN +// CHECK-TRACK-ORIGINS-DISABLED-MSAN-NOT: warning: argument unused + // RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-EXTRA-TRACK-ORIGINS // CHECK-NO-EXTRA-TRACK-ORIGINS-NOT: "-fsanitize-memory-track-origins" @@ -64,11 +72,13 @@ // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -pie %s -### 2>&1 // OK -// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-memory-track-origins -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACK-ORIGINS-1 +// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-memory-track-origins -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACK-ORIGINS-2 // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-memory-track-origins=1 -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACK-ORIGINS-1 -// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-memory-track-origins=2 -fsanitize-memory-track-origins -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACK-ORIGINS-1 -// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fno-sanitize-memory-track-origins -fsanitize-memory-track-origins -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACK-ORIGINS-1 -// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-memory-track-origins=0 -fsanitize-memory-track-origins -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACK-ORIGINS-1 +// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-memory-track-origins=1 -fsanitize-memory-track-origins -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACK-ORIGINS-2 +// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-memory-track-origins=2 -fsanitize-memory-track-origins -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACK-ORIGINS-2 +// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fno-sanitize-memory-track-origins -fsanitize-memory-track-origins -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACK-ORIGINS-2 +// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-memory-track-origins=0 -fsanitize-memory-track-origins=1 -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACK-ORIGINS-1 +// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-memory-track-origins=0 -fsanitize-memory-track-origins -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACK-ORIGINS-2 // CHECK-TRACK-ORIGINS-1: -fsanitize-memory-track-origins=1 @@ -86,24 +96,6 @@ // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-memory-track-origins=3 -pie %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACK-ORIGINS-3 // CHECK-TRACK-ORIGINS-3: error: invalid value '3' in '-fsanitize-memory-track-origins=3' -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=0 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-0 -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-0 -// CHECK-SANITIZE-COVERAGE-0-NOT: fsanitize-coverage -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1 -// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1 -// RUN: %clang -target x86_64-linux-gnu -fsanitize=leak -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1 -// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1 -// RUN: %clang -target x86_64-linux-gnu -fsanitize=bool -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1 -// CHECK-SANITIZE-COVERAGE-1: fsanitize-coverage=1 -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=4 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-4 -// CHECK-SANITIZE-COVERAGE-4: fsanitize-coverage=4 -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=5 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-5 -// CHECK-SANITIZE-COVERAGE-5: error: invalid value '5' in '-fsanitize-coverage=5' -// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-UNUSED -// RUN: %clang -target x86_64-linux-gnu -fsanitize=dataflow -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-UNUSED -// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-UNUSED -// CHECK-SANITIZE-COVERAGE-UNUSED: argument unused during compilation: '-fsanitize-coverage=1' - // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-address-field-padding=0 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-FIELD-PADDING-0 // CHECK-ASAN-FIELD-PADDING-0-NOT: -fsanitize-address-field-padding // RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-address-field-padding=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-FIELD-PADDING-1 @@ -114,6 +106,9 @@ // CHECK-ASAN-FIELD-PADDING-3: error: invalid value '3' in '-fsanitize-address-field-padding=3' // RUN: %clang -target x86_64-linux-gnu -fsanitize-address-field-padding=2 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-FIELD-PADDING-NO-ASAN // CHECK-ASAN-FIELD-PADDING-NO-ASAN: warning: argument unused during compilation: '-fsanitize-address-field-padding=2' +// RUN: %clang -target x86_64-linux-gnu -fsanitize-address-field-padding=2 -fsanitize=address -fno-sanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-FIELD-PADDING-DISABLED-ASAN +// CHECK-ASAN-FIELD-PADDING-DISABLED-ASAN-NOT: warning: argument unused + // RUN: %clang -target x86_64-linux-gnu -fsanitize=vptr -fno-sanitize=vptr -fsanitize=undefined,address %s -### 2>&1 // OK @@ -135,20 +130,25 @@ // RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -### 2>&1 | FileCheck %s --check-prefix=CHECK-RECOVER // RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fsanitize-recover -### 2>&1 | FileCheck %s --check-prefix=CHECK-RECOVER // RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fsanitize-recover=all -### 2>&1 | FileCheck %s --check-prefix=CHECK-RECOVER -// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fno-sanitize-recover -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-RECOVER +// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fno-sanitize-recover=undefined -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-RECOVER // RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fno-sanitize-recover=all -fsanitize-recover=thread -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-RECOVER // RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fno-sanitize-recover -fsanitize-recover=undefined -### 2>&1 | FileCheck %s --check-prefix=CHECK-RECOVER -// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fsanitize-recover -fno-sanitize-recover -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-RECOVER -// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fno-sanitize-recover=all -fsanitize-recover=object-size -### 2>&1 | FileCheck %s --check-prefix=CHECK-PARTIAL-RECOVER +// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fsanitize-recover=all -fno-sanitize-recover=undefined -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-RECOVER +// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fno-sanitize-recover=all -fsanitize-recover=object-size,shift-base -### 2>&1 | FileCheck %s --check-prefix=CHECK-PARTIAL-RECOVER -// CHECK-RECOVER: "-fsanitize-recover={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|function|shift|vla-bound|alignment|null|vptr|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute|nonnull-attribute),?){16}"}} +// CHECK-RECOVER: "-fsanitize-recover={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|function|shift-base|shift-exponent|vla-bound|alignment|null|vptr|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute|nonnull-attribute),?){17}"}} // CHECK-NO-RECOVER-NOT: sanitize-recover -// CHECK-PARTIAL-RECOVER: "-fsanitize-recover=object-size" +// CHECK-PARTIAL-RECOVER: "-fsanitize-recover={{((object-size|shift-base),?){2}"}} // RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fsanitize-recover=address,foobar,object-size,unreachable -### 2>&1 | FileCheck %s --check-prefix=CHECK-DIAG-RECOVER // CHECK-DIAG-RECOVER: unsupported argument 'foobar' to option 'fsanitize-recover=' // CHECK-DIAG-RECOVER: unsupported argument 'address,unreachable' to option 'fsanitize-recover=' +// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fsanitize-recover -fno-sanitize-recover -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEPRECATED-RECOVER +// CHECK-DEPRECATED-RECOVER: argument '-fsanitize-recover' is deprecated, use '-fsanitize-recover=undefined,integer' instead +// CHECK-DEPRECATED-RECOVER: argument '-fno-sanitize-recover' is deprecated, use '-fno-sanitize-recover=undefined,integer' instead +// CHECK-DEPRECATED-RECOVER-NOT: is deprecated + // RUN: %clang -target x86_64-linux-gnu -fsanitize=leak %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANL // CHECK-SANL: "-fsanitize=leak" @@ -157,6 +157,8 @@ // RUN: %clang -target x86_64-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MSAN // CHECK-MSAN: "-fno-assume-sane-operator-new" +// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN +// CHECK-ASAN: "-fno-assume-sane-operator-new" // RUN: %clang -target x86_64-linux-gnu -fsanitize=zzz %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DIAG1 // CHECK-DIAG1: unsupported argument 'zzz' to option 'fsanitize=' @@ -186,6 +188,17 @@ // RUN: %clang -target x86_64-apple-darwin10 -fsanitize=function -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-FSAN-UBSAN-DARWIN // CHECK-FSAN-UBSAN-DARWIN: unsupported option '-fsanitize=function' for target 'x86_64-apple-darwin10' +// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI +// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi-derived-cast -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-DCAST +// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi-unrelated-cast -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-UCAST +// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi-nvcall -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-NVCALL +// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi-vcall -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-VCALL +// CHECK-CFI: -emit-llvm-bc{{.*}}-fsanitize=cfi-derived-cast,cfi-unrelated-cast,cfi-nvcall,cfi-vcall +// CHECK-CFI-DCAST: -emit-llvm-bc{{.*}}-fsanitize=cfi-derived-cast +// CHECK-CFI-UCAST: -emit-llvm-bc{{.*}}-fsanitize=cfi-unrelated-cast +// CHECK-CFI-NVCALL: -emit-llvm-bc{{.*}}-fsanitize=cfi-nvcall +// CHECK-CFI-VCALL: -emit-llvm-bc{{.*}}-fsanitize=cfi-vcall + // RUN: %clang_cl -fsanitize=address -c -MDd -### -- %s 2>&1 | FileCheck %s -check-prefix=CHECK-ASAN-DEBUGRTL // RUN: %clang_cl -fsanitize=address -c -MTd -### -- %s 2>&1 | FileCheck %s -check-prefix=CHECK-ASAN-DEBUGRTL // RUN: %clang_cl -fsanitize=address -c -LDd -### -- %s 2>&1 | FileCheck %s -check-prefix=CHECK-ASAN-DEBUGRTL diff --git a/test/Driver/function-sections.c b/test/Driver/function-sections.c index fe6d303..ba065b1 100644 --- a/test/Driver/function-sections.c +++ b/test/Driver/function-sections.c @@ -4,6 +4,8 @@ // CHECK-NOFS-NOT: -ffunction-sections // CHECK-DS: -fdata-sections // CHECK-NODS-NOT: -fdata-sections +// CHECK-US-NOT: -fno-unique-section-names +// CHECK-NOUS: -fno-unique-section-names // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ // RUN: -target i386-unknown-linux \ @@ -60,3 +62,13 @@ // RUN: -fdata-sections -fno-data-sections -fdata-sections \ // RUN: | FileCheck --check-prefix=CHECK-DS %s + +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ +// RUN: -target i386-unknown-linux \ +// RUN: -funique-section-names \ +// RUN: | FileCheck --check-prefix=CHECK-US %s + +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ +// RUN: -target i386-unknown-linux \ +// RUN: -fno-unique-section-names \ +// RUN: | FileCheck --check-prefix=CHECK-NOUS %s diff --git a/test/Driver/fveclib.c b/test/Driver/fveclib.c new file mode 100644 index 0000000..3bd4bf6 --- /dev/null +++ b/test/Driver/fveclib.c @@ -0,0 +1,17 @@ +// RUN: %clang -### -c -fveclib=none %s 2>&1 | FileCheck -check-prefix CHECK-NOLIB %s +// RUN: %clang -### -c -fveclib=Accelerate %s 2>&1 | FileCheck -check-prefix CHECK-ACCELERATE %s +// RUN: not %clang -c -fveclib=something %s 2>&1 | FileCheck -check-prefix CHECK-INVALID %s + +// CHECK-NOLIB: "-fveclib=none" +// CHECK-ACCELERATE: "-fveclib=Accelerate" + +// CHECK-INVALID: error: invalid value 'something' in '-fveclib=something' + +// RUN: %clang -fveclib=Accelerate %s -target arm64-apple-ios8.0.0 -### 2>&1 | FileCheck --check-prefix=CHECK-LINK %s +// CHECK-LINK: "-framework" "Accelerate" + +// RUN: %clang -fveclib=Accelerate %s -nostdlib -target arm64-apple-ios8.0.0 -### 2>&1 | FileCheck --check-prefix=CHECK-LINK-NOSTDLIB %s +// CHECK-LINK-NOSTDLIB-NOT: "-framework" "Accelerate" + +// RUN: %clang -fveclib=Accelerate %s -nodefaultlibs -target arm64-apple-ios8.0.0 -### 2>&1 | FileCheck --check-prefix=CHECK-LINK-NODEFAULTLIBS %s +// CHECK-LINK-NODEFAULTLIBS-NOT: "-framework" "Accelerate" diff --git a/test/Driver/gfortran.f90 b/test/Driver/gfortran.f90 index d531f59..e687e51 100644 --- a/test/Driver/gfortran.f90 +++ b/test/Driver/gfortran.f90 @@ -242,3 +242,19 @@ ! ! Clang understands this one and orders it weirdly. ! CHECK: "-fsyntax-only" +! +! PR22234: Ensure that -fsyntax-only doesn't complain about output types and +! passes along correctly. +! RUN: %clang -no-canonical-prefixes -target i386-linux -fsyntax-only -### %s -o %t 2>&1 | \ +! grep for error message and command-line +! RUN: grep -e error: -e -fsyntax-only | FileCheck %s --check-prefix=CHECK-PR22234 +! +! CHECK-PR22234-NOT: clang: error: invalid output type +! CHECK-PR22234: "-fsyntax-only" +! +! Regression test for the bug introduced with PR22234 fix. +! Make sure -fsyntax-only is not passed to gfortran during normal compilation. +! +! RUN: %clang -no-canonical-prefixes -target i386-linux -### %s -o %t 2>&1 \ +! RUN: | FileCheck %s --check-prefix=CHECK-PR22234-R +! CHECK-PR22234-R-NOT: "-fsyntax-only" diff --git a/test/Driver/gold-lto.c b/test/Driver/gold-lto.c index 18a293b..db6786f 100644 --- a/test/Driver/gold-lto.c +++ b/test/Driver/gold-lto.c @@ -22,5 +22,4 @@ // // RUN: %clang -target i686-linux-android -### %t.o -flto 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-X86-ANDROID -// CHECK-X86-ANDROID: "-pie" // CHECK-X86-ANDROID: "-plugin" "{{.*}}/LLVMgold.so" diff --git a/test/Driver/hexagon-toolchain-elf.c b/test/Driver/hexagon-toolchain-elf.c index 984dc04..b9e53ab 100644 --- a/test/Driver/hexagon-toolchain-elf.c +++ b/test/Driver/hexagon-toolchain-elf.c @@ -497,13 +497,6 @@ // RUN: -fPIC \ // RUN: %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK024 %s -// RUN: %clang -### -target hexagon-unknown-elf \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -fPIC \ -// RUN: -msmall-data-threshold=8 \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK024 %s // CHECK024: "-cc1" // CHECK024-NOT: "-mrelocation-model" "static" // CHECK024: "-pic-level" "{{[12]}}" diff --git a/test/Driver/hexagon-toolchain.c b/test/Driver/hexagon-toolchain.c index 391b78a..5d9553e 100644 --- a/test/Driver/hexagon-toolchain.c +++ b/test/Driver/hexagon-toolchain.c @@ -490,18 +490,11 @@ // RUN: --gcc-toolchain="" \ // RUN: -fpic \ // RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK024 %s -// RUN: %clang -### -target hexagon-unknown-linux \ -// RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ -// RUN: --gcc-toolchain="" \ -// RUN: -fPIC \ -// RUN: %s 2>&1 \ -// RUN: | FileCheck -check-prefix=CHECK024 %s +// RUN: | sed -e "s/\.exe//" -e "s/\.EXE//" | FileCheck -check-prefix=CHECK024 %s // RUN: %clang -### -target hexagon-unknown-linux \ // RUN: -ccc-install-dir %S/Inputs/hexagon_tree/qc/bin \ // RUN: --gcc-toolchain="" \ // RUN: -fPIC \ -// RUN: -msmall-data-threshold=8 \ // RUN: %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK024 %s // CHECK024: "-cc1" diff --git a/test/Driver/ms-inline-asm.c b/test/Driver/inline-asm.c index 0383564..bafd03d 100644 --- a/test/Driver/ms-inline-asm.c +++ b/test/Driver/inline-asm.c @@ -13,3 +13,12 @@ // RUN: FileCheck --check-prefix=CHECK-NO-BLOCKS < %t %s // CHECK-NO-BLOCKS-NOT: "-fasm-blocks" + +// RUN: %clang -target x86_64-apple-darwin10 \ +// RUN: -### -fsyntax-only -fno-gnu-inline-asm %s 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-NO-GNU-INLINE-ASM %s +// RUN: %clang -target x86_64-apple-darwin10 \ +// RUN: -### -fsyntax-only -fgnu-inline-asm -fno-gnu-inline-asm %s 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-NO-GNU-INLINE-ASM %s + +// CHECK-NO-GNU-INLINE-ASM: "-fno-gnu-inline-asm" diff --git a/test/Driver/instrprof-ld.c b/test/Driver/instrprof-ld.c index f16fa8f..cd926cd 100644 --- a/test/Driver/instrprof-ld.c +++ b/test/Driver/instrprof-ld.c @@ -19,6 +19,15 @@ // CHECK-LINUX-X86-64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}libclang_rt.profile-x86_64.a" {{.*}} "-lc" // // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target x86_64-unknown-linux -fprofile-instr-generate -nostdlib \ +// RUN: -resource-dir=%S/Inputs/resource_dir \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-LINUX-NOSTDLIB-X86-64 %s +// +// CHECK-LINUX-NOSTDLIB-X86-64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" +// CHECK-LINUX-NOSTDLIB-X86-64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}libclang_rt.profile-x86_64.a" +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: -target x86_64-unknown-freebsd -fprofile-instr-generate \ // RUN: -resource-dir=%S/Inputs/resource_dir \ // RUN: --sysroot=%S/Inputs/basic_freebsd64_tree \ @@ -56,3 +65,27 @@ // // CHECK-FREEBSD-X86-64-SHARED: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-FREEBSD-X86-64-SHARED: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}freebsd{{/|\\\\}}libclang_rt.profile-x86_64.a" +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target x86_64-apple-darwin14 -fprofile-instr-generate \ +// RUN: -resource-dir=%S/Inputs/resource_dir \ +// RUN: | FileCheck --check-prefix=CHECK-DARWIN-X86-64 %s +// +// CHECK-DARWIN-X86-64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" +// CHECK-DARWIN-X86-64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}darwin{{/|\\\\}}libclang_rt.profile_osx.a" +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target x86_64-apple-darwin14 -fprofile-instr-generate -nostdlib \ +// RUN: -resource-dir=%S/Inputs/resource_dir \ +// RUN: | FileCheck --check-prefix=CHECK-DARWIN-NOSTDLIB-X86-64 %s +// +// CHECK-DARWIN-NOSTDLIB-X86-64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" +// CHECK-DARWIN-NOSTDLIB-X86-64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}darwin{{/|\\\\}}libclang_rt.profile_osx.a" +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target arm64-apple-ios -fprofile-instr-generate \ +// RUN: -resource-dir=%S/Inputs/resource_dir \ +// RUN: | FileCheck --check-prefix=CHECK-DARWIN-ARM64 %s +// +// CHECK-DARWIN-ARM64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" +// CHECK-DARWIN-ARM64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}darwin{{/|\\\\}}libclang_rt.profile_ios.a" diff --git a/test/Driver/linux-as.c b/test/Driver/linux-as.c index 05c7fa7..8aa323a 100644 --- a/test/Driver/linux-as.c +++ b/test/Driver/linux-as.c @@ -25,16 +25,61 @@ // RUN: | FileCheck -check-prefix=CHECK-ARM-ALL %s // CHECK-ARM-ALL: as{{(.exe)?}}" "-mfloat-abi=soft" "-march=armv7-a" "-mcpu=cortex-a8" "-mfpu=neon" // +// RUN: %clang -target arm-linux -mcpu=cortex-a8 -mfpu=neon -march=armebv7-a -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-ARMEB-ALL %s +// CHECK-ARMEB-ALL: as{{(.exe)?}}" "-mfloat-abi=soft" "-march=armebv7-a" "-mcpu=cortex-a8" "-mfpu=neon" +// +// RUN: %clang -target thumb-linux -mcpu=cortex-a8 -mfpu=neon -march=thumbv7-a -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-THUMB-ALL %s +// CHECK-THUMB-ALL: as{{(.exe)?}}" "-mfloat-abi=soft" "-march=thumbv7-a" "-mcpu=cortex-a8" "-mfpu=neon" +// +// RUN: %clang -target thumb-linux -mcpu=cortex-a8 -mfpu=neon -march=thumbebv7-a -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-THUMBEB-ALL %s +// CHECK-THUMBEB-ALL: as{{(.exe)?}}" "-mfloat-abi=soft" "-march=thumbebv7-a" "-mcpu=cortex-a8" "-mfpu=neon" +// // RUN: %clang -target armv7-linux -mcpu=cortex-a8 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ARM-TARGET %s // CHECK-ARM-TARGET: as{{(.exe)?}}" "-mfpu=neon" "-mfloat-abi=soft" "-mcpu=cortex-a8" // +// RUN: %clang -target armebv7-linux -mcpu=cortex-a8 -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-ARMEB-TARGET %s +// CHECK-ARMEB-TARGET: as{{(.exe)?}}" "-mfpu=neon" "-mfloat-abi=soft" "-mcpu=cortex-a8" +// +// RUN: %clang -target thumbv7-linux -mcpu=cortex-a8 -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-THUMB-TARGET %s +// CHECK-THUMB-TARGET: as{{(.exe)?}}" "-mfpu=neon" "-mfloat-abi=soft" "-mcpu=cortex-a8" +// +// RUN: %clang -target thumbebv7-linux -mcpu=cortex-a8 -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-THUMBEB-TARGET %s +// CHECK-THUMBEB-TARGET: as{{(.exe)?}}" "-mfpu=neon" "-mfloat-abi=soft" "-mcpu=cortex-a8" +// // RUN: %clang -target armv8-linux -mcpu=cortex-a53 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ARM-TARGET-V8 %s // CHECK-ARM-TARGET-V8: as{{(.exe)?}}" "-mfpu=crypto-neon-fp-armv8" "-mfloat-abi=soft" "-mcpu=cortex-a53" // +// RUN: %clang -target armebv8-linux -mcpu=cortex-a53 -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-ARMEB-TARGET-V8 %s +// CHECK-ARMEB-TARGET-V8: as{{(.exe)?}}" "-mfpu=crypto-neon-fp-armv8" "-mfloat-abi=soft" "-mcpu=cortex-a53" +// +// RUN: %clang -target thumbv8-linux -mcpu=cortex-a53 -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-THUMB-TARGET-V8 %s +// CHECK-THUMB-TARGET-V8: as{{(.exe)?}}" "-mfpu=crypto-neon-fp-armv8" "-mfloat-abi=soft" "-mcpu=cortex-a53" +// +// RUN: %clang -target thumbebv8-linux -mcpu=cortex-a53 -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-THUMBEB-TARGET-V8 %s +// CHECK-THUMBEB-TARGET-V8: as{{(.exe)?}}" "-mfpu=crypto-neon-fp-armv8" "-mfloat-abi=soft" "-mcpu=cortex-a53" +// // RUN: %clang -target arm-linux -mfloat-abi=hard -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ARM-MFLOAT-ABI %s @@ -86,6 +131,14 @@ // CHECK-SPARCV8: -Av8plusa // CHECK-SPARCV8: -o // +// RUN: %clang -target sparcel-linux -mcpu=invalid-cpu -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=CHECK-SPARCV8EL %s +// CHECK-SPARCV8EL: as +// CHECK-SPARCV8EL: -32 +// CHECK-SPARCV8EL: -Av8plusa +// CHECK-SPARCV8EL: -o +// // RUN: %clang -target s390x-linux -### -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-Z-DEFAULT-ARCH %s // CHECK-Z-DEFAULT-ARCH: as{{.*}} "-march=z10" diff --git a/test/Driver/linux-header-search.cpp b/test/Driver/linux-header-search.cpp index c62c494..574ae22 100644 --- a/test/Driver/linux-header-search.cpp +++ b/test/Driver/linux-header-search.cpp @@ -33,12 +33,13 @@ // RUN: --gcc-toolchain="" \ // RUN: | FileCheck --check-prefix=CHECK-UBUNTU-11-04 %s // CHECK-UBUNTU-11-04: "{{.*}}clang{{.*}}" "-cc1" +// CHECK-UBUNTU-11-04: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-UBUNTU-11-04: "-isysroot" "[[SYSROOT:[^"]+]]" // CHECK-UBUNTU-11-04: "-internal-isystem" "[[SYSROOT]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../../../include/c++/4.5" // CHECK-UBUNTU-11-04: "-internal-isystem" "[[SYSROOT]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../../../include/c++/4.5/i686-linux-gnu" // CHECK-UBUNTU-11-04: "-internal-isystem" "[[SYSROOT]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../../../include/c++/4.5/backward" // CHECK-UBUNTU-11-04: "-internal-isystem" "[[SYSROOT]]/usr/local/include" -// CHECK-UBUNTU-11-04: "-internal-isystem" "{{.*}}{{/|\\\\}}lib{{(64|32)?}}{{/|\\\\}}clang{{/|\\\\}}{{[0-9]\.[0-9]\.[0-9]}}{{/|\\\\}}include" +// CHECK-UBUNTU-11-04: "-internal-isystem" "[[RESOURCE_DIR]]{{/|\\\\}}include" // CHECK-UBUNTU-11-04: "-internal-externc-isystem" "[[SYSROOT]]/include" // CHECK-UBUNTU-11-04: "-internal-externc-isystem" "[[SYSROOT]]/usr/include" // @@ -48,12 +49,13 @@ // RUN: --gcc-toolchain="" \ // RUN: | FileCheck --check-prefix=CHECK-UBUNTU-13-04 %s // CHECK-UBUNTU-13-04: "{{[^"]*}}clang{{[^"]*}}" "-cc1" +// CHECK-UBUNTU-13-04: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-UBUNTU-13-04: "-isysroot" "[[SYSROOT:[^"]+]]" // CHECK-UBUNTU-13-04: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7" // CHECK-UBUNTU-13-04: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/x86_64-linux-gnu/c++/4.7" // CHECK-UBUNTU-13-04: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/backward" // CHECK-UBUNTU-13-04: "-internal-isystem" "[[SYSROOT]]/usr/local/include" -// CHECK-UBUNTU-13-04: "-internal-isystem" "{{.*}}{{/|\\\\}}lib{{(64|32)?}}{{/|\\\\}}clang{{/|\\\\}}{{[0-9]\.[0-9]\.[0-9]}}{{/|\\\\}}include" +// CHECK-UBUNTU-13-04: "-internal-isystem" "[[RESOURCE_DIR]]{{/|\\\\}}include" // CHECK-UBUNTU-13-04: "-internal-externc-isystem" "[[SYSROOT]]/usr/include/x86_64-linux-gnu" // CHECK-UBUNTU-13-04: "-internal-externc-isystem" "[[SYSROOT]]/include" // CHECK-UBUNTU-13-04: "-internal-externc-isystem" "[[SYSROOT]]/usr/include" @@ -64,12 +66,13 @@ // RUN: --gcc-toolchain="" \ // RUN: | FileCheck --check-prefix=CHECK-UBUNTU-14-04 %s // CHECK-UBUNTU-14-04: "{{[^"]*}}clang{{[^"]*}}" "-cc1" +// CHECK-UBUNTU-14-04: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-UBUNTU-14-04: "-isysroot" "[[SYSROOT:[^"]+]]" // CHECK-UBUNTU-14-04: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8" // CHECK-UBUNTU-14-04: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8/x32" // CHECK-UBUNTU-14-04: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward" // CHECK-UBUNTU-14-04: "-internal-isystem" "[[SYSROOT]]/usr/local/include" -// CHECK-UBUNTU-14-04: "-internal-isystem" "{{.*}}{{/|\\\\}}lib{{(64|x32)?}}{{/|\\\\}}clang{{/|\\\\}}{{[0-9]\.[0-9]\.[0-9]}}{{/|\\\\}}include" +// CHECK-UBUNTU-14-04: "-internal-isystem" "[[RESOURCE_DIR]]{{/|\\\\}}include" // CHECK-UBUNTU-14-04: "-internal-externc-isystem" "[[SYSROOT]]/usr/include/x86_64-linux-gnu" // CHECK-UBUNTU-14-04: "-internal-externc-isystem" "[[SYSROOT]]/include" // CHECK-UBUNTU-14-04: "-internal-externc-isystem" "[[SYSROOT]]/usr/include" @@ -80,12 +83,13 @@ // RUN: --gcc-toolchain="" \ // RUN: | FileCheck --check-prefix=CHECK-UBUNTU-13-04-CROSS %s // CHECK-UBUNTU-13-04-CROSS: "{{[^"]*}}clang{{[^"]*}}" "-cc1" +// CHECK-UBUNTU-13-04-CROSS: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-UBUNTU-13-04-CROSS: "-isysroot" "[[SYSROOT:[^"]+]]" // CHECK-UBUNTU-13-04-CROSS: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabihf/4.7/../../../../include/c++/4.7" // CHECK-UBUNTU-13-04-CROSS: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabihf/4.7/../../../../include/arm-linux-gnueabihf/c++/4.7" // CHECK-UBUNTU-13-04-CROSS: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabihf/4.7/../../../../include/c++/4.7/backward" // CHECK-UBUNTU-13-04-CROSS: "-internal-isystem" "[[SYSROOT]]/usr/local/include" -// CHECK-UBUNTU-13-04-CROSS: "-internal-isystem" "{{.*}}{{/|\\\\}}lib{{(64|32)?}}{{/|\\\\}}clang{{/|\\\\}}{{[0-9]\.[0-9]\.[0-9]}}{{/|\\\\}}include" +// CHECK-UBUNTU-13-04-CROSS: "-internal-isystem" "[[RESOURCE_DIR]]{{/|\\\\}}include" // CHECK-UBUNTU-13-04-CROSS: "-internal-externc-isystem" "[[SYSROOT]]/include" // CHECK-UBUNTU-13-04-CROSS: "-internal-externc-isystem" "[[SYSROOT]]/usr/include" // @@ -154,12 +158,13 @@ // RUN: --gcc-toolchain="" \ // RUN: | FileCheck --check-prefix=CHECK-DEBIAN-X86 %s // CHECK-DEBIAN-X86: "{{[^"]*}}clang{{[^"]*}}" "-cc1" +// CHECK-DEBIAN-X86: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-DEBIAN-X86: "-isysroot" "[[SYSROOT:[^"]+]]" // CHECK-DEBIAN-X86: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/i686-linux-gnu/4.5/../../../../include/c++/4.5" // CHECK-DEBIAN-X86: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/i686-linux-gnu/4.5/../../../../include/c++/4.5/i686-linux-gnu" // CHECK-DEBIAN-X86: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/i686-linux-gnu/4.5/../../../../include/c++/4.5/backward" // CHECK-DEBIAN-X86: "-internal-isystem" "[[SYSROOT]]/usr/local/include" -// CHECK-DEBIAN-X86: "-internal-isystem" "{{.*}}{{/|\\\\}}lib{{(64|32)?}}{{/|\\\\}}clang{{/|\\\\}}{{[0-9]\.[0-9]\.[0-9]}}{{/|\\\\}}include" +// CHECK-DEBIAN-X86: "-internal-isystem" "[[RESOURCE_DIR]]{{/|\\\\}}include" // CHECK-DEBIAN-X86: "-internal-externc-isystem" "[[SYSROOT]]/usr/include/i386-linux-gnu" // CHECK-DEBIAN-X86: "-internal-externc-isystem" "[[SYSROOT]]/include" // CHECK-DEBIAN-X86: "-internal-externc-isystem" "[[SYSROOT]]/usr/include" @@ -169,12 +174,13 @@ // RUN: --gcc-toolchain="" \ // RUN: | FileCheck --check-prefix=CHECK-DEBIAN-X86-64 %s // CHECK-DEBIAN-X86-64: "{{[^"]*}}clang{{[^"]*}}" "-cc1" +// CHECK-DEBIAN-X86-64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-DEBIAN-X86-64: "-isysroot" "[[SYSROOT:[^"]+]]" // CHECK-DEBIAN-X86-64: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.5/../../../../include/c++/4.5" // CHECK-DEBIAN-X86-64: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.5/../../../../include/c++/4.5/x86_64-linux-gnu" // CHECK-DEBIAN-X86-64: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.5/../../../../include/c++/4.5/backward" // CHECK-DEBIAN-X86-64: "-internal-isystem" "[[SYSROOT]]/usr/local/include" -// CHECK-DEBIAN-X86-64: "-internal-isystem" "{{.*}}{{/|\\\\}}lib{{(64|32)?}}{{/|\\\\}}clang{{/|\\\\}}{{[0-9]\.[0-9]\.[0-9]}}{{/|\\\\}}include" +// CHECK-DEBIAN-X86-64: "-internal-isystem" "[[RESOURCE_DIR]]{{/|\\\\}}include" // CHECK-DEBIAN-X86-64: "-internal-externc-isystem" "[[SYSROOT]]/usr/include/x86_64-linux-gnu" // CHECK-DEBIAN-X86-64: "-internal-externc-isystem" "[[SYSROOT]]/include" // CHECK-DEBIAN-X86-64: "-internal-externc-isystem" "[[SYSROOT]]/usr/include" @@ -184,12 +190,13 @@ // RUN: --gcc-toolchain="" \ // RUN: | FileCheck --check-prefix=CHECK-DEBIAN-PPC %s // CHECK-DEBIAN-PPC: "{{[^"]*}}clang{{[^"]*}}" "-cc1" +// CHECK-DEBIAN-PPC: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-DEBIAN-PPC: "-isysroot" "[[SYSROOT:[^"]+]]" // CHECK-DEBIAN-PPC: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/powerpc-linux-gnu/4.5/../../../../include/c++/4.5" // CHECK-DEBIAN-PPC: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/powerpc-linux-gnu/4.5/../../../../include/c++/4.5/powerpc-linux-gnu" // CHECK-DEBIAN-PPC: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/powerpc-linux-gnu/4.5/../../../../include/c++/4.5/backward" // CHECK-DEBIAN-PPC: "-internal-isystem" "[[SYSROOT]]/usr/local/include" -// CHECK-DEBIAN-PPC: "-internal-isystem" "{{.*}}{{/|\\\\}}lib{{(64|32)?}}{{/|\\\\}}clang{{/|\\\\}}{{[0-9]\.[0-9]\.[0-9]}}{{/|\\\\}}include" +// CHECK-DEBIAN-PPC: "-internal-isystem" "[[RESOURCE_DIR]]{{/|\\\\}}include" // CHECK-DEBIAN-PPC: "-internal-externc-isystem" "[[SYSROOT]]/usr/include/powerpc-linux-gnu" // CHECK-DEBIAN-PPC: "-internal-externc-isystem" "[[SYSROOT]]/include" // CHECK-DEBIAN-PPC: "-internal-externc-isystem" "[[SYSROOT]]/usr/include" @@ -199,12 +206,13 @@ // RUN: --gcc-toolchain="" \ // RUN: | FileCheck --check-prefix=CHECK-DEBIAN-PPC64 %s // CHECK-DEBIAN-PPC64: "{{[^"]*}}clang{{[^"]*}}" "-cc1" +// CHECK-DEBIAN-PPC64: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-DEBIAN-PPC64: "-isysroot" "[[SYSROOT:[^"]+]]" // CHECK-DEBIAN-PPC64: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/powerpc64-linux-gnu/4.5/../../../../include/c++/4.5" // CHECK-DEBIAN-PPC64: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/powerpc64-linux-gnu/4.5/../../../../include/c++/4.5/powerpc64-linux-gnu" // CHECK-DEBIAN-PPC64: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/powerpc64-linux-gnu/4.5/../../../../include/c++/4.5/backward" // CHECK-DEBIAN-PPC64: "-internal-isystem" "[[SYSROOT]]/usr/local/include" -// CHECK-DEBIAN-PPC64: "-internal-isystem" "{{.*}}{{/|\\\\}}lib{{(64|32)?}}{{/|\\\\}}clang{{/|\\\\}}{{[0-9]\.[0-9]\.[0-9]}}{{/|\\\\}}include" +// CHECK-DEBIAN-PPC64: "-internal-isystem" "[[RESOURCE_DIR]]{{/|\\\\}}include" // CHECK-DEBIAN-PPC64: "-internal-externc-isystem" "[[SYSROOT]]/usr/include/powerpc64-linux-gnu" // CHECK-DEBIAN-PPC64: "-internal-externc-isystem" "[[SYSROOT]]/include" // CHECK-DEBIAN-PPC64: "-internal-externc-isystem" "[[SYSROOT]]/usr/include" @@ -217,12 +225,13 @@ // RUN: --gcc-toolchain="" \ // RUN: | FileCheck --check-prefix=CHECK-GENTOO-4-6-2 %s // CHECK-GENTOO-4-6-2: "{{.*}}clang{{.*}}" "-cc1" +// CHECK-GENTOO-4-6-2: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-GENTOO-4-6-2: "-isysroot" "[[SYSROOT:[^"]+]]" // CHECK-GENTOO-4-6-2: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.2/include/g++-v4" // CHECK-GENTOO-4-6-2: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.2/include/g++-v4/x86_64-pc-linux-gnu" // CHECK-GENTOO-4-6-2: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.2/include/g++-v4/backward" // CHECK-GENTOO-4-6-2: "-internal-isystem" "[[SYSROOT]]/usr/local/include" -// CHECK-GENTOO-4-6-2: "-internal-isystem" "{{.*}}{{/|\\\\}}lib{{(64|32)?}}{{/|\\\\}}clang{{/|\\\\}}{{[0-9]\.[0-9]\.[0-9]}}{{/|\\\\}}include" +// CHECK-GENTOO-4-6-2: "-internal-isystem" "[[RESOURCE_DIR]]{{/|\\\\}}include" // CHECK-GENTOO-4-6-2: "-internal-externc-isystem" "[[SYSROOT]]/include" // CHECK-GENTOO-4-6-2: "-internal-externc-isystem" "[[SYSROOT]]/usr/include" // RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ @@ -231,12 +240,13 @@ // RUN: --gcc-toolchain="" \ // RUN: | FileCheck --check-prefix=CHECK-GENTOO-4-6-4 %s // CHECK-GENTOO-4-6-4: "{{.*}}clang{{.*}}" "-cc1" +// CHECK-GENTOO-4-6-4: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-GENTOO-4-6-4: "-isysroot" "[[SYSROOT:[^"]+]]" // CHECK-GENTOO-4-6-4: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.4/include/g++-v4.6" // CHECK-GENTOO-4-6-4: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.4/include/g++-v4.6/x86_64-pc-linux-gnu" // CHECK-GENTOO-4-6-4: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.4/include/g++-v4.6/backward" // CHECK-GENTOO-4-6-4: "-internal-isystem" "[[SYSROOT]]/usr/local/include" -// CHECK-GENTOO-4-6-4: "-internal-isystem" "{{.*}}{{/|\\\\}}lib{{(64|32)?}}{{/|\\\\}}clang{{/|\\\\}}{{[0-9]\.[0-9]\.[0-9]}}{{/|\\\\}}include" +// CHECK-GENTOO-4-6-4: "-internal-isystem" "[[RESOURCE_DIR]]{{/|\\\\}}include" // CHECK-GENTOO-4-6-4: "-internal-externc-isystem" "[[SYSROOT]]/include" // CHECK-GENTOO-4-6-4: "-internal-externc-isystem" "[[SYSROOT]]/usr/include" // @@ -247,12 +257,13 @@ // RUN: --gcc-toolchain="" \ // RUN: | FileCheck --check-prefix=CHECK-MIPS64-GNUABI %s // CHECK-MIPS64-GNUABI: "{{[^"]*}}clang{{[^"]*}}" "-cc1" +// CHECK-MIPS64-GNUABI: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-MIPS64-GNUABI: "-isysroot" "[[SYSROOT:[^"]+]]" // CHECK-MIPS64-GNUABI: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/mips64-linux-gnuabi64/4.9/../../../../include/c++/4.9" // CHECK-MIPS64-GNUABI: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/mips64-linux-gnuabi64/4.9/../../../../include/c++/4.9/mips64-linux-gnuabi64" // CHECK-MIPS64-GNUABI: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/mips64-linux-gnuabi64/4.9/../../../../include/c++/4.9/backward" // CHECK-MIPS64-GNUABI: "-internal-isystem" "[[SYSROOT]]/usr/local/include" -// CHECK-MIPS64-GNUABI: "-internal-isystem" "{{.*}}{{/|\\\\}}lib{{(64|32)?}}{{/|\\\\}}clang{{/|\\\\}}{{[0-9]\.[0-9]\.[0-9]}}{{/|\\\\}}include" +// CHECK-MIPS64-GNUABI: "-internal-isystem" "[[RESOURCE_DIR]]{{/|\\\\}}include" // CHECK-MIPS64-GNUABI: "-internal-externc-isystem" "[[SYSROOT]]/usr/include/mips64-linux-gnuabi64" // CHECK-MIPS64-GNUABI: "-internal-externc-isystem" "[[SYSROOT]]/include" // CHECK-MIPS64-GNUABI: "-internal-externc-isystem" "[[SYSROOT]]/usr/include" @@ -264,12 +275,13 @@ // RUN: --gcc-toolchain="" \ // RUN: | FileCheck --check-prefix=CHECK-MIPS64EL-GNUABI %s // CHECK-MIPS64EL-GNUABI: "{{[^"]*}}clang{{[^"]*}}" "-cc1" +// CHECK-MIPS64EL-GNUABI: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" // CHECK-MIPS64EL-GNUABI: "-isysroot" "[[SYSROOT:[^"]+]]" // CHECK-MIPS64EL-GNUABI: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/mips64el-linux-gnuabi64/4.9/../../../../include/c++/4.9" // CHECK-MIPS64EL-GNUABI: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/mips64el-linux-gnuabi64/4.9/../../../../include/c++/4.9/mips64el-linux-gnuabi64" // CHECK-MIPS64EL-GNUABI: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/mips64el-linux-gnuabi64/4.9/../../../../include/c++/4.9/backward" // CHECK-MIPS64EL-GNUABI: "-internal-isystem" "[[SYSROOT]]/usr/local/include" -// CHECK-MIPS64EL-GNUABI: "-internal-isystem" "{{.*}}{{/|\\\\}}lib{{(64|32)?}}{{/|\\\\}}clang{{/|\\\\}}{{[0-9]\.[0-9]\.[0-9]}}{{/|\\\\}}include" +// CHECK-MIPS64EL-GNUABI: "-internal-isystem" "[[RESOURCE_DIR]]{{/|\\\\}}include" // CHECK-MIPS64EL-GNUABI: "-internal-externc-isystem" "[[SYSROOT]]/usr/include/mips64el-linux-gnuabi64" // CHECK-MIPS64EL-GNUABI: "-internal-externc-isystem" "[[SYSROOT]]/include" // CHECK-MIPS64EL-GNUABI: "-internal-externc-isystem" "[[SYSROOT]]/usr/include" diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c index 871d226..38edb7f 100644 --- a/test/Driver/linux-ld.c +++ b/test/Driver/linux-ld.c @@ -71,6 +71,21 @@ // CHECK-LD-RT: libclang_rt.builtins-x86_64.a" "-lgcc_s" // // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=arm-linux-androideabi \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \ +// RUN: --rtlib=compiler-rt \ +// RUN: | FileCheck --check-prefix=CHECK-LD-RT-ANDROID %s +// CHECK-LD-RT-ANDROID-NOT: warning: +// CHECK-LD-RT-ANDROID: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-LD-RT-ANDROID: "--eh-frame-hdr" +// CHECK-LD-RT-ANDROID: "-m" "armelf_linux_eabi" +// CHECK-LD-RT-ANDROID: "-dynamic-linker" +// CHECK-LD-RT-ANDROID: libclang_rt.builtins-arm-android.a" "-lgcc_s" +// CHECK-LD-RT-ANDROID: "-lc" +// CHECK-LD-RT-ANDROID: libclang_rt.builtins-arm-android.a" "-lgcc_s" +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: --target=x86_64-unknown-linux \ // RUN: --gcc-toolchain="" \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ @@ -402,6 +417,23 @@ // CHECK-BASIC-LIBCXX-INSTALL: "--sysroot=[[SYSROOT]]" // CHECK-BASIC-LIBCXX-INSTALL: "-L[[SYSROOT]]/usr/bin/../lib" // +// Test that we can use -stdlib=libc++ in a build system even when it +// occasionally links C code instead of C++ code. +// RUN: %clang -no-canonical-prefixes -x c %s -### -o %t.o 2>&1 \ +// RUN: -target x86_64-unknown-linux-gnu \ +// RUN: -stdlib=libc++ \ +// RUN: -ccc-install-dir %S/Inputs/basic_linux_libcxx_tree/usr/bin \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree \ +// RUN: | FileCheck --check-prefix=CHECK-BASIC-LIBCXX-C-LINK %s +// CHECK-BASIC-LIBCXX-C-LINK-NOT: warning: +// CHECK-BASIC-LIBCXX-C-LINK: "{{[^"]*}}clang{{[^"]*}}" "-cc1" +// CHECK-BASIC-LIBCXX-C-LINK: "-isysroot" "[[SYSROOT:[^"]+]]" +// CHECK-BASIC-LIBCXX-C-LINK-NOT: "-internal-isystem" "[[SYSROOT]]/usr/bin/../include/c++/v1" +// CHECK-BASIC-LIBCXX-C-LINK: "-internal-isystem" "[[SYSROOT]]/usr/local/include" +// CHECK-BASIC-LIBCXX-C-LINK: "--sysroot=[[SYSROOT]]" +// CHECK-BASIC-LIBCXX-C-LINK: "-L[[SYSROOT]]/usr/bin/../lib" +// // Test a very broken version of multiarch that shipped in Ubuntu 11.04. // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: --target=i386-unknown-linux \ @@ -602,6 +634,9 @@ // RUN: %clang %s -### -o %t.o 2>&1 \ // RUN: --target=powerpc64-linux-gnu -mabi=elfv1 \ // RUN: | FileCheck --check-prefix=CHECK-PPC64-ELFv1 %s +// RUN: %clang %s -### -o %t.o 2>&1 \ +// RUN: --target=powerpc64-linux-gnu -mabi=elfv1-qpx \ +// RUN: | FileCheck --check-prefix=CHECK-PPC64-ELFv1 %s // CHECK-PPC64-ELFv1: "{{.*}}ld{{(.exe)?}}" // CHECK-PPC64-ELFv1: "-m" "elf64ppc" // CHECK-PPC64-ELFv1: "-dynamic-linker" "{{.*}}/lib64/ld64.so.1" @@ -721,14 +756,21 @@ // CHECK-MIPS64EL-N32-NAN2008-NOT: "--hash-style={{gnu|both}}" // // RUN: %clang %s -### -o %t.o 2>&1 \ -// RUN: --target=sparc-linux-gnu \ +// RUN: --target=sparc-unknown-linux-gnu \ // RUN: | FileCheck --check-prefix=CHECK-SPARCV8 %s // CHECK-SPARCV8: "{{.*}}ld{{(.exe)?}}" // CHECK-SPARCV8: "-m" "elf32_sparc" // CHECK-SPARCV8: "-dynamic-linker" "/lib/ld-linux.so.2" // // RUN: %clang %s -### -o %t.o 2>&1 \ -// RUN: --target=sparcv9-linux-gnu \ +// RUN: --target=sparcel-unknown-linux-gnu \ +// RUN: | FileCheck --check-prefix=CHECK-SPARCV8EL %s +// CHECK-SPARCV8EL: "{{.*}}ld{{(.exe)?}}" +// CHECK-SPARCV8EL: "-m" "elf32_sparc" +// CHECK-SPARCV8EL: "-dynamic-linker" "/lib/ld-linux.so.2" +// +// RUN: %clang %s -### -o %t.o 2>&1 \ +// RUN: --target=sparcv9-unknown-linux-gnu \ // RUN: | FileCheck --check-prefix=CHECK-SPARCV9 %s // CHECK-SPARCV9: "{{.*}}ld{{(.exe)?}}" // CHECK-SPARCV9: "-m" "elf64_sparc" @@ -1078,6 +1120,31 @@ // CHECK-ANDROID-PIE: "{{.*}}{{/|\\\\}}crtend_android.o" // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: --target=arm-linux-androideabi \ +// RUN: | FileCheck --check-prefix=CHECK-ANDROID-NO-DEFAULT-PIE %s +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=arm-linux-android \ +// RUN: | FileCheck --check-prefix=CHECK-ANDROID-NO-DEFAULT-PIE %s +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=aarch64-linux-android \ +// RUN: | FileCheck --check-prefix=CHECK-ANDROID-NO-DEFAULT-PIE %s +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=arm64-linux-android \ +// RUN: | FileCheck --check-prefix=CHECK-ANDROID-NO-DEFAULT-PIE %s +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=mipsel-linux-android \ +// RUN: | FileCheck --check-prefix=CHECK-ANDROID-NO-DEFAULT-PIE %s +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=mips64el-linux-android \ +// RUN: | FileCheck --check-prefix=CHECK-ANDROID-NO-DEFAULT-PIE %s +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=i686-linux-android \ +// RUN: | FileCheck --check-prefix=CHECK-ANDROID-NO-DEFAULT-PIE %s +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=x86_64-linux-android \ +// RUN: | FileCheck --check-prefix=CHECK-ANDROID-NO-DEFAULT-PIE %s +// CHECK-ANDROID-NO-DEFAULT-PIE-NOT: -pie +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=arm-linux-androideabi \ // RUN: --gcc-toolchain="" \ // RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \ // RUN: | FileCheck --check-prefix=CHECK-ANDROID-32 %s diff --git a/test/Driver/lit.local.cfg b/test/Driver/lit.local.cfg index d69e6ec..af6d021 100644 --- a/test/Driver/lit.local.cfg +++ b/test/Driver/lit.local.cfg @@ -1,4 +1,5 @@ -config.suffixes = ['.c', '.cpp', '.h', '.m', '.mm', '.S', '.s', '.f90', '.f95'] +config.suffixes = ['.c', '.cpp', '.h', '.m', '.mm', '.S', '.s', '.f90', '.f95', + '.cu'] config.substitutions = list(config.substitutions) config.substitutions.insert(0, ('%clang_cc1', diff --git a/test/Driver/mg.c b/test/Driver/mg.c index 4f43814..82d8a60 100644 --- a/test/Driver/mg.c +++ b/test/Driver/mg.c @@ -1,5 +1,5 @@ -// RUN: %clang -M -MG -include nonexistent-preinclude.h %s > %t -// RUN: fgrep nonexistent-preinclude.h %t -// RUN: fgrep nonexistent-ppinclude.h %t +// RUN: %clang -M -MG -include nonexistent-preinclude.h %s | FileCheck %s +// CHECK: nonexistent-preinclude.h +// CHECK: nonexistent-ppinclude.h #include "nonexistent-ppinclude.h" diff --git a/test/Driver/mglobal-merge.c b/test/Driver/mglobal-merge.c new file mode 100644 index 0000000..ad76736 --- /dev/null +++ b/test/Driver/mglobal-merge.c @@ -0,0 +1,40 @@ +// RUN: %clang -target armv7-unknown-unknown -### -fsyntax-only %s 2> %t \ +// RUN: -mno-global-merge +// RUN: FileCheck --check-prefix=CHECK-NGM-ARM < %t %s + +// RUN: %clang -target aarch64-unknown-unknown -### -fsyntax-only %s 2> %t \ +// RUN: -mno-global-merge +// RUN: FileCheck --check-prefix=CHECK-NGM-AARCH64 < %t %s + +// RUN: %clang -target x86_64-unknown-unknown -### -fsyntax-only %s 2> %t \ +// RUN: -mno-global-merge +// RUN: FileCheck --check-prefix=CHECK-NONE < %t %s + +// CHECK-NGM-ARM: "-backend-option" "-arm-global-merge=false" +// CHECK-NGM-AARCH64: "-backend-option" "-aarch64-global-merge=false" + +// RUN: %clang -target armv7-unknown-unknown -### -fsyntax-only %s 2> %t \ +// RUN: -mglobal-merge +// RUN: FileCheck --check-prefix=CHECK-GM-ARM < %t %s + +// RUN: %clang -target aarch64-unknown-unknown -### -fsyntax-only %s 2> %t \ +// RUN: -mglobal-merge +// RUN: FileCheck --check-prefix=CHECK-GM-AARCH64 < %t %s + +// RUN: %clang -target x86_64-unknown-unknown -### -fsyntax-only %s 2> %t \ +// RUN: -mglobal-merge +// RUN: FileCheck --check-prefix=CHECK-NONE < %t %s + +// CHECK-GM-ARM: "-backend-option" "-arm-global-merge=true" +// CHECK-GM-AARCH64: "-backend-option" "-aarch64-global-merge=true" + +// RUN: %clang -target armv7-unknown-unknown -### -fsyntax-only %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-NONE < %t %s + +// RUN: %clang -target aarch64-unknown-unknown -### -fsyntax-only %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-NONE < %t %s + +// RUN: %clang -target x86_64-unknown-unknown -### -fsyntax-only %s 2> %t +// RUN: FileCheck --check-prefix=CHECK-NONE < %t %s + +// CHECK-NONE-NOT: -global-merge= diff --git a/test/Driver/mips-as.c b/test/Driver/mips-as.c index 12f1844..755ae83 100644 --- a/test/Driver/mips-as.c +++ b/test/Driver/mips-as.c @@ -98,6 +98,16 @@ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-32R2 %s // MIPS-ALIAS-32R2: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" // +// RUN: %clang -target mips-linux-gnu -mips32r3 -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=MIPS-ALIAS-32R3 %s +// MIPS-ALIAS-32R3: as{{(.exe)?}}" "-march" "mips32r3" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" +// +// RUN: %clang -target mips-linux-gnu -mips32r5 -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=MIPS-ALIAS-32R5 %s +// MIPS-ALIAS-32R5: as{{(.exe)?}}" "-march" "mips32r5" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" +// // RUN: %clang -target mips-linux-gnu -mips32r6 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-32R6 %s @@ -113,6 +123,16 @@ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-64R2 %s // MIPS-ALIAS-64R2: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-mno-shared" "-KPIC" "-EB" // +// RUN: %clang -target mips64-linux-gnu -mips64r3 -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=MIPS-ALIAS-64R3 %s +// MIPS-ALIAS-64R3: as{{(.exe)?}}" "-march" "mips64r3" "-mabi" "64" "-mno-shared" "-KPIC" "-EB" +// +// RUN: %clang -target mips64-linux-gnu -mips64r5 -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=MIPS-ALIAS-64R5 %s +// MIPS-ALIAS-64R5: as{{(.exe)?}}" "-march" "mips64r5" "-mabi" "64" "-mno-shared" "-KPIC" "-EB" +// // RUN: %clang -target mips64-linux-gnu -mips64r6 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-64R6 %s diff --git a/test/Driver/mips-features.c b/test/Driver/mips-features.c index f702230..5094f2b 100644 --- a/test/Driver/mips-features.c +++ b/test/Driver/mips-features.c @@ -105,13 +105,13 @@ // CHECK-NOMFP64: "-target-feature" "-fp64" // // -mnan=2008 -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang -target mips-linux-gnu -march=mips32r3 -### -c %s \ // RUN: -mnan=legacy -mnan=2008 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NAN2008 %s // CHECK-NAN2008: "-target-feature" "+nan2008" // // -mnan=legacy -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang -target mips-linux-gnu -march=mips32r3 -### -c %s \ // RUN: -mnan=2008 -mnan=legacy 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NANLEGACY %s // CHECK-NANLEGACY: "-target-feature" "-nan2008" diff --git a/test/Driver/mips-fsf.cpp b/test/Driver/mips-fsf.cpp index 07b95c8..e39b24e 100644 --- a/test/Driver/mips-fsf.cpp +++ b/test/Driver/mips-fsf.cpp @@ -2699,3 +2699,113 @@ // CHECK-EL-NAN64-64R2-64-DEF: "-L[[TC]]/../../../../sysroot/mips64r2/64/el/nan2008/usr/lib" // CHECK-EL-NAN64-64R2-64-DEF: "[[TC]]/mips64r2/64/el/nan2008{{/|\\\\}}crtend.o" // CHECK-EL-NAN64-64R2-64-DEF: "[[TC]]/../../../../sysroot/mips64r2/64/el/nan2008/usr/lib{{/|\\\\}}crtn.o" +// +// Check that mips32r3 and mips32r5 are equal to mips32r2 +// +// = Big-endian, mips32r3, hard float +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=mips-linux-gnu -mips32r3 -mhard-float \ +// RUN: --gcc-toolchain=%S/Inputs/mips_fsf_tree \ +// RUN: | FileCheck --check-prefix=CHECK-BE-HF-32R3 %s +// CHECK-BE-HF-32R3: "-internal-isystem" +// CHECK-BE-HF-32R3: "[[TC:[^"]+/lib/gcc/mips-mti-linux-gnu/4.9.0]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0" +// CHECK-BE-HF-32R3: "-internal-isystem" +// CHECK-BE-HF-32R3: "[[TC]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu" +// CHECK-BE-HF-32R3: "-internal-isystem" +// CHECK-BE-HF-32R3: "[[TC]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0/backward" +// CHECK-BE-HF-32R3: "-internal-externc-isystem" +// CHECK-BE-HF-32R3: "[[TC]]/include" +// CHECK-BE-HF-32R3: "-internal-externc-isystem" +// CHECK-BE-HF-32R3: "[[TC]]/../../../../sysroot/usr/include" +// CHECK-BE-HF-32R3: "{{.*}}ld{{(.exe)?}}" +// CHECK-BE-HF-32R3: "--sysroot=[[TC]]/../../../../sysroot" +// CHECK-BE-HF-32R3: "-dynamic-linker" "/lib/ld.so.1" +// CHECK-BE-HF-32R3: "[[TC]]/../../../../sysroot/usr/lib/../lib{{/|\\\\}}crt1.o" +// CHECK-BE-HF-32R3: "[[TC]]/../../../../sysroot/usr/lib/../lib{{/|\\\\}}crti.o" +// CHECK-BE-HF-32R3: "[[TC]]{{/|\\\\}}crtbegin.o" +// CHECK-BE-HF-32R3: "-L[[TC]]" +// CHECK-BE-HF-32R3: "-L[[TC]]/../../../../mips-mti-linux-gnu/lib/../lib" +// CHECK-BE-HF-32R3: "-L[[TC]]/../../../../sysroot/usr/lib/../lib" +// CHECK-BE-HF-32R3: "[[TC]]{{/|\\\\}}crtend.o" +// CHECK-BE-HF-32R3: "[[TC]]/../../../../sysroot/usr/lib/../lib{{/|\\\\}}crtn.o" +// +// = Big-endian, mips32r5, hard float +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=mips-linux-gnu -mips32r5 -mhard-float \ +// RUN: --gcc-toolchain=%S/Inputs/mips_fsf_tree \ +// RUN: | FileCheck --check-prefix=CHECK-BE-HF-32R5 %s +// CHECK-BE-HF-32R5: "-internal-isystem" +// CHECK-BE-HF-32R5: "[[TC:[^"]+/lib/gcc/mips-mti-linux-gnu/4.9.0]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0" +// CHECK-BE-HF-32R5: "-internal-isystem" +// CHECK-BE-HF-32R5: "[[TC]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu" +// CHECK-BE-HF-32R5: "-internal-isystem" +// CHECK-BE-HF-32R5: "[[TC]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0/backward" +// CHECK-BE-HF-32R5: "-internal-externc-isystem" +// CHECK-BE-HF-32R5: "[[TC]]/include" +// CHECK-BE-HF-32R5: "-internal-externc-isystem" +// CHECK-BE-HF-32R5: "[[TC]]/../../../../sysroot/usr/include" +// CHECK-BE-HF-32R5: "{{.*}}ld{{(.exe)?}}" +// CHECK-BE-HF-32R5: "--sysroot=[[TC]]/../../../../sysroot" +// CHECK-BE-HF-32R5: "-dynamic-linker" "/lib/ld.so.1" +// CHECK-BE-HF-32R5: "[[TC]]/../../../../sysroot/usr/lib/../lib{{/|\\\\}}crt1.o" +// CHECK-BE-HF-32R5: "[[TC]]/../../../../sysroot/usr/lib/../lib{{/|\\\\}}crti.o" +// CHECK-BE-HF-32R5: "[[TC]]{{/|\\\\}}crtbegin.o" +// CHECK-BE-HF-32R5: "-L[[TC]]" +// CHECK-BE-HF-32R5: "-L[[TC]]/../../../../mips-mti-linux-gnu/lib/../lib" +// CHECK-BE-HF-32R5: "-L[[TC]]/../../../../sysroot/usr/lib/../lib" +// CHECK-BE-HF-32R5: "[[TC]]{{/|\\\\}}crtend.o" +// CHECK-BE-HF-32R5: "[[TC]]/../../../../sysroot/usr/lib/../lib{{/|\\\\}}crtn.o" +// +// = Big-endian, mips64r3, ABI 64, hard float +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=mips64-linux-gnu -mips64r3 -mabi=64 -mhard-float \ +// RUN: --gcc-toolchain=%S/Inputs/mips_fsf_tree \ +// RUN: | FileCheck --check-prefix=CHECK-BE-HF-64R3-64 %s +// CHECK-BE-HF-64R3-64: "-internal-isystem" +// CHECK-BE-HF-64R3-64: "[[TC:[^"]+/lib/gcc/mips-mti-linux-gnu/4.9.0]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0" +// CHECK-BE-HF-64R3-64: "-internal-isystem" +// CHECK-BE-HF-64R3-64: "[[TC]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips64r2/64" +// CHECK-BE-HF-64R3-64: "-internal-isystem" +// CHECK-BE-HF-64R3-64: "[[TC]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0/backward" +// CHECK-BE-HF-64R3-64: "-internal-externc-isystem" +// CHECK-BE-HF-64R3-64: "[[TC]]/include" +// CHECK-BE-HF-64R3-64: "-internal-externc-isystem" +// CHECK-BE-HF-64R3-64: "[[TC]]/../../../../sysroot/usr/include" +// CHECK-BE-HF-64R3-64: "{{.*}}ld{{(.exe)?}}" +// CHECK-BE-HF-64R3-64: "--sysroot=[[TC]]/../../../../sysroot/mips64r2/64" +// CHECK-BE-HF-64R3-64: "-dynamic-linker" "/lib64/ld.so.1" +// CHECK-BE-HF-64R3-64: "[[TC]]/../../../../sysroot/mips64r2/64/usr/lib{{/|\\\\}}crt1.o" +// CHECK-BE-HF-64R3-64: "[[TC]]/../../../../sysroot/mips64r2/64/usr/lib{{/|\\\\}}crti.o" +// CHECK-BE-HF-64R3-64: "[[TC]]/mips64r2/64{{/|\\\\}}crtbegin.o" +// CHECK-BE-HF-64R3-64: "-L[[TC]]/mips64r2/64" +// CHECK-BE-HF-64R3-64: "-L[[TC]]/../../../../mips-mti-linux-gnu/lib/mips64r2/64" +// CHECK-BE-HF-64R3-64: "-L[[TC]]/../../../../sysroot/mips64r2/64/usr/lib" +// CHECK-BE-HF-64R3-64: "[[TC]]/mips64r2/64{{/|\\\\}}crtend.o" +// CHECK-BE-HF-64R3-64: "[[TC]]/../../../../sysroot/mips64r2/64/usr/lib{{/|\\\\}}crtn.o" +// +// = Big-endian, mips64r5, ABI 64, hard float +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=mips64-linux-gnu -mips64r5 -mabi=64 -mhard-float \ +// RUN: --gcc-toolchain=%S/Inputs/mips_fsf_tree \ +// RUN: | FileCheck --check-prefix=CHECK-BE-HF-64R5-64 %s +// CHECK-BE-HF-64R5-64: "-internal-isystem" +// CHECK-BE-HF-64R5-64: "[[TC:[^"]+/lib/gcc/mips-mti-linux-gnu/4.9.0]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0" +// CHECK-BE-HF-64R5-64: "-internal-isystem" +// CHECK-BE-HF-64R5-64: "[[TC]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0/mips-mti-linux-gnu/mips64r2/64" +// CHECK-BE-HF-64R5-64: "-internal-isystem" +// CHECK-BE-HF-64R5-64: "[[TC]]/../../../../mips-mti-linux-gnu/include/c++/4.9.0/backward" +// CHECK-BE-HF-64R5-64: "-internal-externc-isystem" +// CHECK-BE-HF-64R5-64: "[[TC]]/include" +// CHECK-BE-HF-64R5-64: "-internal-externc-isystem" +// CHECK-BE-HF-64R5-64: "[[TC]]/../../../../sysroot/usr/include" +// CHECK-BE-HF-64R5-64: "{{.*}}ld{{(.exe)?}}" +// CHECK-BE-HF-64R5-64: "--sysroot=[[TC]]/../../../../sysroot/mips64r2/64" +// CHECK-BE-HF-64R5-64: "-dynamic-linker" "/lib64/ld.so.1" +// CHECK-BE-HF-64R5-64: "[[TC]]/../../../../sysroot/mips64r2/64/usr/lib{{/|\\\\}}crt1.o" +// CHECK-BE-HF-64R5-64: "[[TC]]/../../../../sysroot/mips64r2/64/usr/lib{{/|\\\\}}crti.o" +// CHECK-BE-HF-64R5-64: "[[TC]]/mips64r2/64{{/|\\\\}}crtbegin.o" +// CHECK-BE-HF-64R5-64: "-L[[TC]]/mips64r2/64" +// CHECK-BE-HF-64R5-64: "-L[[TC]]/../../../../mips-mti-linux-gnu/lib/mips64r2/64" +// CHECK-BE-HF-64R5-64: "-L[[TC]]/../../../../sysroot/mips64r2/64/usr/lib" +// CHECK-BE-HF-64R5-64: "[[TC]]/mips64r2/64{{/|\\\\}}crtend.o" +// CHECK-BE-HF-64R5-64: "[[TC]]/../../../../sysroot/mips64r2/64/usr/lib{{/|\\\\}}crtn.o" diff --git a/test/Driver/mips-integrated-as.s b/test/Driver/mips-integrated-as.s index b648650..2c298e7 100644 --- a/test/Driver/mips-integrated-as.s +++ b/test/Driver/mips-integrated-as.s @@ -5,24 +5,19 @@ // RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mabi=o32 2>&1 | \ // RUN: FileCheck -check-prefix=ABI-O32 %s // ABI-O32: -cc1as -// ABI-O32: "-target-feature" "-n64" -// ABI-O32: "-target-feature" "+o32" +// ABI-O32: "-target-abi" "o32" // RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mabi=eabi 2>&1 | \ // RUN: FileCheck -check-prefix=ABI-EABI32 %s // ABI-EABI32: -cc1as -// ABI-EABI32: "-target-feature" "-o32" -// ABI-EABI32: "-target-feature" "-n64" -// ABI-EABI32: "-target-feature" "+eabi" +// ABI-EABI32: "-target-abi" "eabi" // RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mips64 -mabi=n32 2>&1 | \ // RUN: FileCheck -check-prefix=ABI-N32 %s // RUN: %clang -target mips64-linux-gnu -### -fintegrated-as -c %s -mabi=n32 2>&1 | \ // RUN: FileCheck -check-prefix=ABI-N32 %s // ABI-N32: -cc1as -// ABI-N32: "-target-feature" "-o32" -// ABI-N32: "-target-feature" "-n64" -// ABI-N32: "-target-feature" "+n32" +// ABI-N32: "-target-abi" "n32" // FIXME: We should also test '-target mips-linux-gnu -mips64' defaults to the // default 64-bit ABI (N64 but GCC uses N32). It currently selects O32 @@ -39,8 +34,7 @@ // RUN: %clang -target mips64-linux-gnu -### -fintegrated-as -c %s -mips64 -mabi=n64 2>&1 | \ // RUN: FileCheck -check-prefix=ABI-N64 %s // ABI-N64: -cc1as -// ABI-N64: "-target-feature" "-o32" -// ABI-N64: "-target-feature" "+n64" +// ABI-N64: "-target-abi" "n64" // RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -msoft-float 2>&1 | \ // RUN: FileCheck -check-prefix=SOFTFLOAT %s @@ -68,7 +62,7 @@ // NAN-LEGACY: -cc1as // NAN-LEGACY: "-target-feature" "-nan2008" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mnan=2008 2>&1 | \ +// RUN: %clang -target mips-linux-gnu -march=mips32r6 -### -fintegrated-as -c %s -mnan=2008 2>&1 | \ // RUN: FileCheck -check-prefix=NAN-2008 %s // NAN-2008: -cc1as // NAN-2008: "-target-feature" "+nan2008" diff --git a/test/Driver/mno-global-merge.c b/test/Driver/mno-global-merge.c deleted file mode 100644 index a17848f..0000000 --- a/test/Driver/mno-global-merge.c +++ /dev/null @@ -1,20 +0,0 @@ -// RUN: %clang -target armv7-apple-darwin10 \ -// RUN: -mno-global-merge -### -fsyntax-only %s 2> %t -// RUN: FileCheck --check-prefix=CHECK-NGM < %t %s - -// RUN: %clang -target arm64-apple-ios7 \ -// RUN: -mno-global-merge -### -fsyntax-only %s 2> %t -// RUN: FileCheck --check-prefix=CHECK-NGM < %t %s - -// CHECK-NGM: "-mno-global-merge" - -// RUN: %clang -target armv7-apple-darwin10 \ -// RUN: -mglobal-merge -### -fsyntax-only %s 2> %t -// RUN: FileCheck --check-prefix=CHECK-GM < %t %s - -// RUN: %clang -target arm64-apple-ios7 \ -// RUN: -mglobal-merge -### -fsyntax-only %s 2> %t -// RUN: FileCheck --check-prefix=CHECK-GM < %t %s - -// CHECK-GM-NOT: "-mglobal-merge" - diff --git a/test/Driver/modules-cache-path.m b/test/Driver/modules-cache-path.m new file mode 100644 index 0000000..419d6d4 --- /dev/null +++ b/test/Driver/modules-cache-path.m @@ -0,0 +1,5 @@ +// RUN: env USERNAME=asdf LOGNAME=asdf %clang -fmodules -### %s 2>&1 | FileCheck %s -check-prefix=CHECK-SET +// CHECK-SET: -fmodules-cache-path={{.*}}org.llvm.clang.asdf{{[/\\]+}}ModuleCache + +// RUN: %clang -fmodules -### %s 2>&1 | FileCheck %s -check-prefix=CHECK-DEFAULT +// CHECK-DEFAULT: -fmodules-cache-path={{.*}}org.llvm.clang.{{[A-Za-z0-9_]*[/\\]+}}ModuleCache diff --git a/test/Driver/msc-version.c b/test/Driver/msc-version.c index 1a88419..18fe731 100644 --- a/test/Driver/msc-version.c +++ b/test/Driver/msc-version.c @@ -5,8 +5,8 @@ // RUN: %clang -target i686-windows -fms-compatibility -dM -E - </dev/null -o - | FileCheck %s -check-prefix CHECK-NO-MSC-VERSION // CHECK-NO-MSC-VERSION: _MSC_BUILD 1 -// CHECK-NO-MSC-VERSION: _MSC_FULL_VER 170000000 -// CHECK-NO-MSC-VERSION: _MSC_VER 1700 +// CHECK-NO-MSC-VERSION: _MSC_FULL_VER 180000000 +// CHECK-NO-MSC-VERSION: _MSC_VER 1800 // @@ -54,7 +54,7 @@ // RUN: %clang -### -target i686-windows -fms-compatibility -fmsc-version=17 -E - </dev/null -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-MSC-17 // CHECK-MSC-17-NOT: "-fmsc-version=1700" -// CHECK-MSC-17: "-fms-compatibility-version=17.0" +// CHECK-MSC-17: "-fms-compatibility-version=17" // RUN: %clang -### -target i686-windows -fms-compatibility -fmsc-version=1600 -E - </dev/null -o /dev/null 2>&1 | FileCheck %s -check-prefix CHECK-MSC-16 diff --git a/test/Driver/msvc-link.c b/test/Driver/msvc-link.c new file mode 100644 index 0000000..b44e382 --- /dev/null +++ b/test/Driver/msvc-link.c @@ -0,0 +1,12 @@ +// RUN: %clang -target i686-pc-windows-msvc -### %s 2>&1 | FileCheck --check-prefix=BASIC %s +// BASIC: link.exe" +// BASIC: "-out:a.exe" +// BASIC: "-defaultlib:libcmt" +// BASIC: "-nologo" + +// RUN: %clang -target i686-pc-windows-msvc -shared -o a.dll -### %s 2>&1 | FileCheck --check-prefix=DLL %s +// DLL: link.exe" +// DLL: "-out:a.dll" +// DLL: "-defaultlib:libcmt" +// DLL: "-nologo" +// DLL: "-dll" diff --git a/test/Driver/nacl-direct.c b/test/Driver/nacl-direct.c new file mode 100644 index 0000000..9768eab --- /dev/null +++ b/test/Driver/nacl-direct.c @@ -0,0 +1,111 @@ +// Test clang changes for NaCl Support including: +// include paths, library paths, emulation, default static +// +// RUN: %clang -no-canonical-prefixes -### -o %t.o %s \ +// RUN: -target i686-unknown-nacl -resource-dir foo 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-I686 %s +// CHECK-I686: {{.*}}clang{{.*}}" "-cc1" +// CHECK-I686: "-fuse-init-array" +// CHECK-I686: "-target-cpu" "pentium4" +// CHECK-I686: "-resource-dir" "foo" +// CHECK-I686: "-internal-isystem" "foo{{/|\\\\}}include" +// CHECK-I686: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}x86_64-nacl{{/|\\\\}}usr{{/|\\\\}}include" +// CHECK-I686: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}x86_64-nacl{{/|\\\\}}include" +// CHECK-I686: as{{(.exe)?}}" "--32" +// CHECK-I686: ld{{(.exe)?}}" +// CHECK-I686: "--build-id" +// CHECK-I686: "-m" "elf_i386_nacl" +// CHECK-I686: "-static" +// CHECK-I686: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}x86_64-nacl{{/|\\\\}}lib32" +// CHECK-I686: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}x86_64-nacl{{/|\\\\}}usr{{/|\\\\}}lib32" +// CHECK-I686: "-Lfoo{{/|\\\\}}lib{{/|\\\\}}i686-nacl" +// CHECK-I686-NOT: -lpthread +// +// RUN: %clang -no-canonical-prefixes -### -o %t.o %s \ +// RUN: -target x86_64-unknown-nacl -resource-dir foo 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-x86_64 %s +// CHECK-x86_64: {{.*}}clang{{.*}}" "-cc1" +// CHECK-x86_64: "-fuse-init-array" +// CHECK-x86_64: "-target-cpu" "x86-64" +// CHECK-x86_64: "-resource-dir" "foo" +// CHECK-x86_64: "-internal-isystem" "foo{{/|\\\\}}include" +// CHECK-x86_64: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}x86_64-nacl{{/|\\\\}}usr{{/|\\\\}}include" +// CHECK-x86_64: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}x86_64-nacl{{/|\\\\}}include" +// CHECK-x86_64: as{{(.exe)?}}" "--64" +// CHECK-x86_64: ld{{(.exe)?}}" +// CHECK-x86_64: "--build-id" +// CHECK-x86_64: "-m" "elf_x86_64_nacl" +// CHECK-x86_64: "-static" +// CHECK-x86_64: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}x86_64-nacl{{/|\\\\}}lib" +// CHECK-x86_64: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}x86_64-nacl{{/|\\\\}}usr{{/|\\\\}}lib" +// CHECK-x86_64: "-Lfoo{{/|\\\\}}lib{{/|\\\\}}x86_64-nacl" +// CHECK-X86_64-NOT: -lpthread +// +// RUN: %clang -no-canonical-prefixes -### -o %t.o %s \ +// RUN: -target armv7a-unknown-nacl-gnueabihf -resource-dir foo 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-ARM %s +// CHECK-ARM: {{.*}}clang{{.*}}" "-cc1" +// CHECK-ARM: "-fuse-init-array" +// CHECK-ARM: "-target-cpu" "cortex-a8" +// CHECK-ARM: "-target-abi" "aapcs-linux" +// CHECK-ARM: "-mfloat-abi" "hard" +// CHECK-ARM: "-resource-dir" "foo" +// CHECK-ARM: "-internal-isystem" "foo{{/|\\\\}}include" +// CHECK-ARM: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}arm-nacl{{/|\\\\}}usr{{/|\\\\}}include" +// CHECK-ARM: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}arm-nacl{{/|\\\\}}include" +// CHECK-ARM: as{{(.exe)?}}" +// CHECK-ARM: "-mfloat-abi=hard" +// CHECK-ARM: ld{{(.exe)?}}" +// CHECK-ARM: "--build-id" +// CHECK-ARM: "-m" "armelf_nacl" +// CHECK-ARM: "-static" +// CHECK-ARM: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}arm-nacl{{/|\\\\}}lib" +// CHECK-ARM: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}arm-nacl{{/|\\\\}}usr{{/|\\\\}}lib" +// CHECK-ARM: "-Lfoo{{/|\\\\}}lib{{/|\\\\}}arm-nacl" +// CHECK-ARM-NOT: -lpthread + +// Check that even when the target arch is just "arm" (as will be the case when +// it is inferred from the binary name) that we get the right ABI flags +// RUN: %clang -no-canonical-prefixes -### -o %t.o %s 2>&1 \ +// RUN: -target arm-nacl \ +// RUN: | FileCheck --check-prefix=CHECK-ARM-NOV7 %s +// CHECK-ARM-NOV7: "-triple" "armv7--nacl-gnueabihf" +// CHECK-ARM-NOV7: "-target-abi" "aapcs-linux" +// CHECK-ARM-NOV7: "-mfloat-abi" "hard" +// CHECK-ARM-NOV7: as{{(.exe)?}}" +// CHECK-ARM-NOV7: "-mfloat-abi=hard" + +// Test clang c++ include dirs and link line when using clang++ + +// RUN: %clangxx -no-canonical-prefixes -### -o %t.o %s \ +// RUN: -target armv7a-unknown-nacl-gnueabihf -resource-dir foo 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-ARM-CXX %s +// CHECK-ARM-CXX: {{.*}}clang{{.*}}" "-cc1" +// CHECK-ARM-CXX: "-resource-dir" "foo" +// CHECK-ARM-CXX: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}arm-nacl{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1" +// CHECK-ARM-CXX: "-internal-isystem" "foo{{/|\\\\}}include" +// CHECK-ARM-CXX: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}arm-nacl{{/|\\\\}}usr{{/|\\\\}}include" +// CHECK-ARM-CXX: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}arm-nacl{{/|\\\\}}include" +// CHECK-ARM-CXX: "-lpthread" + +// RUN: %clangxx -no-canonical-prefixes -### -o %t.o %s \ +// RUN: -target i686-unknown-nacl -resource-dir foo 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-I686-CXX %s +// CHECK-I686-CXX: {{.*}}clang{{.*}}" "-cc1" +// CHECK-I686-CXX: "-resource-dir" "foo" +// CHECK-I686-CXX: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}x86_64-nacl{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1" +// CHECK-I686-CXX: "-internal-isystem" "foo{{/|\\\\}}include" +// CHECK-I686-CXX: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}x86_64-nacl{{/|\\\\}}usr{{/|\\\\}}include" +// CHECK-I686-CXX: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}x86_64-nacl{{/|\\\\}}include" +// CHECK-I686-CXX: "-lpthread" + +// RUN: %clangxx -no-canonical-prefixes -### -o %t.o %s \ +// RUN: -target x86_64-unknown-nacl -resource-dir foo 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-x86_64-CXX %s +// CHECK-x86_64-CXX: {{.*}}clang{{.*}}" "-cc1" +// CHECK-x86_64-CXX: "-resource-dir" "foo" +// CHECK-x86_64-CXX: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}x86_64-nacl{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1" +// CHECK-x86_64-CXX: "-internal-isystem" "foo{{/|\\\\}}include" +// CHECK-x86_64-CXX: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}x86_64-nacl{{/|\\\\}}usr{{/|\\\\}}include" +// CHECK-x86_64-CXX: "-internal-isystem" "{{.*}}{{/|\\\\}}..{{/|\\\\}}x86_64-nacl{{/|\\\\}}include" +// CHECK-x86_64-CXX: "-lpthread" diff --git a/test/Driver/nostdincxx.cpp b/test/Driver/nostdincxx.cpp index 126828d..f2305ad 100644 --- a/test/Driver/nostdincxx.cpp +++ b/test/Driver/nostdincxx.cpp @@ -4,3 +4,4 @@ // MSVC has C++ headers in same directory as C headers. // REQUIRES: non-ms-sdk +// REQUIRES: non-ps4-sdk diff --git a/test/Driver/objc++-cpp-output.mm b/test/Driver/objc++-cpp-output.mm index a42f7b2..8b8eeb5 100644 --- a/test/Driver/objc++-cpp-output.mm +++ b/test/Driver/objc++-cpp-output.mm @@ -1,5 +1,5 @@ -// RUN: %clang -emit-llvm -x objc++-cpp-output -S %s -o /dev/null -// RUN: %clang -emit-llvm -x objc++-cpp-output -S %s -o /dev/null -### 2>&1 | FileCheck %s +// RUN: %clang -fexceptions -emit-llvm -x objc++-cpp-output -S %s -o /dev/null +// RUN: %clang -fexceptions -emit-llvm -x objc++-cpp-output -S %s -o /dev/null -### 2>&1 | FileCheck %s // PR13820 // REQUIRES: LP64 diff --git a/test/Driver/objc-sdk-migration-options.m b/test/Driver/objc-sdk-migration-options.m new file mode 100644 index 0000000..c3b295e8 --- /dev/null +++ b/test/Driver/objc-sdk-migration-options.m @@ -0,0 +1,9 @@ +// Check miscellaneous Objective-C sdk migration options. +// rdar://19994452 + +// RUN: %clang -objcmt-migrate-property-dot-syntax -target x86_64-apple-darwin10 -S -### %s \ +// RUN: -arch x86_64 2> %t +// RUN: FileCheck < %t %s + +// CHECK: "-cc1" +// CHECK: -objcmt-migrate-property-dot-syntax diff --git a/test/Driver/output-file-cleanup.c b/test/Driver/output-file-cleanup.c index 0aee5f8..065df8f 100644 --- a/test/Driver/output-file-cleanup.c +++ b/test/Driver/output-file-cleanup.c @@ -13,7 +13,6 @@ // RUN: test ! -f %t.s // RUN: test -f %t.d -// REQUIRES: shell // REQUIRES: crash-recovery #ifdef CRASH diff --git a/test/Driver/pch-deps.c b/test/Driver/pch-deps.c index 3048636..2c140e5 100644 --- a/test/Driver/pch-deps.c +++ b/test/Driver/pch-deps.c @@ -8,3 +8,14 @@ // RUN: FileCheck %s -check-prefix=CHECK-NOPCH -input-file=%t // CHECK-NOPCH: -dependency-file // CHECK-NOPCH-NOT: -module-file-deps + +// RUN: %clang -x c-header %s -o %t.pch -MMD -MT dependencies -MF %t.d \ +// RUN: -fno-module-file-deps -### 2> %t +// RUN: FileCheck %s -check-prefix=CHECK-EXPLICIT -input-file=%t +// CHECK-EXPLICIT: -dependency-file +// CHECK-EXPLICIT-NOT: -module-file-deps + +// RUN: %clang -x c++ %s -o %t.o -MMD -MT dependencies -MF %t.d -fmodule-file-deps -### 2> %t +// RUN: FileCheck %s -check-prefix=CHECK-EXPLICIT-NOPCH -input-file=%t +// CHECK-EXPLICIT-NOPCH: -dependency-file +// CHECK-EXPLICIT-NOPCH: -module-file-deps diff --git a/test/Driver/pic.c b/test/Driver/pic.c index a3d989c..3a14d61 100644 --- a/test/Driver/pic.c +++ b/test/Driver/pic.c @@ -11,6 +11,8 @@ // CHECK-PIC2: "-mrelocation-model" "pic" // CHECK-PIC2: "-pic-level" "2" // +// CHECK-NO-STATIC-NOT: "-static" +// // CHECK-PIE1: "-mrelocation-model" "pic" // CHECK-PIE1: "-pic-level" "1" // CHECK-PIE1: "-pie-level" "1" @@ -200,6 +202,8 @@ // RUN: | FileCheck %s --check-prefix=CHECK-PIC2 // RUN: %clang -c %s -target arm64-apple-ios -mkernel -miphoneos-version-min=7.0.0 -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-PIC2 +// RUN: %clang -x assembler -c %s -target arm64-apple-ios -mkernel -miphoneos-version-min=7.0.0 -no-integrated-as -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-NO-STATIC // RUN: %clang -c %s -target armv7-apple-ios -fapple-kext -miphoneos-version-min=5.0.0 -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-NO-PIC // RUN: %clang -c %s -target armv7-apple-ios -fapple-kext -miphoneos-version-min=6.0.0 -static -### 2>&1 \ diff --git a/test/Driver/ppc-abi.c b/test/Driver/ppc-abi.c index 6fee63a..3c7d7f1 100644 --- a/test/Driver/ppc-abi.c +++ b/test/Driver/ppc-abi.c @@ -5,6 +5,14 @@ // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \ // RUN: -mabi=elfv1 | FileCheck -check-prefix=CHECK-ELFv1 %s // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \ +// RUN: -mabi=elfv1-qpx | FileCheck -check-prefix=CHECK-ELFv1-QPX %s +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \ +// RUN: -mcpu=a2q | FileCheck -check-prefix=CHECK-ELFv1-QPX %s +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \ +// RUN: -mcpu=a2 -mqpx | FileCheck -check-prefix=CHECK-ELFv1-QPX %s +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \ +// RUN: -mcpu=a2q -mno-qpx | FileCheck -check-prefix=CHECK-ELFv1 %s +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o 2>&1 \ // RUN: -mabi=elfv2 | FileCheck -check-prefix=CHECK-ELFv2 %s // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 \ @@ -15,5 +23,6 @@ // RUN: -mabi=elfv2 | FileCheck -check-prefix=CHECK-ELFv2 %s // CHECK-ELFv1: "-target-abi" "elfv1" +// CHECK-ELFv1-QPX: "-target-abi" "elfv1-qpx" // CHECK-ELFv2: "-target-abi" "elfv2" diff --git a/test/Driver/ppc-features.cpp b/test/Driver/ppc-features.cpp index f7cc879..8ef8318 100644 --- a/test/Driver/ppc-features.cpp +++ b/test/Driver/ppc-features.cpp @@ -77,6 +77,12 @@ // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-mfcrf -mmfcrf -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-MFCRF %s // CHECK-MFCRF: "-target-feature" "+mfocrf" +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-isel -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOISEL %s +// CHECK-NOISEL: "-target-feature" "-isel" + +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-isel -misel -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-ISEL %s +// CHECK-ISEL: "-target-feature" "+isel" + // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-popcntd -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOPOPCNTD %s // CHECK-NOPOPCNTD: "-target-feature" "-popcntd" @@ -113,6 +119,12 @@ // RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-crbits -mcrbits -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-CRBITS %s // CHECK-CRBITS: "-target-feature" "+crbits" +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-invariant-function-descriptors -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOINVFUNCDESC %s +// CHECK-NOINVFUNCDESC: "-target-feature" "-invariant-function-descriptors" + +// RUN: %clang -target powerpc64-unknown-linux-gnu %s -mno-invariant-function-descriptors -minvariant-function-descriptors -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-INVFUNCDESC %s +// CHECK-INVFUNCDESC: "-target-feature" "+invariant-function-descriptors" + // Assembler features // RUN: %clang -target powerpc64-unknown-linux-gnu %s -### -o %t.o -no-integrated-as 2>&1 | FileCheck -check-prefix=CHECK_BE_AS_ARGS %s // CHECK_BE_AS_ARGS: "-mppc64" diff --git a/test/Driver/preserve-uselistorder.c b/test/Driver/preserve-uselistorder.c new file mode 100644 index 0000000..aee75a6 --- /dev/null +++ b/test/Driver/preserve-uselistorder.c @@ -0,0 +1,9 @@ +// RUN: %clang -target x86_64-apple-darwin -emit-llvm -arch x86_64 %s -### 2>&1 \ +// RUN: | FileCheck %s +// CHECK: "-emit-llvm-bc" +// CHECK: "-emit-llvm-uselists" + +// RUN: %clang -target x86_64-apple-darwin -flto -arch x86_64 %s -### 2>&1 \ +// RUN: | FileCheck -check-prefix=LTO %s +// LTO: "-emit-llvm-bc" +// LTO-NOT: "-emit-llvm-uselists" diff --git a/test/Driver/ps4-cpu-defaults.cpp b/test/Driver/ps4-cpu-defaults.cpp new file mode 100644 index 0000000..99547d4 --- /dev/null +++ b/test/Driver/ps4-cpu-defaults.cpp @@ -0,0 +1,6 @@ +// Check that on the PS4 we default to: +// -target-cpu btver2 and no exceptions + +// RUN: %clang -target x86_64-scei-ps4 -c %s -### 2>&1 | FileCheck %s +// CHECK: "-target-cpu" "btver2" +// CHECK-NOT: exceptions diff --git a/test/Driver/rewrite-map-in-diagnostics.c b/test/Driver/rewrite-map-in-diagnostics.c index 984e0d6..4aea0ec 100644 --- a/test/Driver/rewrite-map-in-diagnostics.c +++ b/test/Driver/rewrite-map-in-diagnostics.c @@ -8,5 +8,7 @@ // CHECK: note: diagnostic msg: {{.*}}rewrite.map +// REQUIRES: crash-recovery + // FIXME: This doesn't fail on "env clang". Investigating. // REQUIRES: shell diff --git a/test/Driver/rtti-options.cpp b/test/Driver/rtti-options.cpp new file mode 100644 index 0000000..46072ca --- /dev/null +++ b/test/Driver/rtti-options.cpp @@ -0,0 +1,62 @@ +// Check that we emit warnings/errors for different combinations of +// exceptions, rtti, and vptr sanitizer flags when targetting the PS4. +// No warnings/errors should be emitted for unknown, except if combining +// the vptr sanitizer with -fno-rtti + +// Special cases: -fcxx-exceptions in C code should warn about unused arguments +// We should also not have any rtti-related arguments +// RUN: %clang -x c -### -target x86_64-scei-ps4 -c -fcxx-exceptions %s 2>&1 | FileCheck -check-prefix=CHECK-UNUSED -check-prefix=CHECK-RTTI -check-prefix=CHECK-NO-RTTI %s +// RUN: %clang -x c -### -target x86_64-unknown-unknown -c -fcxx-exceptions %s 2>&1 | FileCheck -check-prefix=CHECK-UNUSED -check-prefix=CHECK-RTTI -check-prefix=CHECK-NO-RTTI %s + +// Make sure we keep the last -frtti/-fno-rtti argument +// RUN: %clang -### -c -fno-rtti -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-RTTI %s +// RUN: %clang -### -c -frtti -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-NO-RTTI %s + +// -fsanitize=vptr +// Make sure we only error/warn once, when trying to enable vptr and +// undefined and have -fno-rtti +// RUN: %clang -### -c -fsanitize=undefined -fsanitize=vptr -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-ERROR -check-prefix=CHECK-OK %s + +// RUN: %clang -### -c -target x86_64-scei-ps4 -fsanitize=vptr %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-WARN %s +// RUN: %clang -### -c -target x86_64-scei-ps4 -fsanitize=vptr -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s +// RUN: %clang -### -c -target x86_64-scei-ps4 -fsanitize=vptr -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-ERROR %s +// RUN: %clang -### -c -target x86_64-scei-ps4 -fsanitize=undefined -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s +// RUN: %clang -### -c -target x86_64-unknown-unknown -fsanitize=vptr %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s +// RUN: %clang -### -c -target x86_64-unknown-unknown -fsanitize=vptr -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s +// RUN: %clang -### -c -target x86_64-unknown-unknown -fsanitize=vptr -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-SAN-ERROR %s +// RUN: %clang -### -c -target x86_64-unknown-unknown -fsanitize=undefined %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s +// RUN: %clang -### -c -target x86_64-unknown-unknown -fsanitize=undefined -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s + +// Exceptions + no/default rtti +// RUN: %clang -### -c -target x86_64-scei-ps4 -fcxx-exceptions -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-EXC-ERROR-CXX %s +// RUN: %clang -### -c -target x86_64-scei-ps4 -fcxx-exceptions %s 2>&1 | FileCheck -check-prefix=CHECK-EXC-WARN %s +// RUN: %clang -### -c -target x86_64-unknown-unknown -fcxx-exceptions -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s +// RUN: %clang -### -c -target x86_64-unknown-unknown -fcxx-exceptions %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s +// In C++, -fexceptions implies -fcxx-exceptions +// RUN: %clang -x c++ -### -c -target x86_64-scei-ps4 -fexceptions -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-EXC-ERROR %s +// RUN: %clang -x c++ -### -c -target x86_64-scei-ps4 -fexceptions %s 2>&1 | FileCheck -check-prefix=CHECK-EXC-WARN %s +// RUN: %clang -x c++ -### -c -target x86_64-unknown-unknown -fexceptions -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s +// RUN: %clang -x c++ -### -c -target x86_64-unknown-unknown -fexceptions %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s + +// -frtti + exceptions +// RUN: %clang -### -c -target x86_64-scei-ps4 -fcxx-exceptions -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s +// RUN: %clang -### -c -target x86_64-unknown-unknown -fcxx-exceptions -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-OK %s + +// -f{no-,}rtti/default +// RUN: %clang -### -c -target x86_64-scei-ps4 -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-RTTI %s +// RUN: %clang -### -c -target x86_64-scei-ps4 -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-NO-RTTI %s +// RUN: %clang -### -c -target x86_64-scei-ps4 %s 2>&1 | FileCheck -check-prefix=CHECK-NO-RTTI %s +// RUN: %clang -### -c -target x86_64-unknown-unknown -frtti %s 2>&1 | FileCheck -check-prefix=CHECK-RTTI %s +// RUN: %clang -### -c -target x86_64-unknown-unknown -fno-rtti %s 2>&1 | FileCheck -check-prefix=CHECK-NO-RTTI %s +// RUN: %clang -### -c -target x86_64-unknown-unknown %s 2>&1 | FileCheck -check-prefix=CHECK-RTTI %s + +// CHECK-UNUSED: warning: argument unused during compilation: '-fcxx-exceptions' +// CHECK-SAN-WARN: implicitly disabling vptr sanitizer because rtti wasn't enabled +// CHECK-SAN-ERROR: invalid argument '-fsanitize=vptr' not allowed with '-fno-rtti' +// CHECK-EXC-WARN: implicitly enabling rtti for exception handling +// CHECK-EXC-ERROR: invalid argument '-fno-rtti' not allowed with '-fexceptions' +// CHECK-EXC-ERROR-CXX: invalid argument '-fno-rtti' not allowed with '-fcxx-exceptions' +// CHECK-RTTI-NOT: "-fno-rtti" +// CHECK-NO-RTTI-NOT: "-frtti" + +// CHECK-OK-NOT: {{warning:|error:}} diff --git a/test/Driver/sanitizer-ld.c b/test/Driver/sanitizer-ld.c index dc8e93e..5fef817 100644 --- a/test/Driver/sanitizer-ld.c +++ b/test/Driver/sanitizer-ld.c @@ -160,8 +160,9 @@ // CHECK-TSAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-TSAN-LINUX-CXX-NOT: stdc++ // CHECK-TSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.tsan-x86_64.a" "-no-whole-archive" -// CHECK-TSAN-LINUX-CXX-NOT: "-export-dynamic" // CHECK-TSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.tsan-x86_64.a.syms" +// CHECK-TSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.tsan_cxx-x86_64.a" "-no-whole-archive" +// CHECK-TSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.tsan_cxx-x86_64.a.syms" // CHECK-TSAN-LINUX-CXX-NOT: "-export-dynamic" // CHECK-TSAN-LINUX-CXX: stdc++ // CHECK-TSAN-LINUX-CXX: "-lpthread" @@ -177,8 +178,9 @@ // CHECK-MSAN-LINUX-CXX: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}" // CHECK-MSAN-LINUX-CXX-NOT: stdc++ // CHECK-MSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.msan-x86_64.a" "-no-whole-archive" -// CHECK-MSAN-LINUX-CXX-NOT: "-export-dynamic" // CHECK-MSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.msan-x86_64.a.syms" +// CHECK-MSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.msan_cxx-x86_64.a" "-no-whole-archive" +// CHECK-MSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.msan_cxx-x86_64.a.syms" // CHECK-MSAN-LINUX-CXX-NOT: "-export-dynamic" // CHECK-MSAN-LINUX-CXX: stdc++ // CHECK-MSAN-LINUX-CXX: "-lpthread" @@ -191,13 +193,10 @@ // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX %s // CHECK-UBSAN-LINUX: "{{.*}}ld{{(.exe)?}}" // CHECK-UBSAN-LINUX-NOT: libclang_rt.asan -// CHECK-UBSAN-LINUX-NOT: libclang_rt.ubsan_cxx -// CHECK-UBSAN-LINUX: "-whole-archive" "{{.*}}libclang_rt.san-i386.a" "-no-whole-archive" -// CHECK-UBSAN-LINUX-NOT: libclang_rt.asan -// CHECK-UBSAN-LINUX-NOT: libclang_rt.ubsan_cxx -// CHECK-UBSAN-LINUX: "-whole-archive" "{{.*}}libclang_rt.ubsan-i386.a" "-no-whole-archive" +// CHECK-UBSAN-LINUX-NOT: libclang_rt.ubsan_standalone_cxx +// CHECK-UBSAN-LINUX: "-whole-archive" "{{.*}}libclang_rt.ubsan_standalone-i386.a" "-no-whole-archive" // CHECK-UBSAN-LINUX-NOT: libclang_rt.asan -// CHECK-UBSAN-LINUX-NOT: libclang_rt.ubsan_cxx +// CHECK-UBSAN-LINUX-NOT: libclang_rt.ubsan_standalone_cxx // CHECK-UBSAN-LINUX-NOT: "-lstdc++" // CHECK-UBSAN-LINUX: "-lpthread" @@ -206,7 +205,7 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-LINK-CXX %s // CHECK-UBSAN-LINUX-LINK-CXX-NOT: "-lstdc++" -// CHECK-UBSAN-LINUX-LINK-CXX: "-whole-archive" "{{.*}}libclang_rt.ubsan_cxx-i386.a" "-no-whole-archive" +// CHECK-UBSAN-LINUX-LINK-CXX: "-whole-archive" "{{.*}}libclang_rt.ubsan_standalone_cxx-i386.a" "-no-whole-archive" // CHECK-UBSAN-LINUX-LINK-CXX-NOT: "-lstdc++" // RUN: %clangxx -fsanitize=undefined %s -### -o %t.o 2>&1 \ @@ -216,15 +215,9 @@ // RUN: | FileCheck --check-prefix=CHECK-UBSAN-LINUX-CXX %s // CHECK-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}" // CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan -// CHECK-UBSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.san-i386.a" "-no-whole-archive" -// CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan -// CHECK-UBSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.ubsan-i386.a" "-no-whole-archive" -// CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan -// CHECK-UBSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.ubsan-i386.a.syms" +// CHECK-UBSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.ubsan_standalone-i386.a" "-no-whole-archive" // CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan -// CHECK-UBSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.ubsan_cxx-i386.a" "-no-whole-archive" -// CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan -// CHECK-UBSAN-LINUX-CXX: "--dynamic-list={{.*}}libclang_rt.ubsan_cxx-i386.a.syms" +// CHECK-UBSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.ubsan_standalone_cxx-i386.a" "-no-whole-archive" // CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan // CHECK-UBSAN-LINUX-CXX: "-lstdc++" // CHECK-UBSAN-LINUX-CXX-NOT: libclang_rt.asan @@ -235,11 +228,8 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | FileCheck --check-prefix=CHECK-ASAN-UBSAN-LINUX %s // CHECK-ASAN-UBSAN-LINUX: "{{.*}}ld{{(.exe)?}}" -// CHECK-ASAN-UBSAN-LINUX-NOT: libclang_rt.san // CHECK-ASAN-UBSAN-LINUX: "-whole-archive" "{{.*}}libclang_rt.asan-i386.a" "-no-whole-archive" -// CHECK-ASAN-UBSAN-LINUX-NOT: libclang_rt.san -// CHECK-ASAN-UBSAN-LINUX: "-whole-archive" "{{.*}}libclang_rt.ubsan-i386.a" "-no-whole-archive" -// CHECK-ASAN-UBSAN-LINUX-NOT: libclang_rt.ubsan_cxx +// CHECK-ASAN-UBSAN-LINUX-NOT: libclang_rt.ubsan // CHECK-ASAN-UBSAN-LINUX-NOT: "-lstdc++" // CHECK-ASAN-UBSAN-LINUX: "-lpthread" @@ -248,14 +238,28 @@ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ // RUN: | FileCheck --check-prefix=CHECK-ASAN-UBSAN-LINUX-CXX %s // CHECK-ASAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}" -// CHECK-ASAN-UBSAN-LINUX-CXX-NOT: libclang_rt.san // CHECK-ASAN-UBSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.asan-i386.a" "-no-whole-archive" -// CHECK-ASAN-UBSAN-LINUX-CXX-NOT: libclang_rt.san -// CHECK-ASAN-UBSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.ubsan-i386.a" "-no-whole-archive" -// CHECK-ASAN-UBSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.ubsan_cxx-i386.a" "-no-whole-archive" +// CHECK-ASAN-UBSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.asan_cxx-i386.a" "-no-whole-archive" +// CHECK-ASAN-UBSAN-LINUX-CXX-NOT: libclang_rt.ubsan // CHECK-ASAN-UBSAN-LINUX-CXX: "-lstdc++" // CHECK-ASAN-UBSAN-LINUX-CXX: "-lpthread" +// RUN: %clangxx -fsanitize=memory,undefined %s -### -o %t.o 2>&1 \ +// RUN: -target x86_64-unknown-linux \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-MSAN-UBSAN-LINUX-CXX %s +// CHECK-MSAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}" +// CHECK-MSAN-UBSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.msan-x86_64.a" "-no-whole-archive" +// CHECK-MSAN-UBSAN-LINUX-CXX-NOT: libclang_rt.ubsan + +// RUN: %clangxx -fsanitize=thread,undefined %s -### -o %t.o 2>&1 \ +// RUN: -target x86_64-unknown-linux \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-TSAN-UBSAN-LINUX-CXX %s +// CHECK-TSAN-UBSAN-LINUX-CXX: "{{.*}}ld{{(.exe)?}}" +// CHECK-TSAN-UBSAN-LINUX-CXX: "-whole-archive" "{{.*}}libclang_rt.tsan-x86_64.a" "-no-whole-archive" +// CHECK-TSAN-UBSAN-LINUX-CXX-NOT: libclang_rt.ubsan + // RUN: %clang -fsanitize=undefined %s -### -o %t.o 2>&1 \ // RUN: -target i386-unknown-linux \ // RUN: -resource-dir=%S/Inputs/resource_dir \ @@ -265,9 +269,7 @@ // CHECK-UBSAN-LINUX-SHARED: "{{.*}}ld{{(.exe)?}}" // CHECK-UBSAN-LINUX-SHARED-NOT: --export-dynamic // CHECK-UBSAN-LINUX-SHARED-NOT: --dynamic-list -// CHECK-UBSAN-LINUX-SHARED-NOT: libclang_rt.ubsan-i386.a" -// CHECK-UBSAN-LINUX-SHARED-NOT: --export-dynamic -// CHECK-UBSAN-LINUX-SHARED-NOT: --dynamic-list +// CHECK-UBSAN-LINUX-SHARED-NOT: libclang_rt.ubsan // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: -target x86_64-unknown-linux -fsanitize=leak \ @@ -280,19 +282,6 @@ // CHECK-LSAN-LINUX: "-lpthread" // CHECK-LSAN-LINUX: "-ldl" -// RUN: %clang -fsanitize=leak,undefined %s -### -o %t.o 2>&1 \ -// RUN: -target x86_64-unknown-linux \ -// RUN: --sysroot=%S/Inputs/basic_linux_tree \ -// RUN: | FileCheck --check-prefix=CHECK-LSAN-UBSAN-LINUX %s -// CHECK-LSAN-UBSAN-LINUX: "{{.*}}ld{{(.exe)?}}" -// CHECK-LSAN-UBSAN-LINUX-NOT: libclang_rt.san -// CHECK-LSAN-UBSAN-LINUX: "-whole-archive" "{{.*}}libclang_rt.lsan-x86_64.a" "-no-whole-archive" -// CHECK-LSAN-UBSAN-LINUX-NOT: libclang_rt.san -// CHECK-LSAN-UBSAN-LINUX: "-whole-archive" "{{.*}}libclang_rt.ubsan-x86_64.a" "-no-whole-archive" -// CHECK-LSAN-UBSAN-LINUX-NOT: libclang_rt.ubsan_cxx -// CHECK-LSAN-UBSAN-LINUX-NOT: "-lstdc++" -// CHECK-LSAN-UBSAN-LINUX: "-lpthread" - // RUN: %clang -fsanitize=leak,address %s -### -o %t.o 2>&1 \ // RUN: -target x86_64-unknown-linux \ // RUN: --sysroot=%S/Inputs/basic_linux_tree \ @@ -301,3 +290,12 @@ // CHECK-LSAN-ASAN-LINUX-NOT: libclang_rt.lsan // CHECK-LSAN-ASAN-LINUX: libclang_rt.asan-x86_64 // CHECK-LSAN-ASAN-LINUX-NOT: libclang_rt.lsan + +// RUN: %clangxx -fsanitize=address %s -### -o %t.o 2>&1 \ +// RUN: -mmacosx-version-min=10.6 \ +// RUN: -target x86_64-apple-darwin13.4.0 \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-ASAN-DARWIN106-CXX %s +// CHECK-ASAN-DARWIN106-CXX: "{{.*}}ld{{(.exe)?}}" +// CHECK-ASAN-DARWIN106-CXX: libclang_rt.asan_osx_dynamic.dylib +// CHECK-ASAN-DARWIN106-CXX-NOT: -lc++abi diff --git a/test/Driver/save-temps.c b/test/Driver/save-temps.c index a157aea..277a901 100644 --- a/test/Driver/save-temps.c +++ b/test/Driver/save-temps.c @@ -1,11 +1,24 @@ // RUN: %clang -target x86_64-apple-darwin -save-temps -arch x86_64 %s -### 2>&1 \ // RUN: | FileCheck %s // CHECK: "-o" "save-temps.i" +// CHECK: "-emit-llvm-uselists" // CHECK: "-disable-llvm-optzns" // CHECK: "-o" "save-temps.bc" // CHECK: "-o" "save-temps.s" // CHECK: "-o" "save-temps.o" -// CHECK: "-o" "a.out" +// CHECK: "-o" "a.out" + +// Check -save-temps=cwd which should work the same as -save-temps above +// +// RUN: %clang -target x86_64-apple-darwin -save-temps=cwd -arch x86_64 %s -### 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CWD +// CWD: "-o" "save-temps.i" +// CWD: "-emit-llvm-uselists" +// CWD: "-disable-llvm-optzns" +// CWD: "-o" "save-temps.bc" +// CWD: "-o" "save-temps.s" +// CWD: "-o" "save-temps.o" +// CWD: "-o" "a.out" // Check for a single clang cc1 invocation when NOT using -save-temps. // RUN: %clang -target x86_64-apple-darwin -arch x86_64 -S %s -### 2>&1 \ @@ -20,11 +33,47 @@ // MULT-ARCH: "-o" "save-temps-i386.bc" // MULT-ARCH: "-o" "save-temps-i386.s" // MULT-ARCH: "-o" "save-temps-i386.o" -// MULT-ARCH: "-o" "a.out-i386" +// MULT-ARCH: "-o" "a.out-i386" // MULT-ARCH: "-o" "save-temps-x86_64.i" // MULT-ARCH: "-o" "save-temps-x86_64.bc" // MULT-ARCH: "-o" "save-temps-x86_64.s" // MULT-ARCH: "-o" "save-temps-x86_64.o" -// MULT-ARCH: "-o" "a.out-x86_64" +// MULT-ARCH: "-o" "a.out-x86_64" // MULT-ARCH: lipo // MULT-ARCH: "-create" "-output" "a.out" "a.out-i386" "a.out-x86_64" + +// RUN: %clang -target x86_64-apple-darwin -save-temps=cwd -arch i386 -arch x86_64 %s -### 2>&1 \ +// RUN: | FileCheck %s -check-prefix=MULT-ARCH-CWD +// MULT-ARCH-CWD: "-o" "save-temps-i386.i" +// MULT-ARCH-CWD: "-o" "save-temps-i386.bc" +// MULT-ARCH-CWD: "-o" "save-temps-i386.s" +// MULT-ARCH-CWD: "-o" "save-temps-i386.o" +// MULT-ARCH-CWD: "-o" "a.out-i386" +// MULT-ARCH-CWD: "-o" "save-temps-x86_64.i" +// MULT-ARCH-CWD: "-o" "save-temps-x86_64.bc" +// MULT-ARCH-CWD: "-o" "save-temps-x86_64.s" +// MULT-ARCH-CWD: "-o" "save-temps-x86_64.o" +// MULT-ARCH-CWD: "-o" "a.out-x86_64" +// MULT-ARCH-CWD: lipo +// MULT-ARCH-CWD: "-create" "-output" "a.out" "a.out-i386" "a.out-x86_64" + +// Check that temp files are saved in the same directory as the output file +// regardless of whether -o is specified. +// +// RUN: %clang -target x86_64-apple-darwin -save-temps=obj -o obj/dir/a.out -arch x86_64 %s -### 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-OBJ +// CHECK-OBJ: "-o" "obj/dir{{/|\\\\}}save-temps.i" +// CHECK-OBJ: "-disable-llvm-optzns" +// CHECK-OBJ: "-o" "obj/dir{{/|\\\\}}save-temps.bc" +// CHECK-OBJ: "-o" "obj/dir{{/|\\\\}}save-temps.s" +// CHECK-OBJ: "-o" "obj/dir{{/|\\\\}}save-temps.o" +// CHECK-OBJ: "-o" "obj/dir{{/|\\\\}}a.out" +// +// RUN: %clang -target x86_64-apple-darwin -save-temps=obj -arch x86_64 %s -### 2>&1 \ +// RUN: | FileCheck %s -check-prefix=CHECK-OBJ-NOO +// CHECK-OBJ-NOO: "-o" "save-temps.i" +// CHECK-OBJ-NOO: "-disable-llvm-optzns" +// CHECK-OBJ-NOO: "-o" "save-temps.bc" +// CHECK-OBJ-NOO: "-o" "save-temps.s" +// CHECK-OBJ-NOO: "-o" "save-temps.o" +// CHECK-OBJ-NOO: "-o" "a.out" diff --git a/test/Driver/systemz-features.cpp b/test/Driver/systemz-features.cpp new file mode 100644 index 0000000..be1818a --- /dev/null +++ b/test/Driver/systemz-features.cpp @@ -0,0 +1,26 @@ + +// RUN: %clang -target s390x-unknown-linux-gnu %s -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-DEFAULT %s +// CHECK-DEFAULT-NOT: "-target-feature" "+transactional-execution" +// CHECK-DEFAULT-NOT: "-target-feature" "-transactional-execution" +// CHECK-DEFAULT-NOT: "-target-feature" "+vector" +// CHECK-DEFAULT-NOT: "-target-feature" "-vector" + +// RUN: %clang -target s390x-unknown-linux-gnu %s -mhtm -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-HTM %s +// RUN: %clang -target s390x-unknown-linux-gnu %s -mno-htm -mhtm -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-HTM %s +// CHECK-HTM: "-target-feature" "+transactional-execution" +// CHECK-HTM-NOT: "-target-feature" "-transactional-execution" + +// RUN: %clang -target s390x-unknown-linux-gnu %s -mno-htm -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOHTM %s +// RUN: %clang -target s390x-unknown-linux-gnu %s -mhtm -mno-htm -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOHTM %s +// CHECK-NOHTM: "-target-feature" "-transactional-execution" +// CHECK-NOHTM-NOT: "-target-feature" "+transactional-execution" + +// RUN: %clang -target s390x-unknown-linux-gnu %s -mvx -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-VX %s +// RUN: %clang -target s390x-unknown-linux-gnu %s -mno-vx -mvx -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-VX %s +// CHECK-VX: "-target-feature" "+vector" +// CHECK-VX-NOT: "-target-feature" "-vector" +// +// RUN: %clang -target s390x-unknown-linux-gnu %s -mno-vx -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOVX %s +// RUN: %clang -target s390x-unknown-linux-gnu %s -mvx -mno-vx -### -o %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOVX %s +// CHECK-NOVX: "-target-feature" "-vector" +// CHECK-NOVX-NOT: "-target-feature" "+vector" diff --git a/test/Driver/target-abi-cc1as.s b/test/Driver/target-abi-cc1as.s new file mode 100644 index 0000000..34cdeed --- /dev/null +++ b/test/Driver/target-abi-cc1as.s @@ -0,0 +1,6 @@ +// Check if -cc1as knows about the 'target-abi' argument. +// REQUIRES: mips-registered-target + +// RUN: %clang -cc1as -triple mips--linux-gnu -filetype obj -target-cpu mips32 -target-abi o32 %s 2>&1 | \ +// RUN: FileCheck %s +// CHECK-NOT: clang -cc1as: error: unknown argument: '-target-abi' diff --git a/test/Driver/warning-options_pedantic.cpp b/test/Driver/warning-options_pedantic.cpp index e40f771..4dbf92d 100644 --- a/test/Driver/warning-options_pedantic.cpp +++ b/test/Driver/warning-options_pedantic.cpp @@ -1,7 +1,13 @@ -// RUN: %clang -### -pedantic -no-pedantic %s 2>&1 | FileCheck -check-prefix=NO_PEDANTIC %s -// RUN: %clang -### -pedantic -Wno-pedantic %s 2>&1 | FileCheck -check-prefix=PEDANTIC %s +// Make sure we don't match the -NOT lines with the linker invocation. +// Delimiters match the start of the cc1 and the start of the linker lines +// DELIMITERS: {{^ *"}} + +// RUN: %clang -### -pedantic -no-pedantic %s 2>&1 | FileCheck -check-prefix=NO_PEDANTIC -check-prefix=DELIMITERS %s +// RUN: %clang -### -pedantic -Wno-pedantic %s 2>&1 | FileCheck -check-prefix=PEDANTIC -check-prefix=DELIMITERS %s // NO_PEDANTIC-NOT: -pedantic -// RUN: %clang -### -pedantic -pedantic -no-pedantic -pedantic %s 2>&1 | FileCheck -check-prefix=PEDANTIC %s -// RUN: %clang -### -pedantic -pedantic -no-pedantic -Wpedantic %s 2>&1 | FileCheck -check-prefix=NO_PEDANTIC %s +// RUN: %clang -### -pedantic -pedantic -no-pedantic -pedantic %s 2>&1 | FileCheck -check-prefix=PEDANTIC -check-prefix=DELIMITERS %s +// RUN: %clang -### -pedantic -pedantic -no-pedantic -Wpedantic %s 2>&1 | FileCheck -check-prefix=NO_PEDANTIC -check-prefix=DELIMITERS %s // PEDANTIC: -pedantic // REQUIRES: clang-driver + +// DELIMITERS: {{^ *"}} diff --git a/test/Driver/x86_features.c b/test/Driver/x86_features.c index 26f0bd8..e5ca704 100644 --- a/test/Driver/x86_features.c +++ b/test/Driver/x86_features.c @@ -1,5 +1,5 @@ // RUN: %clang -target i386-unknown-unknown -### -S %s -msse -msse4 -mno-sse -mno-mmx -msse 2>&1 | FileCheck %s -// CHECK: "pentium4" "-target-feature" "+sse4" "-target-feature" "-mmx" "-target-feature" "+sse" +// CHECK: "pentium4" "-target-feature" "+sse4.2" "-target-feature" "-mmx" "-target-feature" "+sse" // Note that we filter out all but the last -m(no)sse. // Test that we don't produce an error with -mieee-fp. diff --git a/test/Driver/xcore-opts.c b/test/Driver/xcore-opts.c index 161756d..9300085 100644 --- a/test/Driver/xcore-opts.c +++ b/test/Driver/xcore-opts.c @@ -12,10 +12,10 @@ // CHECK-NOT: "-fexceptions" // CHECK: "-fno-common" // CHECK: xcc" "-o" -// CHECK-EXCEP-NOT: "-fexceptions" +// CHECK-NOT: "-fexceptions" // CHECK: "-c" "-v" "-g" "-fverbose-asm" "A1Arg" "A2Arg" // CHECK: xcc" "-o" -// CHECK-EXCEP-NOT: "-fexceptions" +// CHECK-NOT: "-fexceptions" // CHECK: "-v" // CHECK: "L1Arg" "L2Arg" |