Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Unified Diff: tools/gn/file_template.cc

Issue 311733002: Redo escaping in GN (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/gn/file_template.cc
diff --git a/tools/gn/file_template.cc b/tools/gn/file_template.cc
index b6264829e97bd3114a2e7c5591ea223920af6d45..b00eb391738b1fff05d0141e58623e4a676dabbf 100644
--- a/tools/gn/file_template.cc
+++ b/tools/gn/file_template.cc
@@ -166,7 +166,7 @@ void FileTemplate::ApplyString(const std::string& str,
void FileTemplate::WriteWithNinjaExpansions(std::ostream& out) const {
EscapeOptions escape_options;
- escape_options.mode = ESCAPE_NINJA_SHELL;
+ escape_options.mode = ESCAPE_NINJA_COMMAND;
escape_options.inhibit_quoting = true;
for (size_t template_i = 0;
@@ -184,8 +184,10 @@ void FileTemplate::WriteWithNinjaExpansions(std::ostream& out) const {
for (size_t subrange_i = 0; subrange_i < t.container().size();
subrange_i++) {
if (t[subrange_i].type == Subrange::LITERAL) {
+ bool cur_needs_quoting = false;
item_str.append(EscapeString(t[subrange_i].literal, escape_options,
- &needs_quoting));
+ &cur_needs_quoting));
+ needs_quoting |= cur_needs_quoting;
} else {
// Don't escape this since we need to preserve the $.
item_str.append("${");

Powered by Google App Engine
This is Rietveld 408576698