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

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

Issue 986113002: tools/gn: Convert for loops to use the new range-based loops in C++11. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more fixes Created 5 years, 9 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
« tools/gn/pattern.cc ('K') | « tools/gn/substitution_pattern.cc ('k') | no next file » | 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/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
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
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 }
OLDNEW
« tools/gn/pattern.cc ('K') | « tools/gn/substitution_pattern.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698