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

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

Issue 10828057: clang plugin: Put inner classes bugfix behind a flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: switch default 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
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 18 matching lines...) Expand all
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_inner_classes)
40 : instance_(instance), 41 : instance_(instance),
41 diagnostic_(instance.getDiagnostics()) { 42 diagnostic_(instance.getDiagnostics()),
43 check_inner_classes_(check_inner_classes) {
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 // Defer processing of this tag until its containing top-level 50 if (check_inner_classes_) {
49 // declaration has been fully parsed. See crbug.com/136863. 51 // Defer processing of this tag until its containing top-level
50 pending_class_decls_.push_back(tag); 52 // declaration has been fully parsed. See crbug.com/136863.
53 pending_class_decls_.push_back(tag);
54 } else {
55 CheckTag(tag);
56 }
51 } 57 }
52 58
53 bool ChromeClassTester::HandleTopLevelDecl(DeclGroupRef group_ref) { 59 bool ChromeClassTester::HandleTopLevelDecl(DeclGroupRef group_ref) {
54 for (size_t i = 0; i < pending_class_decls_.size(); ++i) 60 for (size_t i = 0; i < pending_class_decls_.size(); ++i)
55 CheckTag(pending_class_decls_[i]); 61 CheckTag(pending_class_decls_[i]);
56 pending_class_decls_.clear(); 62 pending_class_decls_.clear();
57 63
58 return true; // true means continue parsing. 64 return true; // true means continue parsing.
59 } 65 }
60 66
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 PresumedLoc ploc = source_manager.getPresumedLoc(spelling_location); 293 PresumedLoc ploc = source_manager.getPresumedLoc(spelling_location);
288 if (ploc.isInvalid()) { 294 if (ploc.isInvalid()) {
289 // If we're in an invalid location, we're looking at things that aren't 295 // If we're in an invalid location, we're looking at things that aren't
290 // actually stated in the source. 296 // actually stated in the source.
291 return false; 297 return false;
292 } 298 }
293 299
294 *filename = ploc.getFilename(); 300 *filename = ploc.getFilename();
295 return true; 301 return true;
296 } 302 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698