| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // an InputFile that must persist as long as the Err does. | 48 // an InputFile that must persist as long as the Err does. |
| 49 // | 49 // |
| 50 // To make this work, this function creates a clone of the InputFile managed | 50 // To make this work, this function creates a clone of the InputFile managed |
| 51 // by the InputFileManager so the error can refer to something that | 51 // by the InputFileManager so the error can refer to something that |
| 52 // persists. This means that the current file contents will live as long as | 52 // persists. This means that the current file contents will live as long as |
| 53 // the program, but this is OK since we're erroring out anyway. | 53 // the program, but this is OK since we're erroring out anyway. |
| 54 LocationRange CreatePersistentRange(const InputFile& input_file, | 54 LocationRange CreatePersistentRange(const InputFile& input_file, |
| 55 const LocationRange& range) { | 55 const LocationRange& range) { |
| 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 std::unique_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().column_number(), | 66 range.begin().column_number(), |
| 67 -1 /* TODO(scottmg) */), | 67 -1 /* TODO(scottmg) */), |
| 68 Location(clone_input_file, | 68 Location(clone_input_file, |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 if (targets_with_other_toolchains.size() + | 574 if (targets_with_other_toolchains.size() + |
| 575 targets_with_matching_toolchains.size() > 1) | 575 targets_with_matching_toolchains.size() > 1) |
| 576 msg += "at least one of "; | 576 msg += "at least one of "; |
| 577 msg += "which should somehow be reachable."; | 577 msg += "which should somehow be reachable."; |
| 578 | 578 |
| 579 // Danger: must call CreatePersistentRange to put in Err. | 579 // Danger: must call CreatePersistentRange to put in Err. |
| 580 return Err(CreatePersistentRange(source_file, range), | 580 return Err(CreatePersistentRange(source_file, range), |
| 581 "Include not allowed.", msg); | 581 "Include not allowed.", msg); |
| 582 } | 582 } |
| 583 | 583 |
| OLD | NEW |