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

Side by Side Diff: tools/gn/escape.cc

Issue 247663006: Add more phony rules to GN build (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/gn/filesystem_utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "tools/gn/escape.h" 5 #include "tools/gn/escape.h"
6 6
7 #include "base/containers/stack_container.h" 7 #include "base/containers/stack_container.h"
8 8
9 namespace { 9 namespace {
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 dest->push_back('\\'); 51 dest->push_back('\\');
52 #else 52 #else
53 } else if (str[i] == '\\' && (options.mode & ESCAPE_SHELL)) { 53 } else if (str[i] == '\\' && (options.mode & ESCAPE_SHELL)) {
54 // For non-Windows shell, escape backslashes. 54 // For non-Windows shell, escape backslashes.
55 dest->push_back('\\'); 55 dest->push_back('\\');
56 dest->push_back('\\'); 56 dest->push_back('\\');
57 #endif 57 #endif
58 } else if (str[i] == '\\' && (options.mode & ESCAPE_JSON)) { 58 } else if (str[i] == '\\' && (options.mode & ESCAPE_JSON)) {
59 dest->push_back('\\'); 59 dest->push_back('\\');
60 dest->push_back('\\'); 60 dest->push_back('\\');
61 } else if (str[i] == ':' && (options.mode & ESCAPE_NINJA)) {
62 dest->push_back('$');
63 dest->push_back(':');
scottmg 2014/04/28 19:50:53 test for this
61 } else { 64 } else {
62 dest->push_back(str[i]); 65 dest->push_back(str[i]);
63 } 66 }
64 } 67 }
65 68
66 if (used_quotes) 69 if (used_quotes)
67 dest->push_back('"'); 70 dest->push_back('"');
68 } 71 }
69 72
70 } // namespace 73 } // namespace
(...skipping 10 matching lines...) Expand all
81 void EscapeStringToStream(std::ostream& out, 84 void EscapeStringToStream(std::ostream& out,
82 const base::StringPiece& str, 85 const base::StringPiece& str,
83 const EscapeOptions& options) { 86 const EscapeOptions& options) {
84 // Escape to a stack buffer and then write out to the stream. 87 // Escape to a stack buffer and then write out to the stream.
85 base::StackVector<char, 256> result; 88 base::StackVector<char, 256> result;
86 result->reserve(str.size() + 4); // Guess we'll add a couple of extra chars. 89 result->reserve(str.size() + 4); // Guess we'll add a couple of extra chars.
87 EscapeStringToString(str, options, &result.container(), NULL); 90 EscapeStringToString(str, options, &result.container(), NULL);
88 if (!result->empty()) 91 if (!result->empty())
89 out.write(result->data(), result->size()); 92 out.write(result->data(), result->size());
90 } 93 }
OLDNEW
« no previous file with comments | « no previous file | tools/gn/filesystem_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698