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/label.h" | 5 #include "tools/gn/label.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "tools/gn/err.h" | 10 #include "tools/gn/err.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 toolchain_dir_(toolchain_dir) { | 207 toolchain_dir_(toolchain_dir) { |
208 name_.assign(name.data(), name.size()); | 208 name_.assign(name.data(), name.size()); |
209 toolchain_name_.assign(toolchain_name.data(), toolchain_name.size()); | 209 toolchain_name_.assign(toolchain_name.data(), toolchain_name.size()); |
210 } | 210 } |
211 | 211 |
212 Label::Label(const SourceDir& dir, const base::StringPiece& name) | 212 Label::Label(const SourceDir& dir, const base::StringPiece& name) |
213 : dir_(dir) { | 213 : dir_(dir) { |
214 name_.assign(name.data(), name.size()); | 214 name_.assign(name.data(), name.size()); |
215 } | 215 } |
216 | 216 |
| 217 Label::Label(const Label& other) = default; |
| 218 |
217 Label::~Label() { | 219 Label::~Label() { |
218 } | 220 } |
219 | 221 |
220 // static | 222 // static |
221 Label Label::Resolve(const SourceDir& current_dir, | 223 Label Label::Resolve(const SourceDir& current_dir, |
222 const Label& current_toolchain, | 224 const Label& current_toolchain, |
223 const Value& input, | 225 const Value& input, |
224 Err* err) { | 226 Err* err) { |
225 Label ret; | 227 Label ret; |
226 if (input.type() != Value::STRING) { | 228 if (input.type() != Value::STRING) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 } | 273 } |
272 return ret; | 274 return ret; |
273 } | 275 } |
274 | 276 |
275 std::string Label::GetUserVisibleName(const Label& default_toolchain) const { | 277 std::string Label::GetUserVisibleName(const Label& default_toolchain) const { |
276 bool include_toolchain = | 278 bool include_toolchain = |
277 default_toolchain.dir() != toolchain_dir_ || | 279 default_toolchain.dir() != toolchain_dir_ || |
278 default_toolchain.name() != toolchain_name_; | 280 default_toolchain.name() != toolchain_name_; |
279 return GetUserVisibleName(include_toolchain); | 281 return GetUserVisibleName(include_toolchain); |
280 } | 282 } |
OLD | NEW |