| 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) | |
| 41 : instance_(instance), | 40 : instance_(instance), |
| 42 diagnostic_(instance.getDiagnostics()), | 41 diagnostic_(instance.getDiagnostics()) { |
| 43 check_url_directory_(check_url_directory) { | |
| 44 BuildBannedLists(); | 42 BuildBannedLists(); |
| 45 } | 43 } |
| 46 | 44 |
| 47 ChromeClassTester::~ChromeClassTester() {} | 45 ChromeClassTester::~ChromeClassTester() {} |
| 48 | 46 |
| 49 void ChromeClassTester::HandleTagDeclDefinition(TagDecl* tag) { | 47 void ChromeClassTester::HandleTagDeclDefinition(TagDecl* tag) { |
| 50 pending_class_decls_.push_back(tag); | 48 pending_class_decls_.push_back(tag); |
| 51 } | 49 } |
| 52 | 50 |
| 53 bool ChromeClassTester::HandleTopLevelDecl(DeclGroupRef group_ref) { | 51 bool ChromeClassTester::HandleTopLevelDecl(DeclGroupRef group_ref) { |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 banned_directories_.push_back("pdf/"); | 161 banned_directories_.push_back("pdf/"); |
| 164 banned_directories_.push_back("ppapi/"); | 162 banned_directories_.push_back("ppapi/"); |
| 165 banned_directories_.push_back("usr/"); | 163 banned_directories_.push_back("usr/"); |
| 166 banned_directories_.push_back("testing/"); | 164 banned_directories_.push_back("testing/"); |
| 167 banned_directories_.push_back("v8/"); | 165 banned_directories_.push_back("v8/"); |
| 168 banned_directories_.push_back("dart/"); | 166 banned_directories_.push_back("dart/"); |
| 169 banned_directories_.push_back("sdch/"); | 167 banned_directories_.push_back("sdch/"); |
| 170 banned_directories_.push_back("icu4c/"); | 168 banned_directories_.push_back("icu4c/"); |
| 171 banned_directories_.push_back("frameworks/"); | 169 banned_directories_.push_back("frameworks/"); |
| 172 | 170 |
| 173 if (!check_url_directory_) | |
| 174 banned_directories_.push_back("url/"); | |
| 175 | |
| 176 // Don't check autogenerated headers. | 171 // Don't check autogenerated headers. |
| 177 // Make puts them below $(builddir_name)/.../gen and geni. | 172 // Make puts them below $(builddir_name)/.../gen and geni. |
| 178 // Ninja puts them below OUTPUT_DIR/.../gen | 173 // Ninja puts them below OUTPUT_DIR/.../gen |
| 179 // Xcode has a fixed output directory for everything. | 174 // Xcode has a fixed output directory for everything. |
| 180 banned_directories_.push_back("gen/"); | 175 banned_directories_.push_back("gen/"); |
| 181 banned_directories_.push_back("geni/"); | 176 banned_directories_.push_back("geni/"); |
| 182 banned_directories_.push_back("xcodebuild/"); | 177 banned_directories_.push_back("xcodebuild/"); |
| 183 | 178 |
| 184 // 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 |
| 185 // putting everything in the header. | 180 // putting everything in the header. |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 PresumedLoc ploc = source_manager.getPresumedLoc(spelling_location); | 308 PresumedLoc ploc = source_manager.getPresumedLoc(spelling_location); |
| 314 if (ploc.isInvalid()) { | 309 if (ploc.isInvalid()) { |
| 315 // If we're in an invalid location, we're looking at things that aren't | 310 // If we're in an invalid location, we're looking at things that aren't |
| 316 // actually stated in the source. | 311 // actually stated in the source. |
| 317 return false; | 312 return false; |
| 318 } | 313 } |
| 319 | 314 |
| 320 *filename = ploc.getFilename(); | 315 *filename = ploc.getFilename(); |
| 321 return true; | 316 return true; |
| 322 } | 317 } |
| OLD | NEW |