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 18 matching lines...) Expand all Loading... |
29 | 29 |
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_url_directory) |
40 : instance_(instance), | 41 : instance_(instance), |
41 diagnostic_(instance.getDiagnostics()) { | 42 diagnostic_(instance.getDiagnostics()), |
| 43 check_url_directory_(check_url_directory) { |
42 BuildBannedLists(); | 44 BuildBannedLists(); |
43 } | 45 } |
44 | 46 |
45 ChromeClassTester::~ChromeClassTester() {} | 47 ChromeClassTester::~ChromeClassTester() {} |
46 | 48 |
47 void ChromeClassTester::HandleTagDeclDefinition(TagDecl* tag) { | 49 void ChromeClassTester::HandleTagDeclDefinition(TagDecl* tag) { |
48 pending_class_decls_.push_back(tag); | 50 pending_class_decls_.push_back(tag); |
49 } | 51 } |
50 | 52 |
51 bool ChromeClassTester::HandleTopLevelDecl(DeclGroupRef group_ref) { | 53 bool ChromeClassTester::HandleTopLevelDecl(DeclGroupRef group_ref) { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 banned_directories_.push_back("ppapi/"); | 151 banned_directories_.push_back("ppapi/"); |
150 banned_directories_.push_back("usr/"); | 152 banned_directories_.push_back("usr/"); |
151 banned_directories_.push_back("testing/"); | 153 banned_directories_.push_back("testing/"); |
152 banned_directories_.push_back("googleurl/"); | 154 banned_directories_.push_back("googleurl/"); |
153 banned_directories_.push_back("v8/"); | 155 banned_directories_.push_back("v8/"); |
154 banned_directories_.push_back("dart/"); | 156 banned_directories_.push_back("dart/"); |
155 banned_directories_.push_back("sdch/"); | 157 banned_directories_.push_back("sdch/"); |
156 banned_directories_.push_back("icu4c/"); | 158 banned_directories_.push_back("icu4c/"); |
157 banned_directories_.push_back("frameworks/"); | 159 banned_directories_.push_back("frameworks/"); |
158 | 160 |
| 161 if (!check_url_directory_) |
| 162 banned_directories_.push_back("url/"); |
| 163 |
159 // Don't check autogenerated headers. | 164 // Don't check autogenerated headers. |
160 // Make puts them below $(builddir_name)/.../gen and geni. | 165 // Make puts them below $(builddir_name)/.../gen and geni. |
161 // Ninja puts them below OUTPUT_DIR/.../gen | 166 // Ninja puts them below OUTPUT_DIR/.../gen |
162 // Xcode has a fixed output directory for everything. | 167 // Xcode has a fixed output directory for everything. |
163 banned_directories_.push_back("gen/"); | 168 banned_directories_.push_back("gen/"); |
164 banned_directories_.push_back("geni/"); | 169 banned_directories_.push_back("geni/"); |
165 banned_directories_.push_back("xcodebuild/"); | 170 banned_directories_.push_back("xcodebuild/"); |
166 | 171 |
167 // You are standing in a mazy of twisty dependencies, all resolved by | 172 // You are standing in a mazy of twisty dependencies, all resolved by |
168 // putting everything in the header. | 173 // putting everything in the header. |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 PresumedLoc ploc = source_manager.getPresumedLoc(spelling_location); | 295 PresumedLoc ploc = source_manager.getPresumedLoc(spelling_location); |
291 if (ploc.isInvalid()) { | 296 if (ploc.isInvalid()) { |
292 // If we're in an invalid location, we're looking at things that aren't | 297 // If we're in an invalid location, we're looking at things that aren't |
293 // actually stated in the source. | 298 // actually stated in the source. |
294 return false; | 299 return false; |
295 } | 300 } |
296 | 301 |
297 *filename = ploc.getFilename(); | 302 *filename = ploc.getFilename(); |
298 return true; | 303 return true; |
299 } | 304 } |
OLD | NEW |