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