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

Side by Side Diff: tools/clang/blink_gc_plugin/BlinkGCPlugin.cpp

Issue 306473005: Blink GC plugin: support checking structures in anonymous namespaces. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // This clang plugin checks various invariants of the Blink garbage 5 // This clang plugin checks various invariants of the Blink garbage
6 // collection infrastructure. 6 // collection infrastructure.
7 // 7 //
8 // Errors are described at: 8 // Errors are described at:
9 // http://www.chromium.org/developers/blink-gc-plugin-errors 9 // http://www.chromium.org/developers/blink-gc-plugin-errors
10 10
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
1086 std::vector<string>::iterator it = options_.ignored_directories.begin(); 1086 std::vector<string>::iterator it = options_.ignored_directories.begin();
1087 for (; it != options_.ignored_directories.end(); ++it) 1087 for (; it != options_.ignored_directories.end(); ++it)
1088 if (filename.find(*it) != string::npos) 1088 if (filename.find(*it) != string::npos)
1089 return true; 1089 return true;
1090 return false; 1090 return false;
1091 } 1091 }
1092 1092
1093 bool InCheckedNamespace(RecordInfo* info) { 1093 bool InCheckedNamespace(RecordInfo* info) {
1094 if (!info) 1094 if (!info)
1095 return false; 1095 return false;
1096 DeclContext* context = info->record()->getDeclContext(); 1096 for (DeclContext* context = info->record()->getDeclContext();
1097 if (context->isRecord()) 1097 !context->isTranslationUnit();
1098 return InCheckedNamespace(cache_.Lookup(context)); 1098 context = context->getParent()) {
1099 while (context->isNamespace()) { 1099 if (NamespaceDecl* decl = dyn_cast<NamespaceDecl>(context)) {
1100 NamespaceDecl* decl = dyn_cast<NamespaceDecl>(context); 1100 if (options_.checked_namespaces.find(decl->getNameAsString()) !=
1101 if (decl->isAnonymousNamespace()) 1101 options_.checked_namespaces.end()) {
1102 return false; 1102 return true;
1103 if (options_.checked_namespaces.find(decl->getNameAsString()) != 1103 }
1104 options_.checked_namespaces.end()) 1104 }
1105 return true;
1106 context = decl->getDeclContext();
1107 } 1105 }
1108 return false; 1106 return false;
1109 } 1107 }
1110 1108
1111 bool GetFilename(SourceLocation loc, string* filename) { 1109 bool GetFilename(SourceLocation loc, string* filename) {
1112 const SourceManager& source_manager = instance_.getSourceManager(); 1110 const SourceManager& source_manager = instance_.getSourceManager();
1113 SourceLocation spelling_location = source_manager.getSpellingLoc(loc); 1111 SourceLocation spelling_location = source_manager.getSpellingLoc(loc);
1114 PresumedLoc ploc = source_manager.getPresumedLoc(spelling_location); 1112 PresumedLoc ploc = source_manager.getPresumedLoc(spelling_location);
1115 if (ploc.isInvalid()) { 1113 if (ploc.isInvalid()) {
1116 // If we're in an invalid location, we're looking at things that aren't 1114 // If we're in an invalid location, we're looking at things that aren't
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
1474 1472
1475 private: 1473 private:
1476 BlinkGCPluginOptions options_; 1474 BlinkGCPluginOptions options_;
1477 }; 1475 };
1478 1476
1479 } // namespace 1477 } // namespace
1480 1478
1481 static FrontendPluginRegistry::Add<BlinkGCPluginAction> X( 1479 static FrontendPluginRegistry::Add<BlinkGCPluginAction> X(
1482 "blink-gc-plugin", 1480 "blink-gc-plugin",
1483 "Check Blink GC invariants"); 1481 "Check Blink GC invariants");
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698