Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: tools/clang/plugins/ChromeClassTester.cpp

Issue 10837254: Style plugin: remove temporary flag for checking inner classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/clang/plugins/ChromeClassTester.h ('k') | tools/clang/plugins/FindBadConstructs.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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,
41 bool check_cc_directory) 40 bool check_cc_directory)
42 : instance_(instance), 41 : instance_(instance),
43 diagnostic_(instance.getDiagnostics()), 42 diagnostic_(instance.getDiagnostics()),
44 check_inner_classes_(check_inner_classes),
45 check_cc_directory_(check_cc_directory) { 43 check_cc_directory_(check_cc_directory) {
46 BuildBannedLists(); 44 BuildBannedLists();
47 } 45 }
48 46
49 ChromeClassTester::~ChromeClassTester() {} 47 ChromeClassTester::~ChromeClassTester() {}
50 48
51 void ChromeClassTester::HandleTagDeclDefinition(TagDecl* tag) { 49 void ChromeClassTester::HandleTagDeclDefinition(TagDecl* tag) {
52 if (check_inner_classes_) { 50 pending_class_decls_.push_back(tag);
53 // Defer processing of this tag until its containing top-level
54 // declaration has been fully parsed. See crbug.com/136863.
55 pending_class_decls_.push_back(tag);
56 } else {
57 CheckTag(tag);
58 }
59 } 51 }
60 52
61 bool ChromeClassTester::HandleTopLevelDecl(DeclGroupRef group_ref) { 53 bool ChromeClassTester::HandleTopLevelDecl(DeclGroupRef group_ref) {
62 for (size_t i = 0; i < pending_class_decls_.size(); ++i) 54 for (size_t i = 0; i < pending_class_decls_.size(); ++i)
63 CheckTag(pending_class_decls_[i]); 55 CheckTag(pending_class_decls_[i]);
64 pending_class_decls_.clear(); 56 pending_class_decls_.clear();
65 57
66 return true; // true means continue parsing. 58 return true; // true means continue parsing.
67 } 59 }
68 60
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 PresumedLoc ploc = source_manager.getPresumedLoc(spelling_location); 290 PresumedLoc ploc = source_manager.getPresumedLoc(spelling_location);
299 if (ploc.isInvalid()) { 291 if (ploc.isInvalid()) {
300 // If we're in an invalid location, we're looking at things that aren't 292 // If we're in an invalid location, we're looking at things that aren't
301 // actually stated in the source. 293 // actually stated in the source.
302 return false; 294 return false;
303 } 295 }
304 296
305 *filename = ploc.getFilename(); 297 *filename = ploc.getFilename();
306 return true; 298 return true;
307 } 299 }
OLDNEW
« no previous file with comments | « tools/clang/plugins/ChromeClassTester.h ('k') | tools/clang/plugins/FindBadConstructs.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698