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/toolchain.h" | 5 #include "tools/gn/toolchain.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "tools/gn/target.h" | 10 #include "tools/gn/target.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 void Toolchain::SetTool(ToolType type, scoped_ptr<Tool> t) { | 83 void Toolchain::SetTool(ToolType type, scoped_ptr<Tool> t) { |
84 DCHECK(type != TYPE_NONE); | 84 DCHECK(type != TYPE_NONE); |
85 DCHECK(!tools_[type].get()); | 85 DCHECK(!tools_[type].get()); |
86 t->SetComplete(); | 86 t->SetComplete(); |
87 tools_[type] = t.Pass(); | 87 tools_[type] = t.Pass(); |
88 } | 88 } |
89 | 89 |
90 void Toolchain::ToolchainSetupComplete() { | 90 void Toolchain::ToolchainSetupComplete() { |
91 // Collect required bits from all tools. | 91 // Collect required bits from all tools. |
92 for (size_t i = 0; i < TYPE_NUMTYPES; i++) { | 92 for (const auto& tool : tools_) { |
93 if (tools_[i]) | 93 if (tool) |
94 substitution_bits_.MergeFrom(tools_[i]->substitution_bits()); | 94 substitution_bits_.MergeFrom(tool->substitution_bits()); |
95 } | 95 } |
96 | 96 |
97 setup_complete_ = true; | 97 setup_complete_ = true; |
98 } | 98 } |
99 | 99 |
100 // static | 100 // static |
101 Toolchain::ToolType Toolchain::GetToolTypeForSourceType(SourceFileType type) { | 101 Toolchain::ToolType Toolchain::GetToolTypeForSourceType(SourceFileType type) { |
102 switch (type) { | 102 switch (type) { |
103 case SOURCE_C: | 103 case SOURCE_C: |
104 return TYPE_CC; | 104 return TYPE_CC; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 return TYPE_STAMP; | 149 return TYPE_STAMP; |
150 default: | 150 default: |
151 NOTREACHED(); | 151 NOTREACHED(); |
152 return Toolchain::TYPE_NONE; | 152 return Toolchain::TYPE_NONE; |
153 } | 153 } |
154 } | 154 } |
155 | 155 |
156 const Tool* Toolchain::GetToolForTargetFinalOutput(const Target* target) const { | 156 const Tool* Toolchain::GetToolForTargetFinalOutput(const Target* target) const { |
157 return tools_[GetToolTypeForTargetFinalOutput(target)].get(); | 157 return tools_[GetToolTypeForTargetFinalOutput(target)].get(); |
158 } | 158 } |
OLD | NEW |