OLD | NEW |
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/ninja_binary_target_writer.h" | 5 #include "tools/gn/ninja_binary_target_writer.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 void operator()(const std::string& s, std::ostream& out) const { | 41 void operator()(const std::string& s, std::ostream& out) const { |
42 out << " -D"; | 42 out << " -D"; |
43 EscapeStringToStream(out, s, options); | 43 EscapeStringToStream(out, s, options); |
44 } | 44 } |
45 | 45 |
46 EscapeOptions options; | 46 EscapeOptions options; |
47 }; | 47 }; |
48 | 48 |
49 struct IncludeWriter { | 49 struct IncludeWriter { |
50 IncludeWriter(PathOutput& path_output) : path_output_(path_output) { | 50 explicit IncludeWriter(PathOutput& path_output) : path_output_(path_output) { |
51 } | 51 } |
52 ~IncludeWriter() { | 52 ~IncludeWriter() { |
53 } | 53 } |
54 | 54 |
55 void operator()(const SourceDir& d, std::ostream& out) const { | 55 void operator()(const SourceDir& d, std::ostream& out) const { |
56 std::ostringstream path_out; | 56 std::ostringstream path_out; |
57 path_output_.WriteDir(path_out, d, PathOutput::DIR_NO_LAST_SLASH); | 57 path_output_.WriteDir(path_out, d, PathOutput::DIR_NO_LAST_SLASH); |
58 const std::string& path = path_out.str(); | 58 const std::string& path = path_out.str(); |
59 if (path[0] == '"') | 59 if (path[0] == '"') |
60 out << " \"-I" << path.substr(1); | 60 out << " \"-I" << path.substr(1); |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 return false; // No tool for this file (it's a header file or something). | 472 return false; // No tool for this file (it's a header file or something). |
473 const Tool* tool = target->toolchain()->GetTool(*computed_tool_type); | 473 const Tool* tool = target->toolchain()->GetTool(*computed_tool_type); |
474 if (!tool) | 474 if (!tool) |
475 return false; // Tool does not apply for this toolchain.file. | 475 return false; // Tool does not apply for this toolchain.file. |
476 | 476 |
477 // Figure out what output(s) this compiler produces. | 477 // Figure out what output(s) this compiler produces. |
478 SubstitutionWriter::ApplyListToCompilerAsOutputFile( | 478 SubstitutionWriter::ApplyListToCompilerAsOutputFile( |
479 target, source, tool->outputs(), outputs); | 479 target, source, tool->outputs(), outputs); |
480 return !outputs->empty(); | 480 return !outputs->empty(); |
481 } | 481 } |
OLD | NEW |