Chromium Code Reviews| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 | 156 |
| 157 scoped_refptr<base::SequencedWorkerPool> pool( | 157 scoped_refptr<base::SequencedWorkerPool> pool( |
| 158 new base::SequencedWorkerPool(16, "HeaderChecker")); | 158 new base::SequencedWorkerPool(16, "HeaderChecker")); |
| 159 for (const auto& file : files) { | 159 for (const auto& file : files) { |
| 160 // Only check C-like source files (RC files also have includes). | 160 // Only check C-like source files (RC files also have includes). |
| 161 SourceFileType type = GetSourceFileType(file.first); | 161 SourceFileType type = GetSourceFileType(file.first); |
| 162 if (type != SOURCE_CPP && type != SOURCE_H && type != SOURCE_C && | 162 if (type != SOURCE_CPP && type != SOURCE_H && type != SOURCE_C && |
| 163 type != SOURCE_M && type != SOURCE_MM && type != SOURCE_RC) | 163 type != SOURCE_M && type != SOURCE_MM && type != SOURCE_RC) |
| 164 continue; | 164 continue; |
| 165 | 165 |
| 166 // If any target marks it as generated, don't check it. | 166 // If any target marks it as generated, don't check it. We have to check |
| 167 // the file map which includes all targets, not just those being checked. | |
|
brettw
2015/11/28 17:51:33
CAn you be explicit in the comment here that 'file
jbroman
2015/11/30 15:25:05
Done.
| |
| 167 bool is_generated = false; | 168 bool is_generated = false; |
| 168 for (const auto& vect_i : file.second) | 169 for (const auto& vect_i : file_map_[file.first]) |
| 169 is_generated |= vect_i.is_generated; | 170 is_generated |= vect_i.is_generated; |
| 170 if (is_generated) | 171 if (is_generated) |
| 171 continue; | 172 continue; |
| 172 | 173 |
| 173 for (const auto& vect_i : file.second) { | 174 for (const auto& vect_i : file.second) { |
| 174 if (vect_i.target->check_includes()) { | 175 if (vect_i.target->check_includes()) { |
| 175 pool->PostWorkerTaskWithShutdownBehavior( | 176 pool->PostWorkerTaskWithShutdownBehavior( |
| 176 FROM_HERE, | 177 FROM_HERE, |
| 177 base::Bind(&HeaderChecker::DoWork, this, vect_i.target, file.first), | 178 base::Bind(&HeaderChecker::DoWork, this, vect_i.target, file.first), |
| 178 base::SequencedWorkerPool::BLOCK_SHUTDOWN); | 179 base::SequencedWorkerPool::BLOCK_SHUTDOWN); |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 575 if (targets_with_other_toolchains.size() + | 576 if (targets_with_other_toolchains.size() + |
| 576 targets_with_matching_toolchains.size() > 1) | 577 targets_with_matching_toolchains.size() > 1) |
| 577 msg += "at least one of "; | 578 msg += "at least one of "; |
| 578 msg += "which should somehow be reachable."; | 579 msg += "which should somehow be reachable."; |
| 579 | 580 |
| 580 // Danger: must call CreatePersistentRange to put in Err. | 581 // Danger: must call CreatePersistentRange to put in Err. |
| 581 return Err(CreatePersistentRange(source_file, range), | 582 return Err(CreatePersistentRange(source_file, range), |
| 582 "Include not allowed.", msg); | 583 "Include not allowed.", msg); |
| 583 } | 584 } |
| 584 | 585 |
| OLD | NEW |