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

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

Issue 1284833004: Remove remaining legacy SplitString calls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « tools/gn/command_format.cc ('k') | tools/gn/input_conversion.cc » ('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 <map> 5 #include <map>
6 #include <set> 6 #include <set>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 setup->build_settings().set_check_for_bad_items(false); 401 setup->build_settings().set_check_for_bad_items(false);
402 if (!setup->DoSetup(args[0], false) || !setup->Run()) 402 if (!setup->DoSetup(args[0], false) || !setup->Run())
403 return 1; 403 return 1;
404 404
405 // The inputs are everything but the first arg (which is the build dir). 405 // The inputs are everything but the first arg (which is the build dir).
406 std::vector<std::string> inputs; 406 std::vector<std::string> inputs;
407 for (size_t i = 1; i < args.size(); i++) { 407 for (size_t i = 1; i < args.size(); i++) {
408 if (args[i][0] == '@') { 408 if (args[i][0] == '@') {
409 // The argument is as a path to a response file. 409 // The argument is as a path to a response file.
410 std::string contents; 410 std::string contents;
411 std::vector<std::string> lines;
412 bool ret = base::ReadFileToString(UTF8ToFilePath(args[i].substr(1)), 411 bool ret = base::ReadFileToString(UTF8ToFilePath(args[i].substr(1)),
413 &contents); 412 &contents);
414 if (!ret) { 413 if (!ret) {
415 Err(Location(), "Response file " + args[i].substr(1) + " not found.") 414 Err(Location(), "Response file " + args[i].substr(1) + " not found.")
416 .PrintToStdout(); 415 .PrintToStdout();
417 return 1; 416 return 1;
418 } 417 }
419 base::SplitString(contents, '\n', &lines); 418 for (const std::string& line : base::SplitString(
420 for (const auto& line : lines) { 419 contents, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) {
421 if (!line.empty()) 420 if (!line.empty())
422 inputs.push_back(line); 421 inputs.push_back(line);
423 } 422 }
424 } else { 423 } else {
425 // The argument is a label or a path. 424 // The argument is a label or a path.
426 inputs.push_back(args[i]); 425 inputs.push_back(args[i]);
427 } 426 }
428 } 427 }
429 428
430 // Get the matches for the command-line input. 429 // Get the matches for the command-line input.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 480
482 // If you ask for the references of a valid target, but that target has 481 // If you ask for the references of a valid target, but that target has
483 // nothing referencing it, we'll get here without having printed anything. 482 // nothing referencing it, we'll get here without having printed anything.
484 if (!quiet && cnt == 0) 483 if (!quiet && cnt == 0)
485 OutputString("Nothing references this.\n", DECORATION_YELLOW); 484 OutputString("Nothing references this.\n", DECORATION_YELLOW);
486 485
487 return 0; 486 return 0;
488 } 487 }
489 488
490 } // namespace commands 489 } // namespace commands
OLDNEW
« no previous file with comments | « tools/gn/command_format.cc ('k') | tools/gn/input_conversion.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698