| 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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 } | 496 } |
| 497 | 497 |
| 498 if (!Parent() || !edge->value()->IsGCAllocated()) | 498 if (!Parent() || !edge->value()->IsGCAllocated()) |
| 499 return; | 499 return; |
| 500 | 500 |
| 501 // In transition mode, disallow OwnPtr<T>, RawPtr<T> to GC allocated T's, | 501 // In transition mode, disallow OwnPtr<T>, RawPtr<T> to GC allocated T's, |
| 502 // also disallow T* in stack-allocated types. | 502 // also disallow T* in stack-allocated types. |
| 503 if (options_.enable_oilpan) { | 503 if (options_.enable_oilpan) { |
| 504 if (Parent()->IsOwnPtr() || | 504 if (Parent()->IsOwnPtr() || |
| 505 Parent()->IsRawPtrClass() || | 505 Parent()->IsRawPtrClass() || |
| 506 (stack_allocated_host_ && Parent()->IsRawPtr() && | 506 (stack_allocated_host_ && Parent()->IsRawPtr())) { |
| 507 // TODO: Remove this exception once the node hierarchy is moved. | |
| 508 !edge->value()->IsTreeShared())) { | |
| 509 invalid_fields_.push_back(std::make_pair(current_, Parent())); | 507 invalid_fields_.push_back(std::make_pair(current_, Parent())); |
| 510 return; | 508 return; |
| 511 } | 509 } |
| 512 | 510 |
| 513 return; | 511 return; |
| 514 } | 512 } |
| 515 | 513 |
| 516 if (Parent()->IsRawPtr() || Parent()->IsRefPtr() || Parent()->IsOwnPtr()) { | 514 if (Parent()->IsRawPtr() || Parent()->IsRefPtr() || Parent()->IsOwnPtr()) { |
| 517 invalid_fields_.push_back(std::make_pair(current_, Parent())); | 515 invalid_fields_.push_back(std::make_pair(current_, Parent())); |
| 518 return; | 516 return; |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 } | 717 } |
| 720 | 718 |
| 721 if (info->IsGCDerived()) { | 719 if (info->IsGCDerived()) { |
| 722 CheckLeftMostDerived(info); | 720 CheckLeftMostDerived(info); |
| 723 | 721 |
| 724 CheckDispatch(info); | 722 CheckDispatch(info); |
| 725 | 723 |
| 726 if (CXXMethodDecl* newop = info->DeclaresNewOperator()) | 724 if (CXXMethodDecl* newop = info->DeclaresNewOperator()) |
| 727 ReportClassOverridesNew(info, newop); | 725 ReportClassOverridesNew(info, newop); |
| 728 | 726 |
| 729 // TODO: Remove this exception once TreeShared is properly traced. | 727 { |
| 730 if (!info->IsTreeShared()) { | |
| 731 CheckGCRootsVisitor visitor; | 728 CheckGCRootsVisitor visitor; |
| 732 if (visitor.ContainsGCRoots(info)) | 729 if (visitor.ContainsGCRoots(info)) |
| 733 ReportClassContainsGCRoots(info, &visitor.gc_roots()); | 730 ReportClassContainsGCRoots(info, &visitor.gc_roots()); |
| 734 } | 731 } |
| 735 | 732 |
| 736 if (info->NeedsFinalization()) | 733 if (info->NeedsFinalization()) |
| 737 CheckFinalization(info); | 734 CheckFinalization(info); |
| 738 } | 735 } |
| 739 | 736 |
| 740 DumpClass(info); | 737 DumpClass(info); |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1432 | 1429 |
| 1433 private: | 1430 private: |
| 1434 BlinkGCPluginOptions options_; | 1431 BlinkGCPluginOptions options_; |
| 1435 }; | 1432 }; |
| 1436 | 1433 |
| 1437 } // namespace | 1434 } // namespace |
| 1438 | 1435 |
| 1439 static FrontendPluginRegistry::Add<BlinkGCPluginAction> X( | 1436 static FrontendPluginRegistry::Add<BlinkGCPluginAction> X( |
| 1440 "blink-gc-plugin", | 1437 "blink-gc-plugin", |
| 1441 "Check Blink GC invariants"); | 1438 "Check Blink GC invariants"); |
| OLD | NEW |