summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2014-08-22 19:29:30 +0000
committerReid Kleckner <reid@kleckner.net>2014-08-22 19:29:30 +0000
commitaf5fd6a4d5db63a2b064ffa0e82e541c1cff2e7c (patch)
treee6b69b5281da7b55345409e7a49712201c2a008d /clang/test
parente3f146d941f11c97e2561778d640e6dab721463c (diff)
downloadbcm5719-llvm-af5fd6a4d5db63a2b064ffa0e82e541c1cff2e7c.tar.gz
bcm5719-llvm-af5fd6a4d5db63a2b064ffa0e82e541c1cff2e7c.zip
Fix PR17239 by changing the semantics of the RemainingArgsClass Option kind
This patch aims at fixing PR17239. This bug happens because the /link (clang-cl.exe argument) is marked as "consume all remaining arguments". However, when inside a response file, /link should only consume all remaining arguments inside the response file where it is located, not the entire command line after expansion. The LLVM side of the patch will change the semantics of the RemainingArgsClass kind to always consume only until the end of the response file when the option originally came from a response file. There are only two options in this class: dash dash (--) and /link. This is the Clang side of the patch in http://reviews.llvm.org/D4899 Reviewered By: rafael, rnk Differential Revision: http://reviews.llvm.org/D4900 Patch by Rafael Auler! llvm-svn: 216281
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Driver/Inputs/cc1-response.txt4
-rw-r--r--clang/test/Driver/cc1-response-files.c2
-rw-r--r--clang/test/Driver/cl-link-at-file.c22
3 files changed, 28 insertions, 0 deletions
diff --git a/clang/test/Driver/Inputs/cc1-response.txt b/clang/test/Driver/Inputs/cc1-response.txt
new file mode 100644
index 00000000000..0236fdc6aa3
--- /dev/null
+++ b/clang/test/Driver/Inputs/cc1-response.txt
@@ -0,0 +1,4 @@
+
+
+-cc1
+-triple i686-pc-windows-msvc
diff --git a/clang/test/Driver/cc1-response-files.c b/clang/test/Driver/cc1-response-files.c
new file mode 100644
index 00000000000..f47e6448a6c
--- /dev/null
+++ b/clang/test/Driver/cc1-response-files.c
@@ -0,0 +1,2 @@
+// RUN: %clang @%S/Inputs/cc1-response.txt -fsyntax-only -disable-llvm-optzns
+int main() {}
diff --git a/clang/test/Driver/cl-link-at-file.c b/clang/test/Driver/cl-link-at-file.c
new file mode 100644
index 00000000000..f817ce523ad
--- /dev/null
+++ b/clang/test/Driver/cl-link-at-file.c
@@ -0,0 +1,22 @@
+// PR17239 - The /link option, when inside a response file, should only extend
+// until the end of the response file (and not the entire command line)
+
+// Don't attempt slash switches on msys bash.
+// REQUIRES: shell-preserves-root
+
+// Note: %s must be preceded by -- or bound to another option, otherwise it may
+// be interpreted as a command-line option, e.g. on Mac where %s is commonly
+// under /Users.
+
+// RUN: echo /link bar.lib baz.lib > %t.args
+// RUN: touch %t.obj
+// RUN: %clang_cl -### @%t.args -- %t.obj 2>&1 | FileCheck %s -check-prefix=ARGS
+// If the "/link" option captures all remaining args beyond its response file,
+// it will also capture "--" and our input argument. In this case, Clang will
+// be clueless and will emit "argument unused" warnings. If PR17239 is properly
+// fixed, this should not happen because the "/link" option is restricted to
+// consume only remaining args in its response file.
+// ARGS-NOT: warning
+// ARGS-NOT: argument unused during compilation
+// Identify the linker command
+// ARGS: link.exe
OpenPOWER on IntegriCloud