| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/header_checker.h" | 5 #include "tools/gn/header_checker.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 InputFile* clone_input_file; | 56 InputFile* clone_input_file; |
| 57 std::vector<Token>* tokens; // Don't care about this. | 57 std::vector<Token>* tokens; // Don't care about this. |
| 58 scoped_ptr<ParseNode>* parse_root; // Don't care about this. | 58 scoped_ptr<ParseNode>* parse_root; // Don't care about this. |
| 59 | 59 |
| 60 g_scheduler->input_file_manager()->AddDynamicInput( | 60 g_scheduler->input_file_manager()->AddDynamicInput( |
| 61 input_file.name(), &clone_input_file, &tokens, &parse_root); | 61 input_file.name(), &clone_input_file, &tokens, &parse_root); |
| 62 clone_input_file->SetContents(input_file.contents()); | 62 clone_input_file->SetContents(input_file.contents()); |
| 63 | 63 |
| 64 return LocationRange(Location(clone_input_file, | 64 return LocationRange(Location(clone_input_file, |
| 65 range.begin().line_number(), | 65 range.begin().line_number(), |
| 66 range.begin().char_offset(), | 66 range.begin().column_number(), |
| 67 -1 /* TODO(scottmg) */), | 67 -1 /* TODO(scottmg) */), |
| 68 Location(clone_input_file, | 68 Location(clone_input_file, |
| 69 range.end().line_number(), | 69 range.end().line_number(), |
| 70 range.end().char_offset(), | 70 range.end().column_number(), |
| 71 -1 /* TODO(scottmg) */)); | 71 -1 /* TODO(scottmg) */)); |
| 72 } | 72 } |
| 73 | 73 |
| 74 // Given a reverse dependency chain where the target chain[0]'s includes are | 74 // Given a reverse dependency chain where the target chain[0]'s includes are |
| 75 // being used by chain[end] and not all deps are public, returns the string | 75 // being used by chain[end] and not all deps are public, returns the string |
| 76 // describing the error. | 76 // describing the error. |
| 77 std::string GetDependencyChainPublicError( | 77 std::string GetDependencyChainPublicError( |
| 78 const HeaderChecker::Chain& chain) { | 78 const HeaderChecker::Chain& chain) { |
| 79 std::string ret = "The target:\n " + | 79 std::string ret = "The target:\n " + |
| 80 chain[chain.size() - 1].target->label().GetUserVisibleName(false) + | 80 chain[chain.size() - 1].target->label().GetUserVisibleName(false) + |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 if (targets_with_other_toolchains.size() + | 577 if (targets_with_other_toolchains.size() + |
| 578 targets_with_matching_toolchains.size() > 1) | 578 targets_with_matching_toolchains.size() > 1) |
| 579 msg += "at least one of "; | 579 msg += "at least one of "; |
| 580 msg += "which should somehow be reachable."; | 580 msg += "which should somehow be reachable."; |
| 581 | 581 |
| 582 // Danger: must call CreatePersistentRange to put in Err. | 582 // Danger: must call CreatePersistentRange to put in Err. |
| 583 return Err(CreatePersistentRange(source_file, range), | 583 return Err(CreatePersistentRange(source_file, range), |
| 584 "Include not allowed.", msg); | 584 "Include not allowed.", msg); |
| 585 } | 585 } |
| 586 | 586 |
| OLD | NEW |