| 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 "tools/gn/err.h" | 8 #include "tools/gn/err.h" |
| 9 #include "tools/gn/parse_tree.h" | 9 #include "tools/gn/parse_tree.h" |
| 10 #include "tools/gn/value.h" | 10 #include "tools/gn/value.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 // Don't allow directories to start with a single slash. All labels must be | 38 // Don't allow directories to start with a single slash. All labels must be |
| 39 // in the source root. | 39 // in the source root. |
| 40 if (input[0] == '/' && (input.size() == 1 || input[1] != '/')) { | 40 if (input[0] == '/' && (input.size() == 1 || input[1] != '/')) { |
| 41 *err = Err(input_value, "Label can't start with a single slash", | 41 *err = Err(input_value, "Label can't start with a single slash", |
| 42 "Labels must be either relative (no slash at the beginning) or be " | 42 "Labels must be either relative (no slash at the beginning) or be " |
| 43 "absolute\ninside the source root (two slashes at the beginning)."); | 43 "absolute\ninside the source root (two slashes at the beginning)."); |
| 44 return false; | 44 return false; |
| 45 } | 45 } |
| 46 | 46 |
| 47 *result = current_dir.ResolveRelativeDir(input); | 47 *result = current_dir.ResolveRelativeDir(input, base::FilePath()); |
| 48 return true; | 48 return true; |
| 49 } | 49 } |
| 50 | 50 |
| 51 // Given the separated-out target name (after the colon) computes the final | 51 // Given the separated-out target name (after the colon) computes the final |
| 52 // name, using the implicit name from the previously-generated | 52 // name, using the implicit name from the previously-generated |
| 53 // computed_location if necessary. The input_value is used only for generating | 53 // computed_location if necessary. The input_value is used only for generating |
| 54 // error messages. | 54 // error messages. |
| 55 bool ComputeTargetNameFromDep(const Value& input_value, | 55 bool ComputeTargetNameFromDep(const Value& input_value, |
| 56 const SourceDir& computed_location, | 56 const SourceDir& computed_location, |
| 57 const base::StringPiece& input, | 57 const base::StringPiece& input, |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 } | 262 } |
| 263 return ret; | 263 return ret; |
| 264 } | 264 } |
| 265 | 265 |
| 266 std::string Label::GetUserVisibleName(const Label& default_toolchain) const { | 266 std::string Label::GetUserVisibleName(const Label& default_toolchain) const { |
| 267 bool include_toolchain = | 267 bool include_toolchain = |
| 268 default_toolchain.dir() != toolchain_dir_ || | 268 default_toolchain.dir() != toolchain_dir_ || |
| 269 default_toolchain.name() != toolchain_name_; | 269 default_toolchain.name() != toolchain_name_; |
| 270 return GetUserVisibleName(include_toolchain); | 270 return GetUserVisibleName(include_toolchain); |
| 271 } | 271 } |
| OLD | NEW |