[PATCH] D60997: Fix unquoted spaces in args in clang --verbose output
Brad Moody via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 23 00:43:15 PDT 2019
bmoody created this revision.
bmoody added a reviewer: hans.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
The behaviour of not quoting spaces appears to have been introduced by mistake in revision b212b34f19472469c1d20ada3161c3523268d5be <https://reviews.llvm.org/rGb212b34f19472469c1d20ada3161c3523268d5be>
Repository:
rC Clang
https://reviews.llvm.org/D60997
Files:
clang/lib/Driver/Job.cpp
clang/test/Driver/verbose-output-quoting.c
Index: clang/test/Driver/verbose-output-quoting.c
===================================================================
--- /dev/null
+++ clang/test/Driver/verbose-output-quoting.c
@@ -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=\$"
Index: clang/lib/Driver/Job.cpp
===================================================================
--- clang/lib/Driver/Job.cpp
+++ clang/lib/Driver/Job.cpp
@@ -99,7 +99,7 @@
}
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60997.196191.patch
Type: text/x-patch
Size: 1238 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190423/33b8f409/attachment.bin>
More information about the cfe-commits
mailing list