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

Unified Diff: tools/gn/escape.cc

Issue 440333002: Support more configurability in GN toolchains (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: unsigned check Created 6 years, 4 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
« no previous file with comments | « tools/gn/escape.h ('k') | tools/gn/escape_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/escape.cc
diff --git a/tools/gn/escape.cc b/tools/gn/escape.cc
index 58bb04e7f771e7f207a3bb293d009ec74264d47e..06f6ee8bec3d6b6758a62b498506b26aa09c85da 100644
--- a/tools/gn/escape.cc
+++ b/tools/gn/escape.cc
@@ -48,6 +48,17 @@ void EscapeStringToString_Ninja(const base::StringPiece& str,
NinjaEscapeChar(str[i], dest);
}
+template<typename DestString>
+void EscapeStringToString_NinjaPreformatted(const base::StringPiece& str,
+ DestString* dest) {
+ // Only Ninja-escape $.
+ for (size_t i = 0; i < str.size(); i++) {
+ if (str[i] == '$')
+ dest->push_back('$');
+ dest->push_back(str[i]);
+ }
+}
+
// Escape for CommandLineToArgvW and additionally escape Ninja characters.
//
// The basic algorithm is if the string doesn't contain any parse-affecting
@@ -166,6 +177,9 @@ void EscapeStringToString(const base::StringPiece& str,
NOTREACHED();
}
break;
+ case ESCAPE_NINJA_PREFORMATTED_COMMAND:
+ EscapeStringToString_NinjaPreformatted(str, dest);
+ break;
default:
NOTREACHED();
}
« no previous file with comments | « tools/gn/escape.h ('k') | tools/gn/escape_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698