r359077 - Fix unquoted spaces in args in clang --verbose output
Hans Wennborg via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 24 02:06:04 PDT 2019
Author: hans
Date: Wed Apr 24 02:06:03 2019
New Revision: 359077
URL: http://llvm.org/viewvc/llvm-project?rev=359077&view=rev
Log:
Fix unquoted spaces in args in clang --verbose output
The behaviour of not quoting spaces appears to have been introduced by
mistake in r190620.
Patch by Brad Moody!
Differential revision: https://reviews.llvm.org/D60997
Added:
cfe/trunk/test/Driver/verbose-output-quoting.c
Modified:
cfe/trunk/lib/Driver/Job.cpp
Modified: cfe/trunk/lib/Driver/Job.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Job.cpp?rev=359077&r1=359076&r2=359077&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Job.cpp (original)
+++ cfe/trunk/lib/Driver/Job.cpp Wed Apr 24 02:06:03 2019
@@ -99,7 +99,7 @@ static bool skipArgs(const char *Flag, b
}
void Command::printArg(raw_ostream &OS, StringRef Arg, bool Quote) {
- const bool Escape = Arg.find_first_of("\"\\$") != StringRef::npos;
+ const bool Escape = Arg.find_first_of(" \"\\$") != StringRef::npos;
if (!Quote && !Escape) {
OS << Arg;
Added: cfe/trunk/test/Driver/verbose-output-quoting.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/verbose-output-quoting.c?rev=359077&view=auto
==============================================================================
--- cfe/trunk/test/Driver/verbose-output-quoting.c (added)
+++ cfe/trunk/test/Driver/verbose-output-quoting.c Wed Apr 24 02:06:03 2019
@@ -0,0 +1,9 @@
+// RUN: %clang --verbose -DSPACE="a b" -c %s 2>&1 | FileCheck -check-prefix=SPACE -strict-whitespace %s
+// RUN: %clang --verbose -DQUOTES=\"\" -c %s 2>&1 | FileCheck -check-prefix=QUOTES -strict-whitespace %s
+// RUN: %clang --verbose -DBACKSLASH=\\ -c %s 2>&1 | FileCheck -check-prefix=BACKSLASH -strict-whitespace %s
+// RUN: %clang --verbose -DDOLLAR=\$ -c %s 2>&1 | FileCheck -check-prefix=DOLLAR -strict-whitespace %s
+
+// SPACE: -cc1 {{.*}} -D "SPACE=a b"
+// QUOTES: -cc1 {{.*}} -D "QUOTES=\"\""
+// BACKSLASH: -cc1 {{.*}} -D "BACKSLASH=\\"
+// DOLLAR: -cc1 {{.*}} -D "DOLLAR=\$"
More information about the cfe-commits
mailing list