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

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

Issue 1173333003: GC plugin: enable plugin on anonymous namespaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | tools/clang/blink_gc_plugin/tests/stack_allocated.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 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 997 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 public: 1008 public:
1009 BlinkGCPluginConsumer(CompilerInstance& instance, 1009 BlinkGCPluginConsumer(CompilerInstance& instance,
1010 const BlinkGCPluginOptions& options) 1010 const BlinkGCPluginOptions& options)
1011 : instance_(instance), 1011 : instance_(instance),
1012 diagnostic_(instance.getDiagnostics()), 1012 diagnostic_(instance.getDiagnostics()),
1013 options_(options), 1013 options_(options),
1014 json_(0) { 1014 json_(0) {
1015 1015
1016 // Only check structures in the blink and WebKit namespaces. 1016 // Only check structures in the blink and WebKit namespaces.
1017 options_.checked_namespaces.insert("blink"); 1017 options_.checked_namespaces.insert("blink");
1018 options_.checked_namespaces.insert("WebKit");
1019 1018
1020 // Ignore GC implementation files. 1019 // Ignore GC implementation files.
1021 options_.ignored_directories.push_back("/heap/"); 1020 options_.ignored_directories.push_back("/heap/");
1022 1021
1023 // Register warning/error messages. 1022 // Register warning/error messages.
1024 diag_class_must_left_mostly_derive_gc_ = diagnostic_.getCustomDiagID( 1023 diag_class_must_left_mostly_derive_gc_ = diagnostic_.getCustomDiagID(
1025 getErrorLevel(), kClassMustLeftMostlyDeriveGC); 1024 getErrorLevel(), kClassMustLeftMostlyDeriveGC);
1026 diag_class_requires_trace_method_ = 1025 diag_class_requires_trace_method_ =
1027 diagnostic_.getCustomDiagID(getErrorLevel(), kClassRequiresTraceMethod); 1026 diagnostic_.getCustomDiagID(getErrorLevel(), kClassRequiresTraceMethod);
1028 diag_base_requires_tracing_ = 1027 diag_base_requires_tracing_ =
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
1745 return false; 1744 return false;
1746 } 1745 }
1747 1746
1748 bool InCheckedNamespace(RecordInfo* info) { 1747 bool InCheckedNamespace(RecordInfo* info) {
1749 if (!info) 1748 if (!info)
1750 return false; 1749 return false;
1751 for (DeclContext* context = info->record()->getDeclContext(); 1750 for (DeclContext* context = info->record()->getDeclContext();
1752 !context->isTranslationUnit(); 1751 !context->isTranslationUnit();
1753 context = context->getParent()) { 1752 context = context->getParent()) {
1754 if (NamespaceDecl* decl = dyn_cast<NamespaceDecl>(context)) { 1753 if (NamespaceDecl* decl = dyn_cast<NamespaceDecl>(context)) {
1754 if (decl->isAnonymousNamespace())
1755 return true;
1755 if (options_.checked_namespaces.find(decl->getNameAsString()) != 1756 if (options_.checked_namespaces.find(decl->getNameAsString()) !=
1756 options_.checked_namespaces.end()) { 1757 options_.checked_namespaces.end()) {
1757 return true; 1758 return true;
1758 } 1759 }
1759 } 1760 }
1760 } 1761 }
1761 return false; 1762 return false;
1762 } 1763 }
1763 1764
1764 bool GetFilename(SourceLocation loc, string* filename) { 1765 bool GetFilename(SourceLocation loc, string* filename) {
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
2194 2195
2195 private: 2196 private:
2196 BlinkGCPluginOptions options_; 2197 BlinkGCPluginOptions options_;
2197 }; 2198 };
2198 2199
2199 } // namespace 2200 } // namespace
2200 2201
2201 static FrontendPluginRegistry::Add<BlinkGCPluginAction> X( 2202 static FrontendPluginRegistry::Add<BlinkGCPluginAction> X(
2202 "blink-gc-plugin", 2203 "blink-gc-plugin",
2203 "Check Blink GC invariants"); 2204 "Check Blink GC invariants");
OLDNEW
« no previous file with comments | « no previous file | tools/clang/blink_gc_plugin/tests/stack_allocated.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698