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

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

Issue 278523004: Blink GC plugin: require that trace call base::trace and traceAfterDispatch call base::traceAfterDi… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 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 | tools/clang/blink_gc_plugin/tests/finalize_after_dispatch.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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 if (callback->hasBody()) { 349 if (callback->hasBody()) {
350 CheckTraceVisitor nested_visitor(info_); 350 CheckTraceVisitor nested_visitor(info_);
351 nested_visitor.TraverseStmt(callback->getBody()); 351 nested_visitor.TraverseStmt(callback->getBody());
352 } 352 }
353 } 353 }
354 } 354 }
355 } 355 }
356 return true; 356 return true;
357 } 357 }
358 358
359 // TODO: It is possible to have multiple bases, where one must be traced 359 // Currently, a manually dispatched class cannot have mixin bases (having
360 // using a traceAfterDispatch. In such a case we should also check that 360 // one would add a vtable which we explicitly check against). This means
361 // the mixin does not add a vtable. 361 // that we can only make calls to a trace method of the same name. Revisit
362 if (Config::IsTraceMethod(fn) && member->hasQualifier()) { 362 // this if our mixin/vtable assumption changes.
363 if (Config::IsTraceMethod(fn) &&
364 fn->getName() == trace_->getName() &&
365 member->hasQualifier()) {
363 if (const Type* type = member->getQualifier()->getAsType()) { 366 if (const Type* type = member->getQualifier()->getAsType()) {
364 if (CXXRecordDecl* decl = type->getAsCXXRecordDecl()) { 367 if (CXXRecordDecl* decl = type->getAsCXXRecordDecl()) {
365 RecordInfo::Bases::iterator it = info_->GetBases().find(decl); 368 RecordInfo::Bases::iterator it = info_->GetBases().find(decl);
366 if (it != info_->GetBases().end()) 369 if (it != info_->GetBases().end())
367 it->second.MarkTraced(); 370 it->second.MarkTraced();
368 } 371 }
369 } 372 }
370 } 373 }
371 } 374 }
372 return true; 375 return true;
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
1429 1432
1430 private: 1433 private:
1431 BlinkGCPluginOptions options_; 1434 BlinkGCPluginOptions options_;
1432 }; 1435 };
1433 1436
1434 } // namespace 1437 } // namespace
1435 1438
1436 static FrontendPluginRegistry::Add<BlinkGCPluginAction> X( 1439 static FrontendPluginRegistry::Add<BlinkGCPluginAction> X(
1437 "blink-gc-plugin", 1440 "blink-gc-plugin",
1438 "Check Blink GC invariants"); 1441 "Check Blink GC invariants");
OLDNEW
« no previous file with comments | « no previous file | tools/clang/blink_gc_plugin/tests/finalize_after_dispatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698