OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 banned_directories_.push_back("testing/"); | 47 banned_directories_.push_back("testing/"); |
48 banned_directories_.push_back("googleurl/"); | 48 banned_directories_.push_back("googleurl/"); |
49 banned_directories_.push_back("v8/"); | 49 banned_directories_.push_back("v8/"); |
50 banned_directories_.push_back("sdch/"); | 50 banned_directories_.push_back("sdch/"); |
51 | 51 |
52 // Don't check autogenerated headers. | 52 // Don't check autogenerated headers. |
53 banned_directories_.push_back("out/"); | 53 banned_directories_.push_back("out/"); |
54 banned_directories_.push_back("llvm/"); | 54 banned_directories_.push_back("llvm/"); |
55 banned_directories_.push_back("ninja/"); | 55 banned_directories_.push_back("ninja/"); |
56 banned_directories_.push_back("xcodebuild/"); | 56 banned_directories_.push_back("xcodebuild/"); |
57 banned_directories_.push_back("clang/"); | |
58 | 57 |
59 // You are standing in a mazy of twisty dependencies, all resolved by | 58 // You are standing in a mazy of twisty dependencies, all resolved by |
60 // putting everything in the header. | 59 // putting everything in the header. |
61 banned_directories_.push_back("automation/"); | 60 banned_directories_.push_back("automation/"); |
62 | 61 |
63 // Don't check system headers. | 62 // Don't check system headers. |
64 banned_directories_.push_back("/Developer/"); | 63 banned_directories_.push_back("/Developer/"); |
65 | 64 |
66 // Used in really low level threading code that probably shouldn't be out of | 65 // Used in really low level threading code that probably shouldn't be out of |
67 // lined. | 66 // lined. |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 char resolvedPath[MAXPATHLEN]; | 225 char resolvedPath[MAXPATHLEN]; |
227 if (realpath(b.c_str(), resolvedPath)) { | 226 if (realpath(b.c_str(), resolvedPath)) { |
228 b = resolvedPath; | 227 b = resolvedPath; |
229 } | 228 } |
230 | 229 |
231 for (std::vector<std::string>::const_iterator it = | 230 for (std::vector<std::string>::const_iterator it = |
232 banned_directories_.begin(); | 231 banned_directories_.begin(); |
233 it != banned_directories_.end(); ++it) { | 232 it != banned_directories_.end(); ++it) { |
234 // If we can find any of the banned path components in this path, then | 233 // If we can find any of the banned path components in this path, then |
235 // this file is rejected. | 234 // this file is rejected. |
236 if (b.find(*it) != std::string::npos) | 235 size_t index = b.find(*it); |
237 return true; | 236 if (index != std::string::npos) { |
| 237 bool matches_full_dir_name = index == 0 || b[index - 1] == '/'; |
| 238 if ((*it)[0] == '/') |
| 239 matches_full_dir_name = true; |
| 240 if (matches_full_dir_name) |
| 241 return true; |
| 242 } |
238 } | 243 } |
239 } | 244 } |
240 | 245 |
241 return false; | 246 return false; |
242 } | 247 } |
243 | 248 |
244 bool ChromeClassTester::IsIgnoredType(const std::string& base_name) { | 249 bool ChromeClassTester::IsIgnoredType(const std::string& base_name) { |
245 return ignored_record_names_.find(base_name) != ignored_record_names_.end(); | 250 return ignored_record_names_.find(base_name) != ignored_record_names_.end(); |
246 } | 251 } |
OLD | NEW |