diff options
Diffstat (limited to 'test/Driver')
76 files changed, 569 insertions, 57 deletions
diff --git a/test/Driver/Inputs/basic_android_tree/usr/lib/crtbegin_dynamic.o b/test/Driver/Inputs/basic_android_tree/usr/lib/crtbegin_dynamic.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/basic_android_tree/usr/lib/crtbegin_dynamic.o diff --git a/test/Driver/Inputs/basic_android_tree/usr/lib/crtbegin_so.o b/test/Driver/Inputs/basic_android_tree/usr/lib/crtbegin_so.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/basic_android_tree/usr/lib/crtbegin_so.o diff --git a/test/Driver/Inputs/basic_android_tree/usr/lib/crtbegin_static.o b/test/Driver/Inputs/basic_android_tree/usr/lib/crtbegin_static.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/basic_android_tree/usr/lib/crtbegin_static.o diff --git a/test/Driver/Inputs/basic_android_tree/usr/lib/crtend_android.o b/test/Driver/Inputs/basic_android_tree/usr/lib/crtend_android.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/basic_android_tree/usr/lib/crtend_android.o diff --git a/test/Driver/Inputs/basic_android_tree/usr/lib/crtend_so.o b/test/Driver/Inputs/basic_android_tree/usr/lib/crtend_so.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/basic_android_tree/usr/lib/crtend_so.o diff --git a/test/Driver/Inputs/debian_multiarch_tree/lib/mips-linux-gnu/.keep b/test/Driver/Inputs/debian_multiarch_tree/lib/mips-linux-gnu/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/debian_multiarch_tree/lib/mips-linux-gnu/.keep diff --git a/test/Driver/Inputs/debian_multiarch_tree/lib/mipsel-linux-gnu/.keep b/test/Driver/Inputs/debian_multiarch_tree/lib/mipsel-linux-gnu/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/debian_multiarch_tree/lib/mipsel-linux-gnu/.keep diff --git a/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/mips-linux-gnu/.keep b/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/mips-linux-gnu/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/mips-linux-gnu/.keep diff --git a/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/mipsel-linux-gnu/.keep b/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/mipsel-linux-gnu/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/debian_multiarch_tree/usr/include/c++/4.5/mipsel-linux-gnu/.keep diff --git a/test/Driver/Inputs/debian_multiarch_tree/usr/include/mips-linux-gnu/.keep b/test/Driver/Inputs/debian_multiarch_tree/usr/include/mips-linux-gnu/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/debian_multiarch_tree/usr/include/mips-linux-gnu/.keep diff --git a/test/Driver/Inputs/debian_multiarch_tree/usr/include/mipsel-linux-gnu/.keep b/test/Driver/Inputs/debian_multiarch_tree/usr/include/mipsel-linux-gnu/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/debian_multiarch_tree/usr/include/mipsel-linux-gnu/.keep diff --git a/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mips-linux-gnu/4.5/64/crtbegin.o b/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mips-linux-gnu/4.5/64/crtbegin.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mips-linux-gnu/4.5/64/crtbegin.o diff --git a/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mips-linux-gnu/4.5/crtbegin.o b/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mips-linux-gnu/4.5/crtbegin.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mips-linux-gnu/4.5/crtbegin.o diff --git a/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mips-linux-gnu/4.5/n32/crtbegin.o b/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mips-linux-gnu/4.5/n32/crtbegin.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mips-linux-gnu/4.5/n32/crtbegin.o diff --git a/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mipsel-linux-gnu/4.5/64/crtbegin.o b/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mipsel-linux-gnu/4.5/64/crtbegin.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mipsel-linux-gnu/4.5/64/crtbegin.o diff --git a/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mipsel-linux-gnu/4.5/crtbegin.o b/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mipsel-linux-gnu/4.5/crtbegin.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mipsel-linux-gnu/4.5/crtbegin.o diff --git a/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mipsel-linux-gnu/4.5/n32/crtbegin.o b/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mipsel-linux-gnu/4.5/n32/crtbegin.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/mipsel-linux-gnu/4.5/n32/crtbegin.o diff --git a/test/Driver/Inputs/debian_multiarch_tree/usr/lib/mips-linux-gnu/.keep b/test/Driver/Inputs/debian_multiarch_tree/usr/lib/mips-linux-gnu/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/debian_multiarch_tree/usr/lib/mips-linux-gnu/.keep diff --git a/test/Driver/Inputs/debian_multiarch_tree/usr/lib/mipsel-linux-gnu/.keep b/test/Driver/Inputs/debian_multiarch_tree/usr/lib/mipsel-linux-gnu/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/debian_multiarch_tree/usr/lib/mipsel-linux-gnu/.keep diff --git a/test/Driver/Inputs/montavista_i686_tree/usr/lib/gcc/i686-montavista-linux/4.2.0/crtbegin.o b/test/Driver/Inputs/montavista_i686_tree/usr/lib/gcc/i686-montavista-linux/4.2.0/crtbegin.o new file mode 100644 index 0000000..26d251d --- /dev/null +++ b/test/Driver/Inputs/montavista_i686_tree/usr/lib/gcc/i686-montavista-linux/4.2.0/crtbegin.o @@ -0,0 +1 @@ +dummy file for gcc toolchain detection (crtbegin.o) diff --git a/test/Driver/Inputs/montavista_i686_tree/usr/lib/gcc/i686-montavista-linux/4.2.0/libgcc.a b/test/Driver/Inputs/montavista_i686_tree/usr/lib/gcc/i686-montavista-linux/4.2.0/libgcc.a new file mode 100644 index 0000000..d796928 --- /dev/null +++ b/test/Driver/Inputs/montavista_i686_tree/usr/lib/gcc/i686-montavista-linux/4.2.0/libgcc.a @@ -0,0 +1 @@ +dummy file for gcc toolchain detection (libgcc.a) diff --git a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/lib/.keep b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/lib/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/lib/.keep diff --git a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/lib/arm-linux-gnueabi/.keep b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/lib/arm-linux-gnueabi/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/lib/arm-linux-gnueabi/.keep diff --git a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/lib/arm-linux-gnueabihf/.keep b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/lib/arm-linux-gnueabihf/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/lib/arm-linux-gnueabihf/.keep diff --git a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/include/.keep b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/include/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/include/.keep diff --git a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/include/arm-linux-gnueabi/.keep b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/include/arm-linux-gnueabi/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/include/arm-linux-gnueabi/.keep diff --git a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/include/arm-linux-gnueabihf/.keep b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/include/arm-linux-gnueabihf/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/include/arm-linux-gnueabihf/.keep diff --git a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/.keep b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/.keep diff --git a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-gnueabi/crt1.o b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-gnueabi/crt1.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-gnueabi/crt1.o diff --git a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-gnueabi/crti.o b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-gnueabi/crti.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-gnueabi/crti.o diff --git a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-gnueabi/crtn.o b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-gnueabi/crtn.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-gnueabi/crtn.o diff --git a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-gnueabihf/crt1.o b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-gnueabihf/crt1.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-gnueabihf/crt1.o diff --git a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-gnueabihf/crti.o b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-gnueabihf/crti.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-gnueabihf/crti.o diff --git a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-gnueabihf/crtn.o b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-gnueabihf/crtn.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/arm-linux-gnueabihf/crtn.o diff --git a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/gcc/arm-linux-gnueabi/4.6.1/crtbegin.o b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/gcc/arm-linux-gnueabi/4.6.1/crtbegin.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/gcc/arm-linux-gnueabi/4.6.1/crtbegin.o diff --git a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/gcc/arm-linux-gnueabi/4.6.1/crtend.o b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/gcc/arm-linux-gnueabi/4.6.1/crtend.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/gcc/arm-linux-gnueabi/4.6.1/crtend.o diff --git a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/crtbegin.o b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/crtbegin.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/crtbegin.o diff --git a/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/crtend.o b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/crtend.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/ubuntu_12.04_LTS_multiarch_tree/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/crtend.o diff --git a/test/Driver/altivec.cpp b/test/Driver/altivec.cpp index 6059ad0..a893636 100644 --- a/test/Driver/altivec.cpp +++ b/test/Driver/altivec.cpp @@ -1,7 +1,8 @@ // Check that we error when -faltivec is specified on non-ppc platforms. -// RUN: %clang -ccc-clang-archs powerpc -target powerpc-apple-darwin -faltivec -fsyntax-only %s +// RUN: %clang -ccc-clang-archs powerpc -target powerpc-unk-unk -faltivec -fsyntax-only %s // RUN: %clang -ccc-clang-archs powerpc64 -target powerpc64-linux-gnu -faltivec -fsyntax-only %s +// RUN: %clang -ccc-clang-archs powerpc64 -target powerpc64-linux-gnu -maltivec -fsyntax-only %s // RUN: %clang -target i386-pc-win32 -faltivec -fsyntax-only %s 2>&1 | FileCheck %s // RUN: %clang -target x86_64-unknown-freebsd -faltivec -fsyntax-only %s 2>&1 | FileCheck %s diff --git a/test/Driver/apple-kext-i386.cpp b/test/Driver/apple-kext-i386.cpp index c11a136..eb9f957 100644 --- a/test/Driver/apple-kext-i386.cpp +++ b/test/Driver/apple-kext-i386.cpp @@ -41,6 +41,11 @@ // CHECK-UNSUPPORTED2: cc1plus" // CHECK-UNSUPPORTED2-NOT: "-Wconstant-logical-operand" +// Check that -serialize-diagnostics does not cause an "argument unused" error. +// RUN: %clang -target i386-apple-darwin10 \ +// RUN: -Wall -fapple-kext -### -serialize-diagnostics %t.dia -c %s 2>&1 | \ +// RUN: FileCheck --check-prefix=CHECK-UNUSED %s + // Check that --serialize-diagnostics does not cause an "argument unused" error. // RUN: %clang -target i386-apple-darwin10 \ // RUN: -Wall -fapple-kext -### --serialize-diagnostics %t.dia -c %s 2>&1 | \ diff --git a/test/Driver/arc.c b/test/Driver/arc.c index f2c1127..5a5720c 100644 --- a/test/Driver/arc.c +++ b/test/Driver/arc.c @@ -8,10 +8,10 @@ // Just to test clang is working. # foo -// CHECK: error: -fobjc-arc is not supported with fragile abi +// CHECK: error: -fobjc-arc is not supported with legacy abi // CHECK-NOT: invalid preprocessing directive -// NOTOBJC-NOT: error: -fobjc-arc is not supported with fragile abi +// NOTOBJC-NOT: error: -fobjc-arc is not supported with legacy abi // NOTOBJC: invalid preprocessing directive // UNSUPPORTED: error: -fobjc-arc is not supported on current deployment target diff --git a/test/Driver/arclite-link.c b/test/Driver/arclite-link.c index 9cf1efe..3471bf6 100644 --- a/test/Driver/arclite-link.c +++ b/test/Driver/arclite-link.c @@ -1,8 +1,17 @@ // RUN: touch %t.o -// RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -mmacosx-version-min=10.7 %t.o 2>&1 | FileCheck -check-prefix=CHECK-ARCLITE-OSX %s +// RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -lfoo -mmacosx-version-min=10.7 %t.o 2>&1 | FileCheck -check-prefix=CHECK-ARCLITE-OSX %s // RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -mmacosx-version-min=10.8 %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOARCLITE %s // RUN: %clang -### -target i386-apple-darwin10 -fobjc-link-runtime -mmacosx-version-min=10.7 %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOARCLITE %s +// RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -nostdlib %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOSTDLIB %s +// CHECK-ARCLITE-OSX: -lfoo // CHECK-ARCLITE-OSX: libarclite_macosx.a +// CHECK-ARCLITE-OSX: -framework +// CHECK-ARCLITE-OSX: Foundation // CHECK-ARCLITE-OSX: -lobjc // CHECK-NOARCLITE-NOT: libarclite +// CHECK-NOSTDLIB-NOT: -lobjc + +// RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -fobjc-arc -mmacosx-version-min=10.7 %s 2>&1 | FileCheck -check-prefix=CHECK-UNUSED %s + +// CHECK-UNUSED-NOT: warning: argument unused during compilation: '-fobjc-link-runtime' diff --git a/test/Driver/asan-ld.c b/test/Driver/asan-ld.c new file mode 100644 index 0000000..daf046b --- /dev/null +++ b/test/Driver/asan-ld.c @@ -0,0 +1,31 @@ +// Test AddressSanitizer ld flags. + +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target i386-unknown-linux -faddress-sanitizer \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-LINUX %s +// CHECK-LINUX: "{{.*}}ld{{(.exe)?}}" +// CHECK-LINUX-NOT: "-lc" +// CHECK-LINUX: libclang_rt.asan-i386.a" +// CHECK-LINUX: "-lpthread" +// CHECK-LINUX: "-ldl" +// CHECK-LINUX: "-export-dynamic" + +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target arm-linux-androideabi -faddress-sanitizer \ +// RUN: --sysroot=%S/Inputs/basic_android_tree \ +// RUN: | FileCheck --check-prefix=CHECK-ANDROID %s +// CHECK-ANDROID: "{{.*}}ld{{(.exe)?}}" +// CHECK-ANDROID-NOT: "-lc" +// CHECK-ANDROID: "-u" "__asan_preinit" "-lasan" +// CHECK-ANDROID: "-lasan_preload" "-ldl" + +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target arm-linux-androideabi -faddress-sanitizer \ +// RUN: --sysroot=%S/Inputs/basic_android_tree \ +// RUN: -shared \ +// RUN: | FileCheck --check-prefix=CHECK-ANDROID-SHARED %s +// CHECK-ANDROID-SHARED: "{{.*}}ld{{(.exe)?}}" +// CHECK-ANDROID-SHARED-NOT: "-lc" +// CHECK-ANDROID-SHARED-NOT: "-lasan" +// CHECK-ANDROID-SHARED: "-lasan_preload" "-ldl" diff --git a/test/Driver/bounds-checking.c b/test/Driver/bounds-checking.c new file mode 100644 index 0000000..95bb8af --- /dev/null +++ b/test/Driver/bounds-checking.c @@ -0,0 +1,7 @@ +// RUN: %clang -target x86_64-apple-darwin10 -fbounds-checking -### -fsyntax-only %s 2> %t +// RUN: FileCheck < %t %s +// RUN: %clang -target x86_64-apple-darwin10 -fbounds-checking=3 -### -fsyntax-only %s 2> %t +// RUN: FileCheck -check-prefix=CHECK2 < %t %s + +// CHECK: "-fbounds-checking=1" +// CHECK2: "-fbounds-checking=3" diff --git a/test/Driver/ccc-as-cpp.c b/test/Driver/ccc-as-cpp.c new file mode 100644 index 0000000..feead51 --- /dev/null +++ b/test/Driver/ccc-as-cpp.c @@ -0,0 +1,6 @@ +// REQUIRES: shell +// RUN: ln -sf %clang %T/clang-cpp + +// PR13529: Don't crash. +// RUN: %T/clang-cpp -lfoo -M %s 2>&1 | FileCheck --check-prefix=CHECK-PR13529 %s +// CHECK-PR13529: warning: -lfoo: 'linker' input unused in cpp mode diff --git a/test/Driver/clang-translation.c b/test/Driver/clang-translation.c index 0e82de4..76196da 100644 --- a/test/Driver/clang-translation.c +++ b/test/Driver/clang-translation.c @@ -44,3 +44,33 @@ // ARMV7_HARDFLOAT: "-mfloat-abi" "hard" // ARMV7_HARDFLOAT-NOT: "-msoft-float" // ARMV7_HARDFLOAT: "-x" "c" + +// RUN: %clang -target arm-linux -### -S %s 2> %t.log \ +// RUN: -march=armv5e +// RUN: FileCheck -check-prefix=ARMV5E %s < %t.log +// ARMV5E: clang +// ARMV5E: "-cc1" +// ARMV5E: "-target-cpu" "arm1022e" + +// RUN: %clang -ccc-clang-archs powerpc64 \ +// RUN: -target powerpc64-unknown-linux-gnu -### -S %s 2> %t.log \ +// RUN: -mcpu=G5 +// RUN: FileCheck -check-prefix=PPCG5 %s < %t.log +// PPCG5: clang +// PPCG5: "-cc1" +// PPCG5: "-target-cpu" "g5" + +// RUN: %clang -ccc-clang-archs powerpc64 \ +// RUN: -target powerpc64-unknown-linux-gnu -### -S %s 2> %t.log \ +// RUN: -mcpu=power7 +// RUN: FileCheck -check-prefix=PPCPWR7 %s < %t.log +// PPCPWR7: clang +// PPCPWR7: "-cc1" +// PPCPWR7: "-target-cpu" "pwr7" + +// RUN: %clang -ccc-clang-archs powerpc64 \ +// RUN: -target powerpc64-unknown-linux-gnu -### -S %s 2> %t.log +// RUN: FileCheck -check-prefix=PPC64NS %s < %t.log +// PPC64NS: clang +// PPC64NS: "-cc1" +// PPC64NS: "-target-cpu" "ppc64" diff --git a/test/Driver/clang_f_opts.c b/test/Driver/clang_f_opts.c index 4eed4aa..0ee7d2da 100644 --- a/test/Driver/clang_f_opts.c +++ b/test/Driver/clang_f_opts.c @@ -29,3 +29,12 @@ // RUN: %clang -### -c -Wdeprecated %s 2>&1 | FileCheck -check-prefix=DEPRECATED-OFF-CHECK %s // DEPRECATED-ON-CHECK: -fdeprecated-macro // DEPRECATED-OFF-CHECK-NOT: -fdeprecated-macro + +// RUN: %clang -### -S -ffp-contract=fast %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s +// RUN: %clang -### -S -ffast-math %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-FAST-CHECK %s +// RUN: %clang -### -S -ffp-contract=off %s 2>&1 | FileCheck -check-prefix=FP-CONTRACT-OFF-CHECK %s +// FP-CONTRACT-FAST-CHECK: -ffp-contract=fast +// FP-CONTRACT-OFF-CHECK: -ffp-contract=off + +// RUN: %clang -fms-extensions -fenable-experimental-ms-inline-asm %s -### 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS3 %s +// CHECK-OPTIONS3: -fenable-experimental-ms-inline-asm diff --git a/test/Driver/clang_f_opts.h b/test/Driver/clang_f_opts.h new file mode 100644 index 0000000..e48d0cf --- /dev/null +++ b/test/Driver/clang_f_opts.h @@ -0,0 +1,2 @@ +// RUN: %clang -### -fsyntax-only %s 2>&1 | FileCheck %s +// CHECK: -fsyntax-only diff --git a/test/Driver/constructors.c b/test/Driver/constructors.c new file mode 100644 index 0000000..ca2cac2 --- /dev/null +++ b/test/Driver/constructors.c @@ -0,0 +1,14 @@ +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ +// RUN: -target i386-unknown-linux \ +// RUN: --sysroot=%S/Inputs/fake_install_tree \ +// RUN: | FileCheck --check-prefix=CHECK-GCC-4-7 %s + +// CHECK-GCC-4-7: -fuse-init-array + +// RUN: %clang -no-canonical-prefixes %s -### -fsyntax-only 2>&1 \ +// RUN: -target i386-unknown-linux \ +// RUN: --sysroot=%S/Inputs/basic_linux_tree \ +// RUN: | FileCheck --check-prefix=CHECK-GCC-4-6 %s + + +// CHECK-GCC-4-6-NOT: -fuse-init-array diff --git a/test/Driver/crash-report.c b/test/Driver/crash-report.c new file mode 100644 index 0000000..7adaf42 --- /dev/null +++ b/test/Driver/crash-report.c @@ -0,0 +1,27 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: env TMPDIR=%t TEMP=%t TMP=%t %clang -fsyntax-only %s \ +// RUN: -F/tmp/ -I /tmp/ -idirafter /tmp/ -iquote /tmp/ -isystem /tmp/ \ +// RUN: -iprefix /the/prefix -iwithprefix /tmp -iwithprefixbefore /tmp/ \ +// RUN: -internal-isystem /tmp/ -internal-externc-isystem /tmp/ \ +// RUN: -DFOO=BAR 2>&1 | FileCheck %s +// RUN: cat %t/crash-report-*.c | FileCheck --check-prefix=CHECKSRC %s +// RUN: cat %t/crash-report-*.sh | FileCheck --check-prefix=CHECKSH %s +// REQUIRES: crash-recovery + +#pragma clang __debug parser_crash +// CHECK: Preprocessed source(s) and associated run script(s) are located at: +// CHECK-NEXT: note: diagnostic msg: {{.*}}.c +FOO +// CHECKSRC: FOO +// CHECKSH: -D "FOO=BAR" +// CHECKSH-NOT: -F/tmp/ +// CHECKSH-NOT: -I /tmp/ +// CHECKSH-NOT: -idirafter /tmp/ +// CHECKSH-NOT: -iquote /tmp/ +// CHECKSH-NOT: -isystem /tmp/ +// CHECKSH-NOT: -iprefix /the/prefix +// CHECKSH-NOT: -iwithprefix /tmp/ +// CHECKSH-NOT: -iwithprefixbefore /tmp/ +// CHECKSH-NOT: -internal-isystem /tmp/ +// CHECKSH-NOT: -internal-externc-isystem /tmp/ diff --git a/test/Driver/darwin-ld.c b/test/Driver/darwin-ld.c index 3206f65..4cda37f 100644 --- a/test/Driver/darwin-ld.c +++ b/test/Driver/darwin-ld.c @@ -121,3 +121,8 @@ // RUN: %clang -target x86_64-apple-darwin12 -### %t.o 2> %t.log // RUN: FileCheck -check-prefix=LINK_NO_CRT1 %s < %t.log // LINK_NO_CRT1-NOT: crt + +// RUN: %clang -target i386-apple-darwin12 -pg -### %t.o 2> %t.log +// RUN: FileCheck -check-prefix=LINK_PG %s < %t.log +// LINK_PG: -lgcrt1.o +// LINK_PG: -no_new_main diff --git a/test/Driver/darwin-objc-defaults.m b/test/Driver/darwin-objc-defaults.m index 49fe8f9..6265cfb 100644 --- a/test/Driver/darwin-objc-defaults.m +++ b/test/Driver/darwin-objc-defaults.m @@ -7,7 +7,7 @@ // RUN: FileCheck --check-prefix CHECK-I386_OSX10_5 < %t %s // CHECK-CHECK-I386_OSX10_5: "-cc1" -// CHECK-CHECK-I386_OSX10_5: -fobjc-fragile-abi +// CHECK-CHECK-I386_OSX10_5: -fobjc-runtime=macosx-fragile-10.5 // CHECK-CHECK-I386_OSX10_5-NOT: -fobjc-dispatch-method // CHECK-CHECK-I386_OSX10_5: darwin-objc-defaults @@ -16,7 +16,7 @@ // RUN: FileCheck --check-prefix CHECK-I386_OSX10_6 < %t %s // CHECK-CHECK-I386_OSX10_6: "-cc1" -// CHECK-CHECK-I386_OSX10_6: -fobjc-fragile-abi +// CHECK-CHECK-I386_OSX10_6: -fobjc-runtime=macosx-fragile-10.6 // CHECK-CHECK-I386_OSX10_6-NOT: -fobjc-dispatch-method // CHECK-CHECK-I386_OSX10_6: darwin-objc-defaults @@ -25,7 +25,7 @@ // RUN: FileCheck --check-prefix CHECK-I386_IPHONE3_0 < %t %s // CHECK-CHECK-I386_IPHONE3_0: "-cc1" -// CHECK-CHECK-I386_IPHONE3_0: -fobjc-fragile-abi +// CHECK-CHECK-I386_IPHONE3_0: -fobjc-runtime=ios-3.0 // CHECK-CHECK-I386_IPHONE3_0-NOT: -fobjc-dispatch-method // CHECK-CHECK-I386_IPHONE3_0: darwin-objc-defaults @@ -36,7 +36,7 @@ // RUN: FileCheck --check-prefix CHECK-X86_64_OSX10_5 < %t %s // CHECK-CHECK-X86_64_OSX10_5: "-cc1" -// CHECK-CHECK-X86_64_OSX10_5-NOT: -fobjc-fragile-abi +// CHECK-CHECK-X86_64_OSX10_5: -fobjc-runtime=macosx-10.5 // CHECK-CHECK-X86_64_OSX10_5: -fobjc-dispatch-method=non-legacy // CHECK-CHECK-X86_64_OSX10_5: darwin-objc-defaults @@ -45,7 +45,7 @@ // RUN: FileCheck --check-prefix CHECK-X86_64_OSX10_6 < %t %s // CHECK-CHECK-X86_64_OSX10_6: "-cc1" -// CHECK-CHECK-X86_64_OSX10_6-NOT: -fobjc-fragile-abi +// CHECK-CHECK-X86_64_OSX10_6: -fobjc-runtime=macosx-10.6 // CHECK-CHECK-X86_64_OSX10_6: -fobjc-dispatch-method=mixed // CHECK-CHECK-X86_64_OSX10_6: darwin-objc-defaults @@ -54,7 +54,7 @@ // RUN: FileCheck --check-prefix CHECK-X86_64_IPHONE3_0 < %t %s // CHECK-CHECK-X86_64_IPHONE3_0: "-cc1" -// CHECK-CHECK-X86_64_IPHONE3_0-NOT: -fobjc-fragile-abi +// CHECK-CHECK-X86_64_IPHONE3_0: -fobjc-runtime=ios-3.0 // CHECK-CHECK-X86_64_IPHONE3_0: -fobjc-dispatch-method=mixed // CHECK-CHECK-X86_64_IPHONE3_0: darwin-objc-defaults @@ -65,7 +65,7 @@ // RUN: FileCheck --check-prefix CHECK-ARMV7_OSX10_5 < %t %s // CHECK-CHECK-ARMV7_OSX10_5: "-cc1" -// CHECK-CHECK-ARMV7_OSX10_5-NOT: -fobjc-fragile-abi +// CHECK-CHECK-ARMV7_OSX10_5: -fobjc-runtime=macosx-10.5 // CHECK-CHECK-ARMV7_OSX10_5-NOT: -fobjc-dispatch-method // CHECK-CHECK-ARMV7_OSX10_5: darwin-objc-defaults @@ -74,7 +74,7 @@ // RUN: FileCheck --check-prefix CHECK-ARMV7_OSX10_6 < %t %s // CHECK-CHECK-ARMV7_OSX10_6: "-cc1" -// CHECK-CHECK-ARMV7_OSX10_6-NOT: -fobjc-fragile-abi +// CHECK-CHECK-ARMV7_OSX10_6: -fobjc-runtime=macosx-10.6 // CHECK-CHECK-ARMV7_OSX10_6-NOT: -fobjc-dispatch-method // CHECK-CHECK-ARMV7_OSX10_6: darwin-objc-defaults @@ -83,6 +83,6 @@ // RUN: FileCheck --check-prefix CHECK-ARMV7_IPHONE3_0 < %t %s // CHECK-CHECK-ARMV7_IPHONE3_0: "-cc1" -// CHECK-CHECK-ARMV7_IPHONE3_0-NOT: -fobjc-fragile-abi +// CHECK-CHECK-ARMV7_IPHONE3_0: -fobjc-runtime=ios-3.0 // CHECK-CHECK-ARMV7_IPHONE3_0-NOT: -fobjc-dispatch-method // CHECK-CHECK-ARMV7_IPHONE3_0: darwin-objc-defaults diff --git a/test/Driver/darwin-objc-options.m b/test/Driver/darwin-objc-options.m index 5b421d8..77501ab 100644 --- a/test/Driver/darwin-objc-options.m +++ b/test/Driver/darwin-objc-options.m @@ -5,7 +5,7 @@ // RUN: FileCheck --check-prefix CHECK-X86_64_ABI1 < %t %s // CHECK-CHECK-X86_64_ABI1: "-cc1" -// CHECK-CHECK-X86_64_ABI1: -fobjc-fragile-abi +// CHECK-CHECK-X86_64_ABI1: -fobjc-runtime=macosx-fragile-10.6.0 // CHECK-CHECK-X86_64_ABI1-NOT: -fobjc-dispatch-method // CHECK-CHECK-X86_64_ABI1: darwin-objc-options @@ -14,8 +14,19 @@ // RUN: FileCheck --check-prefix CHECK-I386_ABI2 < %t %s // CHECK-CHECK-I386_ABI2: "-cc1" -// CHECK-CHECK-I386_ABI2-NOT: -fobjc-fragile-abi +// CHECK-CHECK-I386_ABI2: -fobjc-runtime=macosx-10.6.0 // CHECK-CHECK-I386_ABI2: -fobjc-exceptions // CHECK-CHECK-I386_ABI2: -fexceptions // CHECK-CHECK-I386_ABI2-NOT: -fobjc-dispatch-method // CHECK-CHECK-I386_ABI2: darwin-objc-options + +// RUN: %clang -target x86_64-apple-darwin10 -S -### %s \ +// RUN: -arch i386 -fobjc-runtime=ios-5.0 2> %t +// RUN: FileCheck --check-prefix CHECK-I386_IOS < %t %s + +// CHECK-CHECK-I386_IOS: "-cc1" +// CHECK-CHECK-I386_IOS: -fobjc-runtime=ios-5.0 +// CHECK-CHECK-I386_IOS: -fobjc-exceptions +// CHECK-CHECK-I386_IOS: -fexceptions +// CHECK-CHECK-I386_IOS-NOT: -fobjc-dispatch-method +// CHECK-CHECK-I386_IOS: darwin-objc-options diff --git a/test/Driver/debug-options-as.c b/test/Driver/debug-options-as.c index a1dbe2e..57036e4 100644 --- a/test/Driver/debug-options-as.c +++ b/test/Driver/debug-options-as.c @@ -4,7 +4,8 @@ // Check to make sure clang is somewhat picky about -g options. // (Delived from debug-options.c) // rdar://10383444 -// RUN: %clang -### -c -save-temps -g %s 2>&1 | FileCheck -check-prefix=SAVE %s +// RUN: %clang -### -c -save-temps -integrated-as -g %s 2>&1 \ +// RUN: | FileCheck -check-prefix=SAVE %s // // SAVE: "-cc1as" // SAVE-NOT: "-g" @@ -12,7 +13,8 @@ // Check to make sure clang with -g on a .s file gets passed. // rdar://9275556 // RUN: touch %t.s -// RUN: %clang -### -c -g %t.s 2>&1 | FileCheck -check-prefix=S %s +// RUN: %clang -### -c -integrated-as -g %t.s 2>&1 \ +// RUN: | FileCheck -check-prefix=S %s // // S: "-cc1as" // S: "-g" diff --git a/test/Driver/debug-options.c b/test/Driver/debug-options.c index 5dad8e9..ca77abf 100644 --- a/test/Driver/debug-options.c +++ b/test/Driver/debug-options.c @@ -2,26 +2,43 @@ // rdar://10383444 // RUN: %clang -### -c -g %s 2>&1 | FileCheck -check-prefix=G %s -// RUN: %clang -### -c -g2 %s 2>&1 | FileCheck -check-prefix=G2 %s -// RUN: %clang -### -c -g3 %s 2>&1 | FileCheck -check-prefix=G3 %s -// RUN: %clang -### -c -ganything %s 2>&1 | FileCheck -check-prefix=GANY %s -// RUN: %clang -### -c -ggdb %s 2>&1 | FileCheck -check-prefix=GGDB %s -// RUN: %clang -### -c -gfoo %s 2>&1 | FileCheck -check-prefix=GFOO %s +// RUN: %clang -### -c -g2 %s 2>&1 | FileCheck -check-prefix=G %s +// RUN: %clang -### -c -g3 %s 2>&1 | FileCheck -check-prefix=G %s +// RUN: %clang -### -c -ggdb %s 2>&1 | FileCheck -check-prefix=G %s +// RUN: %clang -### -c -ggdb1 %s 2>&1 | FileCheck -check-prefix=G %s +// RUN: %clang -### -c -ggdb3 %s 2>&1 | FileCheck -check-prefix=G %s +// RUN: %clang -### -c -gdwarf-2 %s 2>&1 | FileCheck -check-prefix=G %s +// +// RUN: %clang -### -c -gfoo %s 2>&1 | FileCheck -check-prefix=G_NO %s +// RUN: %clang -### -c -g -g0 %s 2>&1 | FileCheck -check-prefix=G_NO %s +// RUN: %clang -### -c -ggdb0 %s 2>&1 | FileCheck -check-prefix=G_NO %s +// +// RUN: %clang -### -c -gline-tables-only %s 2>&1 \ +// RUN: | FileCheck -check-prefix=GLTO_ONLY %s +// RUN: %clang -### -c -gline-tables-only -g %s 2>&1 \ +// RUN: | FileCheck -check-prefix=G_ONLY %s +// RUN: %clang -### -c -gline-tables-only -g0 %s 2>&1 \ +// RUN: | FileCheck -check-prefix=GLTO_NO %s +// +// RUN: %clang -### -c -grecord-gcc-switches -gno-record-gcc-switches \ +// RUN: -gstrict-dwarf -gno-strict-dwarf %s 2>&1 \ +// RUN: | not grep "argument unused during compilation" // // G: "-cc1" // G: "-g" // -// G2: "-cc1" -// G2: "-g" -// -// G3: "-cc1" -// G3: "-g" +// G_NO: "-cc1" +// G_NO-NOT: "-g" // -// GANY: "-cc1" -// GANY-NOT: "-g" +// GLTO_ONLY: "-cc1" +// GLTO_ONLY-NOT: "-g" +// GLTO_ONLY: "-gline-tables-only" +// GLTO_ONLY-NOT: "-g" // -// GGDB: "-cc1" -// GGDB: "-g" +// G_ONLY: "-cc1" +// G_ONLY-NOT: "-gline-tables-only" +// G_ONLY: "-g" +// G_ONLY-NOT: "-gline-tables-only" // -// GFOO: "-cc1" -// GFOO-NOT: "-g" +// GLTO_NO: "-cc1" +// GLTO_NO-NOT: "-gline-tables-only" diff --git a/test/Driver/debug-unsupported.c b/test/Driver/debug-unsupported.c new file mode 100644 index 0000000..acbd767 --- /dev/null +++ b/test/Driver/debug-unsupported.c @@ -0,0 +1,13 @@ +// RUN: %clang -c -gstabs %s 2>&1 | FileCheck %s +// RUN: %clang -c -gstabs+ %s 2>&1 | FileCheck %s +// RUN: %clang -c -gcoff %s 2>&1 | FileCheck %s +// RUN: %clang -c -gxcoff %s 2>&1 | FileCheck %s +// RUN: %clang -c -gxcoff+ %s 2>&1 | FileCheck %s +// RUN: %clang -c -gvms %s 2>&1 | FileCheck %s +// RUN: %clang -c -gstabs1 %s 2>&1 | FileCheck %s +// RUN: %clang -c -gcoff2 %s 2>&1 | FileCheck %s +// RUN: %clang -c -gxcoff3 %s 2>&1 | FileCheck %s +// RUN: %clang -c -gvms0 %s 2>&1 | FileCheck %s +// RUN: %clang -c -gtoggle %s 2>&1 | FileCheck %s +// +// CHECK: error: unsupported option diff --git a/test/Driver/fast-math.c b/test/Driver/fast-math.c index aef7cc3..8426f09 100644 --- a/test/Driver/fast-math.c +++ b/test/Driver/fast-math.c @@ -4,6 +4,9 @@ // LLVM only supports three switches which is more coarse grained than GCC's // support. // +// Both of them use gcc driver for as. +// XFAIL: cygwin,mingw32 +// // RUN: %clang -### -fno-honor-infinities -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NO-INFS %s // CHECK-NO-INFS: "-cc1" @@ -19,8 +22,23 @@ // CHECK-MATH-ERRNO: "-cc1" // CHECK-MATH-ERRNO: "-fmath-errno" // -// RUN: %clang -### -fassociative-math -freciprocal-math -fno-signed-zeros \ -// RUN: -fno-trapping-math -c %s 2>&1 \ +// RUN: %clang -### -fmath-errno -fno-math-errno -c %s 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s +// RUN: %clang -### -target i686-apple-darwin -c %s 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s +// RUN: %clang -### -target x86_64-unknown-freebsd -c %s 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s +// RUN: %clang -### -target x86_64-unknown-netbsd -c %s 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s +// RUN: %clang -### -target x86_64-unknown-openbsd -c %s 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s +// RUN: %clang -### -target x86_64-unknown-dragonfly -c %s 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NO-MATH-ERRNO %s +// CHECK-NO-MATH-ERRNO: "-cc1" +// CHECK-NO-MATH-ERRNO-NOT: "-fmath-errno" +// +// RUN: %clang -### -fno-math-errno -fassociative-math -freciprocal-math \ +// RUN: -fno-signed-zeros -fno-trapping-math -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-UNSAFE-MATH %s // CHECK-UNSAFE-MATH: "-cc1" // CHECK-UNSAFE-MATH: "-menable-unsafe-fp-math" @@ -36,7 +54,7 @@ // RUN: | FileCheck --check-prefix=CHECK-NO-INFS %s // RUN: %clang -### -ffinite-math-only -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NO-NANS %s -// RUN: %clang -### -funsafe-math-optimizations -c %s 2>&1 \ +// RUN: %clang -### -funsafe-math-optimizations -fno-math-errno -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-UNSAFE-MATH %s // // One umbrella flag is *really* weird and also changes the semantics of the diff --git a/test/Driver/flags.c b/test/Driver/flags.c index 7a885b6..698a54e 100644 --- a/test/Driver/flags.c +++ b/test/Driver/flags.c @@ -7,3 +7,5 @@ // RUN: %clang -target i386-apple-darwin9 -### -S -mno-soft-float %s -msoft-float 2> %t.log // RUN: grep '"-no-implicit-float"' %t.log +// RUN: %clang -target armv7-apple-darwin10 -### -S -mno-implicit-float %s 2> %t.log +// RUN: grep '"-no-implicit-float"' %t.log | count 1 diff --git a/test/Driver/fpack-struct.c b/test/Driver/fpack-struct.c new file mode 100644 index 0000000..cc75da5 --- /dev/null +++ b/test/Driver/fpack-struct.c @@ -0,0 +1,10 @@ +// RUN: %clang -fpack-struct -### %s 2> %t +// RUN: FileCheck < %t %s +// RUN: %clang -fpack-struct=8 -### %s 2> %t +// RUN: FileCheck < %t %s --check-prefix=EQ + +// CHECK: "-cc1" +// CHECK: "-fpack-struct=1" + +// CHECK-EQ: "-cc1" +// CHECK-EQ: "-fpack-struct=8" diff --git a/test/Driver/freebsd.c b/test/Driver/freebsd.c index 1fb84a0..642c60c 100644 --- a/test/Driver/freebsd.c +++ b/test/Driver/freebsd.c @@ -28,3 +28,19 @@ // RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -print-search-dirs 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-LIB32PATHS %s // CHECK-LIB32PATHS: libraries: ={{.*:?}}/usr/lib32 +// +// Check that the new linker flags are passed to FreeBSD +// RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd8 -m32 %s \ +// RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-LDFLAGS8 %s +// RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd9 -m32 %s \ +// RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-LDFLAGS9 %s +// RUN: %clang -no-canonical-prefixes -target x86_64-pc-freebsd10.0 -m32 %s \ +// RUN: --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-LDFLAGS9 %s +// CHECK-LDFLAGS8-NOT: --hash-style=both +// CHECK-LDFLAGS8: --enable-new-dtags +// CHECK-LDFLAGS9: --hash-style=both +// CHECK-LDFLAGS9: --enable-new-dtags + diff --git a/test/Driver/gnu-runtime.m b/test/Driver/gnu-runtime.m index 12426d9..1d7a40a 100644 --- a/test/Driver/gnu-runtime.m +++ b/test/Driver/gnu-runtime.m @@ -1,5 +1,4 @@ // RUN: %clang -target i386-apple-darwin10 -### -fsyntax-only -fgnu-runtime %s 2>&1 | FileCheck %s // RUN: %clang -target i386-apple-darwin10 -### -x objective-c++ -fsyntax-only -fgnu-runtime %s 2>&1 | FileCheck %s -// CHECK: -fgnu-runtime -// CHECK: -fobjc-runtime-has-arc -// CHECK: -fobjc-runtime-has-weak +// CHECK: -fobjc-runtime=gcc +// CHECK-NOT: fragile diff --git a/test/Driver/ios-simulator-arcruntime.c b/test/Driver/ios-simulator-arcruntime.c index 9bf2091..33d3492 100644 --- a/test/Driver/ios-simulator-arcruntime.c +++ b/test/Driver/ios-simulator-arcruntime.c @@ -1,6 +1,8 @@ // RUN: %clang -### -x objective-c -target i386-apple-darwin10 -arch i386 -mmacosx-version-min=10.6 -D__IPHONE_OS_VERSION_MIN_REQUIRED=40201 -fobjc-arc -fsyntax-only %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS1 %s -// RUN: %clang -### -x objective-c -target i386-apple-darwin10 -arch i386 -mmacosx-version-min=10.6 -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -fobjc-arc -fsyntax-only %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS2 %s +// RUN: %clang -### -x objective-c -target i386-apple-darwin10 -arch i386 -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -fobjc-arc -fsyntax-only %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS2 %s // -// CHECK-OPTIONS1-NOT: -fobjc-runtime-has-weak -// CHECK-OPTIONS2: -fobjc-runtime-has-weak +// CHECK-OPTIONS1: i386-apple-macosx10.6.0 +// CHECK-OPTIONS1: -fobjc-runtime=ios-4.2.1 +// CHECK-OPTIONS2: i386-apple-macosx10.6.0 +// CHECK-OPTIONS2: -fobjc-runtime=ios-5.0.0 diff --git a/test/Driver/linker-opts.c b/test/Driver/linker-opts.c index d036dfd..85e180c 100644 --- a/test/Driver/linker-opts.c +++ b/test/Driver/linker-opts.c @@ -2,4 +2,4 @@ // CHECK: "-L" "{{.*}}/test1" // GCC driver is used as linker on cygming. It should be aware of LIBRARY_PATH. -// XFAIL: cygwin,mingw32 +// XFAIL: cygwin,mingw32,win32 diff --git a/test/Driver/linux-as.c b/test/Driver/linux-as.c index 22eac0d..b3265da 100644 --- a/test/Driver/linux-as.c +++ b/test/Driver/linux-as.c @@ -3,29 +3,54 @@ // RUN: %clang -target arm-linux -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=ARM %s -// CHECK-ARM: as{{(.exe)?}}" +// CHECK-ARM: as{{(.exe)?}}" "-mfloat-abi=soft" // // RUN: %clang -target arm-linux -mcpu=cortex-a8 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=ARM-MCPU %s -// CHECK-ARM-MCPU: as{{(.exe)?}}" "-mcpu=cortex-a8" +// CHECK-ARM-MCPU: as{{(.exe)?}}" "-mfloat-abi=soft" "-mcpu=cortex-a8" // // RUN: %clang -target arm-linux -mfpu=neon -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=ARM-MFPU %s -// CHECK-ARM-MFPU: as{{(.exe)?}}" "-mfpu=neon" +// CHECK-ARM-MFPU: as{{(.exe)?}}" "-mfloat-abi=soft" "-mfpu=neon" // // RUN: %clang -target arm-linux -march=armv7-a -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=ARM-MARCH %s -// CHECK-ARM-MARCH: as{{(.exe)?}}" "-march=armv7-a" +// CHECK-ARM-MARCH: as{{(.exe)?}}" "-mfloat-abi=soft" "-march=armv7-a" // // RUN: %clang -target arm-linux -mcpu=cortex-a8 -mfpu=neon -march=armv7-a -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=ARM-ALL %s -// CHECK-ARM-ALL: as{{(.exe)?}}" "-march=armv7-a" "-mcpu=cortex-a8" "-mfpu=neon" +// CHECK-ARM-ALL: as{{(.exe)?}}" "-mfloat-abi=soft" "-march=armv7-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=ARM-TARGET %s -// CHECK-ARM-TARGET: as{{(.exe)?}}" "-mfpu=neon" "-mcpu=cortex-a8" +// CHECK-ARM-TARGET: as{{(.exe)?}}" "-mfpu=neon" "-mfloat-abi=soft" "-mcpu=cortex-a8" +// +// RUN: %clang -target arm-linux -mfloat-abi=hard -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=ARM-MFLOAT-ABI %s +// CHECK-ARM-MFLOAT-ABI: as{{(.exe)?}}" "-mfloat-abi=hard" +// +// RUN: %clang -target arm-linux-androideabi -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=ARM-ANDROID %s +// CHECK-ARM-ANDROID: as{{(.exe)?}}" "-mfloat-abi=soft" +// +// RUN: %clang -target arm-linux-androideabi -march=armv7-a -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=ARM-ANDROID-SOFTFP %s +// CHECK-ARM-ANDROID-SOFTFP: as{{(.exe)?}}" "-mfloat-abi=softfp" "-march=armv7-a" +// +// RUN: %clang -target arm-linux-eabi -mhard-float -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=ARM-HARDFP %s +// CHECK-ARM-HARDFP: as{{(.exe)?}}" "-mfloat-abi=hard" +// +// RUN: %clang -target ppc-linux -mcpu=invalid-cpu -### \ +// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=PPC-NO-MCPU %s +// CHECK-PPC-NO-MCPU-NOT: as{{.*}} "-mcpu=invalid-cpu" diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c index 9a35d5d..a6831b6 100644 --- a/test/Driver/linux-ld.c +++ b/test/Driver/linux-ld.c @@ -174,6 +174,39 @@ // CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/lib" // CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib" // +// Check multi arch support on Ubuntu 12.04 LTS. +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target arm-unknown-linux-gnueabihf \ +// RUN: --sysroot=%S/Inputs/ubuntu_12.04_LTS_multiarch_tree \ +// RUN: | FileCheck --check-prefix=CHECK-UBUNTU-12-04-ARM-HF %s +// CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-gnueabihf/crt1.o" +// CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-gnueabihf/crti.o" +// CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/crtbegin.o" +// CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabihf/4.6.3" +// CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-gnueabihf" +// CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/lib/arm-linux-gnueabihf" +// CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/usr/lib/arm-linux-gnueabihf" +// CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../.." +// CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/crtend.o" +// CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-gnueabihf/crtn.o" +// +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target arm-unknown-linux-gnueabi \ +// RUN: --sysroot=%S/Inputs/ubuntu_12.04_LTS_multiarch_tree \ +// RUN: | FileCheck --check-prefix=CHECK-UBUNTU-12-04-ARM %s +// CHECK-UBUNTU-12-04-ARM: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-gnueabi/crt1.o" +// CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-gnueabi/crti.o" +// CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/crtbegin.o" +// CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabi/4.6.1" +// CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-gnueabi" +// CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/lib/arm-linux-gnueabi" +// CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/usr/lib/arm-linux-gnueabi" +// CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../.." +// CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/crtend.o" +// CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-gnueabi/crtn.o" +// // Test the setup that shipped in SUSE 10.3 on ppc64. // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: -target powerpc64-suse-linux \ @@ -186,6 +219,21 @@ // CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/lib/../lib64" // CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/usr/lib/../lib64" // +// Check dynamic-linker for different archs +// RUN: %clang %s -### -o %t.o 2>&1 \ +// RUN: -target arm-linux-gnueabi \ +// RUN: | FileCheck --check-prefix=CHECK-ARM %s +// CHECK-ARM: "{{.*}}ld{{(.exe)?}}" +// CHECK-ARM: "-m" "armelf_linux_eabi" +// CHECK-ARM: "-dynamic-linker" "{{.*}}/lib/ld-linux.so.3" +// +// RUN: %clang %s -### -o %t.o 2>&1 \ +// RUN: -target arm-linux-gnueabihf \ +// RUN: | FileCheck --check-prefix=CHECK-ARM-HF %s +// CHECK-ARM-HF: "{{.*}}ld{{(.exe)?}}" +// CHECK-ARM-HF: "-m" "armelf_linux_eabi" +// CHECK-ARM-HF: "-dynamic-linker" "{{.*}}/lib/ld-linux-armhf.so.3" +// // Check that we do not pass --hash-style=gnu and --hash-style=both to linker // and provide correct path to the dynamic linker and emulation mode when build // for MIPS platforms. @@ -267,4 +315,86 @@ // CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-linux-gnu/4.5/../../.." // CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/lib" // CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib" +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target mips-linux-gnu \ +// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \ +// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-MIPS %s +// CHECK-DEBIAN-MIPS: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-DEBIAN-MIPS: "{{.*}}/usr/lib/gcc/mips-linux-gnu/4.5/crtbegin.o" +// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5" +// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/../../../mips-linux-gnu" +// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/mips-linux-gnu" +// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/../../.." +// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/lib" +// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib" +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target mipsel-linux-gnu \ +// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \ +// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-MIPSEL %s +// CHECK-DEBIAN-MIPSEL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-DEBIAN-MIPSEL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.5/crtbegin.o" +// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5" +// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/../../../mipsel-linux-gnu" +// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/mipsel-linux-gnu" +// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/../../.." +// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/lib" +// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib" +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target mips64-linux-gnu \ +// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \ +// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-MIPS64 %s +// CHECK-DEBIAN-MIPS64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-DEBIAN-MIPS64: "{{.*}}/usr/lib/gcc/mips-linux-gnu/4.5/64/crtbegin.o" +// CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/64" +// CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5" +// CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/../../.." +// CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/lib" +// CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/usr/lib" +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target mips64el-linux-gnu \ +// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \ +// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-MIPS64EL %s +// CHECK-DEBIAN-MIPS64EL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-DEBIAN-MIPS64EL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.5/64/crtbegin.o" +// CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/64" +// CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5" +// CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/../../.." +// CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/lib" +// CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/usr/lib" // +// Test linker invocation on Android. +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target arm-linux-androideabi \ +// RUN: --sysroot=%S/Inputs/basic_android_tree \ +// RUN: | FileCheck --check-prefix=CHECK-ANDROID %s +// CHECK-ANDROID: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-ANDROID: "{{.*}}/crtbegin_dynamic.o" +// CHECK-ANDROID: "-L[[SYSROOT]]/usr/lib" +// CHECK-ANDROID-NOT: "gcc_s" +// CHECK-ANDROID: "-lgcc" +// CHECK-ANDROID-NOT: "gcc_s" +// CHECK-ANDROID: "{{.*}}/crtend_android.o" +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target arm-linux-androideabi \ +// RUN: --sysroot=%S/Inputs/basic_android_tree \ +// RUN: -shared \ +// RUN: | FileCheck --check-prefix=CHECK-ANDROID-SO %s +// CHECK-ANDROID-SO: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-ANDROID-SO: "{{.*}}/crtbegin_so.o" +// CHECK-ANDROID-SO: "-L[[SYSROOT]]/usr/lib" +// CHECK-ANDROID-SO-NOT: "gcc_s" +// CHECK-ANDROID-SO: "-lgcc" +// CHECK-ANDROID-SO-NOT: "gcc_s" +// CHECK-ANDROID-SO: "{{.*}}/crtend_so.o" +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: -target arm-linux-androideabi \ +// RUN: --sysroot=%S/Inputs/basic_android_tree \ +// RUN: -static \ +// RUN: | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s +// CHECK-ANDROID-STATIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-ANDROID-STATIC: "{{.*}}/crtbegin_static.o" +// CHECK-ANDROID-STATIC: "-L[[SYSROOT]]/usr/lib" +// CHECK-ANDROID-STATIC-NOT: "gcc_s" +// CHECK-ANDROID-STATIC: "-lgcc" +// CHECK-ANDROID-STATIC-NOT: "gcc_s" +// CHECK-ANDROID-STATIC: "{{.*}}/crtend_android.o" diff --git a/test/Driver/mips-as.c b/test/Driver/mips-as.c index 44b8d8d..0ace4dd 100644 --- a/test/Driver/mips-as.c +++ b/test/Driver/mips-as.c @@ -3,29 +3,36 @@ // RUN: %clang -target mips-linux-gnu -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS32-EB-AS %s -// CHECK-MIPS32-EB-AS: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-EB" +// MIPS32-EB-AS: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-EB" +// MIPS32-EB-AS-NOT: "-KPIC" +// +// RUN: %clang -target mips-linux-gnu -### \ +// RUN: -no-integrated-as -fPIC -c %s 2>&1 \ +// RUN: | FileCheck -check-prefix=MIPS32-EB-PIC %s +// MIPS32-EB-PIC: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-EB" +// MIPS32-EB-PIC: "-KPIC" // // RUN: %clang -target mipsel-linux-gnu -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS32-EL-AS %s -// CHECK-MIPS32-EL-AS: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-EL" +// MIPS32-EL-AS: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-EL" // // RUN: %clang -target mips64-linux-gnu -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS64-EB-AS %s -// CHECK-MIPS64-EB-AS: as{{(.exe)?}}" "-march" "mips64" "-mabi" "64" "-EB" +// MIPS64-EB-AS: as{{(.exe)?}}" "-march" "mips64" "-mabi" "64" "-EB" // // RUN: %clang -target mips64el-linux-gnu -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS64-EL-AS %s -// CHECK-MIPS64-EL-AS: as{{(.exe)?}}" "-march" "mips64" "-mabi" "64" "-EL" +// MIPS64-EL-AS: as{{(.exe)?}}" "-march" "mips64" "-mabi" "64" "-EL" // // RUN: %clang -target mips-linux-gnu -mabi=eabi -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-EABI %s -// CHECK-MIPS-EABI: as{{(.exe)?}}" "-march" "mips32" "-mabi" "eabi" "-EB" +// MIPS-EABI: as{{(.exe)?}}" "-march" "mips32" "-mabi" "eabi" "-EB" // // RUN: %clang -target mips64-linux-gnu -mabi=n32 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-N32 %s -// CHECK-MIPS-N32: as{{(.exe)?}}" "-march" "mips64" "-mabi" "n32" "-EB" +// MIPS-N32: as{{(.exe)?}}" "-march" "mips64" "-mabi" "n32" "-EB" diff --git a/test/Driver/mips-features.c b/test/Driver/mips-features.c new file mode 100644 index 0000000..5be2683 --- /dev/null +++ b/test/Driver/mips-features.c @@ -0,0 +1,39 @@ +// REQUIRES: mips-registered-target +// +// Check handling MIPS specific features options. +// +// -mips16 +// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: -mno-mips16 -mips16 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-MIPS16 %s +// CHECK-MIPS16: "-target-feature" "+mips16" +// +// -mno-mips16 +// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: -mips16 -mno-mips16 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NOMIPS16 %s +// CHECK-NOMIPS16: "-target-feature" "-mips16" +// +// -mdsp +// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: -mno-dsp -mdsp 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-MDSP %s +// CHECK-MDSP: "-target-feature" "+dsp" +// +// -mno-dsp +// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: -mdsp -mno-dsp 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NOMDSP %s +// CHECK-NOMDSP: "-target-feature" "-dsp" +// +// -mdspr2 +// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: -mno-dspr2 -mdspr2 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-MDSPR2 %s +// CHECK-MDSPR2: "-target-feature" "+dspr2" +// +// -mno-dspr2 +// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: -mdspr2 -mno-dspr2 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NOMDSPR2 %s +// CHECK-NOMDSPR2: "-target-feature" "-dspr2" diff --git a/test/Driver/mips-float.c b/test/Driver/mips-float.c index c9e107f..95eb002 100644 --- a/test/Driver/mips-float.c +++ b/test/Driver/mips-float.c @@ -1,3 +1,4 @@ +// REQUIRES: mips-registered-target // Check handling -mhard-float / -msoft-float / -mfloat-abi options // when build for MIPS platforms. // diff --git a/test/Driver/montavista-gcc-toolchain.c b/test/Driver/montavista-gcc-toolchain.c new file mode 100644 index 0000000..b9ab729 --- /dev/null +++ b/test/Driver/montavista-gcc-toolchain.c @@ -0,0 +1,9 @@ +// Test that the montavista gcc-toolchain is correctly detected +// +// RUN: %clang -print-libgcc-file-name 2>&1 \ +// RUN: -target i686-montavista-linux \ +// RUN: -gcc-toolchain %S/Inputs/montavista_i686_tree/usr \ +// RUN: | FileCheck %s + +// Test for header search toolchain detection. +// CHECK: montavista_i686_tree/usr/lib/gcc/i686-montavista-linux/4.2.0/libgcc.a diff --git a/test/Driver/msvc_forward.c b/test/Driver/msvc_forward.c new file mode 100644 index 0000000..fe0ae84 --- /dev/null +++ b/test/Driver/msvc_forward.c @@ -0,0 +1,5 @@ +// RUN: %clang -target i686-pc-win32 -lkernel32.lib -luser32.lib -### %s 2>&1 | FileCheck %s +// CHECK-NOT: "-lkernel32.lib" +// CHECK-NOT: "-luser32.lib" +// CHECK: "kernel32.lib" +// CHECK: "user32.lib" diff --git a/test/Driver/nodefaultlib.c b/test/Driver/nodefaultlib.c new file mode 100644 index 0000000..518928a --- /dev/null +++ b/test/Driver/nodefaultlib.c @@ -0,0 +1,8 @@ +// RUN: %clang -target i686-pc-linux-gnu -### -nodefaultlibs %s 2> %t +// RUN: FileCheck < %t %s +// +// CHECK-NOT: start-group +// CHECK-NOT: -lgcc +// CHECK-NOT: -lc +// CHECK: crtbegin +// CHECK: crtend diff --git a/test/Driver/rewrite-legacy-objc.m b/test/Driver/rewrite-legacy-objc.m index af59ff6..d243c7a 100644 --- a/test/Driver/rewrite-legacy-objc.m +++ b/test/Driver/rewrite-legacy-objc.m @@ -3,7 +3,7 @@ // TEST0: clang{{.*}}" "-cc1" // TEST0: "-rewrite-objc" // FIXME: CHECK-NOT is broken somehow, it doesn't work here. Check adjacency instead. -// TEST0: "-fmessage-length" "0" "-stack-protector" "1" "-mstackrealign" "-fblocks" "-fobjc-runtime-has-arc" "-fobjc-runtime-has-weak" "-fobjc-fragile-abi" "-fobjc-default-synthesize-properties" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" "-fdiagnostics-show-option" +// TEST0: "-fmessage-length" "0" "-stack-protector" "1" "-mstackrealign" "-fblocks" "-fobjc-runtime=macosx-fragile" "-fobjc-default-synthesize-properties" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" "-fdiagnostics-show-option" // TEST0: rewrite-legacy-objc.m" // RUN: not %clang -ccc-no-clang -target unknown -rewrite-legacy-objc %s -o - -### 2>&1 | \ diff --git a/test/Driver/rewrite-objc.m b/test/Driver/rewrite-objc.m index 7b080fc..6696797 100644 --- a/test/Driver/rewrite-objc.m +++ b/test/Driver/rewrite-objc.m @@ -3,7 +3,7 @@ // TEST0: clang{{.*}}" "-cc1" // TEST0: "-rewrite-objc" // FIXME: CHECK-NOT is broken somehow, it doesn't work here. Check adjacency instead. -// TEST0: "-fmessage-length" "0" "-stack-protector" "1" "-mstackrealign" "-fblocks" "-fobjc-runtime-has-arc" "-fobjc-runtime-has-weak" "-fobjc-dispatch-method=mixed" "-fobjc-default-synthesize-properties" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" "-fdiagnostics-show-option" +// TEST0: "-fmessage-length" "0" "-stack-protector" "1" "-mstackrealign" "-fblocks" "-fobjc-runtime=macosx" "-fobjc-dispatch-method=mixed" "-fobjc-default-synthesize-properties" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" "-fdiagnostics-show-option" // TEST0: rewrite-objc.m" // RUN: not %clang -ccc-no-clang -target unknown -rewrite-objc %s -o - -### 2>&1 | \ diff --git a/test/Driver/target-triple-deployment.c b/test/Driver/target-triple-deployment.c new file mode 100644 index 0000000..8e4824a7fe --- /dev/null +++ b/test/Driver/target-triple-deployment.c @@ -0,0 +1,33 @@ +// RUN: touch %t.o +// RUN: %clang -target x86_64-apple-macosx -### %t.o 2> %t.log +// RUN: %clang -target x86_64-apple-darwin9 -### %t.o 2>> %t.log +// RUN: %clang -target x86_64-apple-macosx10.7 -### %t.o 2>> %t.log +// +// RUN: %clang -target armv7-apple-ios -### %t.o 2>> %t.log +// RUN: %clang -target armv7-apple-ios0.0 -### %t.o 2>> %t.log +// RUN: %clang -target armv7-apple-ios1.2.3 -### %t.o 2>> %t.log +// RUN: %clang -target armv7-apple-ios5.0 -### %t.o 2>> %t.log +// +// RUN: FileCheck %s < %t.log + +// CHECK: {{ld(.exe)?"}} +// CHECK: -macosx_version_min +// CHECK: 10.4.0 +// CHECK: {{ld(.exe)?"}} +// CHECK: -macosx_version_min +// CHECK: 10.5.0 +// CHECK: {{ld(.exe)?"}} +// CHECK: -macosx_version_min +// CHECK: 10.7.0 +// CHECK: {{ld(.exe)?"}} +// CHECK: -iphoneos_version_min +// CHECK: 3.0.0 +// CHECK: {{ld(.exe)?"}} +// CHECK: -iphoneos_version_min +// CHECK: 3.0.0 +// CHECK: {{ld(.exe)?"}} +// CHECK: -iphoneos_version_min +// CHECK: 1.2.3 +// CHECK: {{ld(.exe)?"}} +// CHECK: -iphoneos_version_min +// CHECK: 5.0.0 diff --git a/test/Driver/warning-options.cpp b/test/Driver/warning-options.cpp new file mode 100644 index 0000000..ab0da42 --- /dev/null +++ b/test/Driver/warning-options.cpp @@ -0,0 +1,10 @@ +// RUN: %clang -### -Wlarge-by-value-copy %s 2>&1 | FileCheck -check-prefix=LARGE_VALUE_COPY_DEFAULT %s +// LARGE_VALUE_COPY_DEFAULT: -Wlarge-by-value-copy=64 +// RUN: %clang -### -Wlarge-by-value-copy=128 %s 2>&1 | FileCheck -check-prefix=LARGE_VALUE_COPY_JOINED %s +// LARGE_VALUE_COPY_JOINED: -Wlarge-by-value-copy=128 + +// RUN: %clang -### -c -Wmonkey -Wno-monkey -Wno-unused-command-line-arguments \ +// RUN: -Wno-unused-command-line-argument %s 2>&1 | FileCheck %s +// CHECK: unknown warning option '-Wmonkey' +// CHECK: unknown warning option '-Wno-monkey' +// CHECK: unknown warning option '-Wno-unused-command-line-arguments'; did you mean '-Wno-unused-command-line-argument'? diff --git a/test/Driver/warning-options_pedantic.cpp b/test/Driver/warning-options_pedantic.cpp new file mode 100644 index 0000000..c6d11be --- /dev/null +++ b/test/Driver/warning-options_pedantic.cpp @@ -0,0 +1,7 @@ +// 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 +// 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 +// PEDANTIC: -pedantic +// XFAIL: cygwin,mingw32 |