OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // A general interface for filtering and only acting on classes in Chromium C++ | 5 // A general interface for filtering and only acting on classes in Chromium C++ |
6 // code. | 6 // code. |
7 | 7 |
8 #include "ChromeClassTester.h" | 8 #include "ChromeClassTester.h" |
9 | 9 |
10 #include <sys/param.h> | 10 #include <sys/param.h> |
(...skipping 19 matching lines...) Expand all Loading... |
30 bool ends_with(const std::string& one, const std::string& two) { | 30 bool ends_with(const std::string& one, const std::string& two) { |
31 if (two.size() > one.size()) | 31 if (two.size() > one.size()) |
32 return false; | 32 return false; |
33 | 33 |
34 return one.compare(one.size() - two.size(), two.size(), two) == 0; | 34 return one.compare(one.size() - two.size(), two.size(), two) == 0; |
35 } | 35 } |
36 | 36 |
37 } // namespace | 37 } // namespace |
38 | 38 |
39 ChromeClassTester::ChromeClassTester(CompilerInstance& instance, | 39 ChromeClassTester::ChromeClassTester(CompilerInstance& instance, |
40 bool check_inner_classes) | 40 bool check_inner_classes, |
| 41 bool check_cc_directory) |
41 : instance_(instance), | 42 : instance_(instance), |
42 diagnostic_(instance.getDiagnostics()), | 43 diagnostic_(instance.getDiagnostics()), |
43 check_inner_classes_(check_inner_classes) { | 44 check_inner_classes_(check_inner_classes), |
| 45 check_cc_directory_(check_cc_directory) { |
44 BuildBannedLists(); | 46 BuildBannedLists(); |
45 } | 47 } |
46 | 48 |
47 ChromeClassTester::~ChromeClassTester() {} | 49 ChromeClassTester::~ChromeClassTester() {} |
48 | 50 |
49 void ChromeClassTester::HandleTagDeclDefinition(TagDecl* tag) { | 51 void ChromeClassTester::HandleTagDeclDefinition(TagDecl* tag) { |
50 if (check_inner_classes_) { | 52 if (check_inner_classes_) { |
51 // Defer processing of this tag until its containing top-level | 53 // Defer processing of this tag until its containing top-level |
52 // declaration has been fully parsed. See crbug.com/136863. | 54 // declaration has been fully parsed. See crbug.com/136863. |
53 pending_class_decls_.push_back(tag); | 55 pending_class_decls_.push_back(tag); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 banned_directories_.push_back("ppapi/"); | 158 banned_directories_.push_back("ppapi/"); |
157 banned_directories_.push_back("usr/"); | 159 banned_directories_.push_back("usr/"); |
158 banned_directories_.push_back("testing/"); | 160 banned_directories_.push_back("testing/"); |
159 banned_directories_.push_back("googleurl/"); | 161 banned_directories_.push_back("googleurl/"); |
160 banned_directories_.push_back("v8/"); | 162 banned_directories_.push_back("v8/"); |
161 banned_directories_.push_back("dart/"); | 163 banned_directories_.push_back("dart/"); |
162 banned_directories_.push_back("sdch/"); | 164 banned_directories_.push_back("sdch/"); |
163 banned_directories_.push_back("icu4c/"); | 165 banned_directories_.push_back("icu4c/"); |
164 banned_directories_.push_back("frameworks/"); | 166 banned_directories_.push_back("frameworks/"); |
165 | 167 |
| 168 if (!check_cc_directory_) |
| 169 banned_directories_.push_back("cc/"); |
| 170 |
166 // Don't check autogenerated headers. | 171 // Don't check autogenerated headers. |
167 // Make puts them below $(builddir_name)/.../gen and geni. | 172 // Make puts them below $(builddir_name)/.../gen and geni. |
168 // Ninja puts them below OUTPUT_DIR/.../gen | 173 // Ninja puts them below OUTPUT_DIR/.../gen |
169 // Xcode has a fixed output directory for everything. | 174 // Xcode has a fixed output directory for everything. |
170 banned_directories_.push_back("gen/"); | 175 banned_directories_.push_back("gen/"); |
171 banned_directories_.push_back("geni/"); | 176 banned_directories_.push_back("geni/"); |
172 banned_directories_.push_back("xcodebuild/"); | 177 banned_directories_.push_back("xcodebuild/"); |
173 | 178 |
174 // You are standing in a mazy of twisty dependencies, all resolved by | 179 // You are standing in a mazy of twisty dependencies, all resolved by |
175 // putting everything in the header. | 180 // putting everything in the header. |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 PresumedLoc ploc = source_manager.getPresumedLoc(spelling_location); | 298 PresumedLoc ploc = source_manager.getPresumedLoc(spelling_location); |
294 if (ploc.isInvalid()) { | 299 if (ploc.isInvalid()) { |
295 // If we're in an invalid location, we're looking at things that aren't | 300 // If we're in an invalid location, we're looking at things that aren't |
296 // actually stated in the source. | 301 // actually stated in the source. |
297 return false; | 302 return false; |
298 } | 303 } |
299 | 304 |
300 *filename = ploc.getFilename(); | 305 *filename = ploc.getFilename(); |
301 return true; | 306 return true; |
302 } | 307 } |
OLD | NEW |