OLD | NEW |
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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 | 463 |
464 bool CheckTraceBaseCall(CallExpr* call) { | 464 bool CheckTraceBaseCall(CallExpr* call) { |
465 MemberExpr* callee = dyn_cast<MemberExpr>(call->getCallee()); | 465 MemberExpr* callee = dyn_cast<MemberExpr>(call->getCallee()); |
466 if (!callee) | 466 if (!callee) |
467 return false; | 467 return false; |
468 | 468 |
469 FunctionDecl* fn = dyn_cast<FunctionDecl>(callee->getMemberDecl()); | 469 FunctionDecl* fn = dyn_cast<FunctionDecl>(callee->getMemberDecl()); |
470 if (!fn || !Config::IsTraceMethod(fn, nullptr)) | 470 if (!fn || !Config::IsTraceMethod(fn, nullptr)) |
471 return false; | 471 return false; |
472 | 472 |
473 if (trace_->getName() == kTraceImplName) { | 473 // Currently, a manually dispatched class cannot have mixin bases (having |
474 if (fn->getName() != kTraceName) | 474 // one would add a vtable which we explicitly check against). This means |
475 return false; | 475 // that we can only make calls to a trace method of the same name. Revisit |
476 } else { | 476 // this if our mixin/vtable assumption changes. |
477 // Currently, a manually dispatched class cannot have mixin bases (having | 477 if (fn->getName() != trace_->getName()) |
478 // one would add a vtable which we explicitly check against). This means | 478 return false; |
479 // that we can only make calls to a trace method of the same name. Revisit | |
480 // this if our mixin/vtable assumption changes. | |
481 if (fn->getName() != trace_->getName()) | |
482 return false; | |
483 } | |
484 | 479 |
485 CXXRecordDecl* decl = 0; | 480 CXXRecordDecl* decl = 0; |
486 if (callee && callee->hasQualifier()) { | 481 if (callee && callee->hasQualifier()) { |
487 if (const Type* type = callee->getQualifier()->getAsType()) | 482 if (const Type* type = callee->getQualifier()->getAsType()) |
488 decl = type->getAsCXXRecordDecl(); | 483 decl = type->getAsCXXRecordDecl(); |
489 } | 484 } |
490 if (!decl) | 485 if (!decl) |
491 return false; | 486 return false; |
492 | 487 |
493 RecordInfo::Bases::iterator it = info_->GetBases().find(decl); | 488 RecordInfo::Bases::iterator it = info_->GetBases().find(decl); |
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1939 | 1934 |
1940 private: | 1935 private: |
1941 BlinkGCPluginOptions options_; | 1936 BlinkGCPluginOptions options_; |
1942 }; | 1937 }; |
1943 | 1938 |
1944 } // namespace | 1939 } // namespace |
1945 | 1940 |
1946 static FrontendPluginRegistry::Add<BlinkGCPluginAction> X( | 1941 static FrontendPluginRegistry::Add<BlinkGCPluginAction> X( |
1947 "blink-gc-plugin", | 1942 "blink-gc-plugin", |
1948 "Check Blink GC invariants"); | 1943 "Check Blink GC invariants"); |
OLD | NEW |