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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 LocationRange CreatePersistentRange(const InputFile& input_file, | 53 LocationRange CreatePersistentRange(const InputFile& input_file, |
54 const LocationRange& range) { | 54 const LocationRange& range) { |
55 InputFile* clone_input_file; | 55 InputFile* clone_input_file; |
56 std::vector<Token>* tokens; // Don't care about this. | 56 std::vector<Token>* tokens; // Don't care about this. |
57 scoped_ptr<ParseNode>* parse_root; // Don't care about this. | 57 scoped_ptr<ParseNode>* parse_root; // Don't care about this. |
58 | 58 |
59 g_scheduler->input_file_manager()->AddDynamicInput( | 59 g_scheduler->input_file_manager()->AddDynamicInput( |
60 input_file.name(), &clone_input_file, &tokens, &parse_root); | 60 input_file.name(), &clone_input_file, &tokens, &parse_root); |
61 clone_input_file->SetContents(input_file.contents()); | 61 clone_input_file->SetContents(input_file.contents()); |
62 | 62 |
63 return LocationRange( | 63 return LocationRange(Location(clone_input_file, |
64 Location(clone_input_file, range.begin().line_number(), | 64 range.begin().line_number(), |
65 range.begin().char_offset()), | 65 range.begin().char_offset(), |
66 Location(clone_input_file, range.end().line_number(), | 66 -1 /* TODO(scottmg) */), |
67 range.end().char_offset())); | 67 Location(clone_input_file, |
| 68 range.end().line_number(), |
| 69 range.end().char_offset(), |
| 70 -1 /* TODO(scottmg) */)); |
68 } | 71 } |
69 | 72 |
70 // Given a reverse dependency chain where the target chain[0]'s includes are | 73 // Given a reverse dependency chain where the target chain[0]'s includes are |
71 // being used by chain[end] and not all deps are public, returns the string | 74 // being used by chain[end] and not all deps are public, returns the string |
72 // describing the error. | 75 // describing the error. |
73 std::string GetDependencyChainPublicError( | 76 std::string GetDependencyChainPublicError( |
74 const HeaderChecker::Chain& chain) { | 77 const HeaderChecker::Chain& chain) { |
75 std::string ret = "The target:\n " + | 78 std::string ret = "The target:\n " + |
76 chain[chain.size() - 1].target->label().GetUserVisibleName(false) + | 79 chain[chain.size() - 1].target->label().GetUserVisibleName(false) + |
77 "\nis including a file from the target:\n " + | 80 "\nis including a file from the target:\n " + |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 for (size_t i = 0; i < private_deps.size(); i++) { | 519 for (size_t i = 0; i < private_deps.size(); i++) { |
517 if (breadcrumbs.insert( | 520 if (breadcrumbs.insert( |
518 std::make_pair(private_deps[i].ptr, cur_link)).second) | 521 std::make_pair(private_deps[i].ptr, cur_link)).second) |
519 work_queue.push(ChainLink(private_deps[i].ptr, false)); | 522 work_queue.push(ChainLink(private_deps[i].ptr, false)); |
520 } | 523 } |
521 } | 524 } |
522 } | 525 } |
523 | 526 |
524 return false; | 527 return false; |
525 } | 528 } |
OLD | NEW |