summaryrefslogtreecommitdiff
path: root/test/Driver/target-override.c
diff options
context:
space:
mode:
authorSerge Pavlov <sepavloff@gmail.com>2017-09-20 15:22:27 +0000
committerSerge Pavlov <sepavloff@gmail.com>2017-09-20 15:22:27 +0000
commitf6e021e7e979a9955c715a682af7ca649021643e (patch)
tree83b5f7acaa1149ac500ac98f8d4a0dc6dbcee9e0 /test/Driver/target-override.c
parent9a0f62efc8314133e355a190fa2cac4eb18dd2cc (diff)
downloadclang-f6e021e7e979a9955c715a682af7ca649021643e.tar.gz
Put target deduced from executable name at the start of argument list
When clang is called as 'target-clang', put deduced target option at the start of argument list so that option '--target=' specified in command line could override it. This change fixes PR34671. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313760 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Driver/target-override.c')
-rw-r--r--test/Driver/target-override.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/Driver/target-override.c b/test/Driver/target-override.c
new file mode 100644
index 0000000000..49ca90fd6f
--- /dev/null
+++ b/test/Driver/target-override.c
@@ -0,0 +1,16 @@
+// REQUIRES: shell
+// REQUIRES: x86-registered-target
+
+// RUN: mkdir -p %T/testbin
+// RUN: [ ! -s %T/testbin/i386-clang ] || rm %T/testbin/i386-clang
+// RUN: ln -s %clang %T/testbin/i386-clang
+
+// Check if invocation of "foo-clang" adds option "-target foo".
+//
+// RUN: %T/testbin/i386-clang -c -no-canonical-prefixes %s -### 2>&1 | FileCheck -check-prefix CHECK-TG1 %s
+// CHECK-TG1: Target: i386
+
+// Check if invocation of "foo-clang -target bar" overrides option "-target foo".
+//
+// RUN: %T/testbin/i386-clang -c -no-canonical-prefixes -target x86_64 %s -### 2>&1 | FileCheck -check-prefix CHECK-TG2 %s
+// CHECK-TG2: Target: x86_64