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

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

Issue 1895943002: Update Blink GC plugin to reflect that Oilpan is now always enabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « tools/clang/blink_gc_plugin/CheckFieldsVisitor.h ('k') | tools/clang/blink_gc_plugin/Edge.h » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "CheckFieldsVisitor.h" 5 #include "CheckFieldsVisitor.h"
6 6
7 #include <cassert> 7 #include <cassert>
8 8
9 #include "BlinkGCPluginOptions.h" 9 #include "BlinkGCPluginOptions.h"
10 #include "RecordInfo.h" 10 #include "RecordInfo.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 if (stack_allocated_host_ && Parent() && Parent()->IsMember() && 78 if (stack_allocated_host_ && Parent() && Parent()->IsMember() &&
79 edge->value()->HasDefinition() && !edge->value()->IsGCAllocated()) { 79 edge->value()->HasDefinition() && !edge->value()->IsGCAllocated()) {
80 invalid_fields_.push_back(std::make_pair(current_, 80 invalid_fields_.push_back(std::make_pair(current_,
81 kMemberToGCUnmanaged)); 81 kMemberToGCUnmanaged));
82 return; 82 return;
83 } 83 }
84 84
85 if (!Parent() || !edge->value()->IsGCAllocated()) 85 if (!Parent() || !edge->value()->IsGCAllocated())
86 return; 86 return;
87 87
88 // In transition mode, disallow OwnPtr<T>, RawPtr<T> to GC allocated T's, 88 // Disallow OwnPtr<T>, RefPtr<T> and T* to stack-allocated types.
89 // also disallow T* in stack-allocated types. 89 if (Parent()->IsOwnPtr() ||
90 if (options_.enable_oilpan) { 90 (Parent()->IsRefPtr() && !edge->value()->IsGCRefCounted()) ||
sof 2016/04/18 21:23:15 Note: this RefPtr<T> check wasn't previously done
91 if (Parent()->IsOwnPtr() || 91 (stack_allocated_host_ && Parent()->IsRawPtr())) {
92 Parent()->IsRawPtrClass() ||
93 (stack_allocated_host_ && Parent()->IsRawPtr())) {
94 invalid_fields_.push_back(std::make_pair(
95 current_, InvalidSmartPtr(Parent())));
96 return;
97 }
98 if (options_.warn_raw_ptr && Parent()->IsRawPtr()) {
99 if (static_cast<RawPtr*>(Parent())->HasReferenceType()) {
100 invalid_fields_.push_back(std::make_pair(
101 current_, kReferencePtrToGCManagedWarning));
102 } else {
103 invalid_fields_.push_back(std::make_pair(
104 current_, kRawPtrToGCManagedWarning));
105 }
106 }
107 return;
108 }
109
110 if (Parent()->IsRawPtr() || Parent()->IsOwnPtr()) {
111 invalid_fields_.push_back(std::make_pair( 92 invalid_fields_.push_back(std::make_pair(
112 current_, InvalidSmartPtr(Parent()))); 93 current_, InvalidSmartPtr(Parent())));
113 return; 94 return;
114 } 95 }
115 96 if (options_.warn_raw_ptr && Parent()->IsRawPtr()) {
116 if (Parent()->IsRefPtr() && !edge->value()->IsGCRefCounted()) { 97 if (static_cast<RawPtr*>(Parent())->HasReferenceType()) {
117 invalid_fields_.push_back(std::make_pair( 98 invalid_fields_.push_back(std::make_pair(
118 current_, InvalidSmartPtr(Parent()))); 99 current_, kReferencePtrToGCManagedWarning));
119 return; 100 } else {
101 invalid_fields_.push_back(std::make_pair(
102 current_, kRawPtrToGCManagedWarning));
103 }
120 } 104 }
121 } 105 }
122 106
123 void CheckFieldsVisitor::AtCollection(Collection* edge) { 107 void CheckFieldsVisitor::AtCollection(Collection* edge) {
124 if (edge->on_heap() && Parent() && Parent()->IsOwnPtr()) 108 if (edge->on_heap() && Parent() && Parent()->IsOwnPtr())
125 invalid_fields_.push_back(std::make_pair(current_, kOwnPtrToGCManaged)); 109 invalid_fields_.push_back(std::make_pair(current_, kOwnPtrToGCManaged));
126 } 110 }
127 111
128 bool CheckFieldsVisitor::IsWarning(Error error) { 112 bool CheckFieldsVisitor::IsWarning(Error error) {
129 if (error == kRawPtrToGCManagedWarning) 113 if (error == kRawPtrToGCManagedWarning)
(...skipping 19 matching lines...) Expand all
149 return kReferencePtrToGCManaged; 133 return kReferencePtrToGCManaged;
150 else 134 else
151 return kRawPtrToGCManaged; 135 return kRawPtrToGCManaged;
152 } 136 }
153 if (ptr->IsRefPtr()) 137 if (ptr->IsRefPtr())
154 return kRefPtrToGCManaged; 138 return kRefPtrToGCManaged;
155 if (ptr->IsOwnPtr()) 139 if (ptr->IsOwnPtr())
156 return kOwnPtrToGCManaged; 140 return kOwnPtrToGCManaged;
157 assert(false && "Unknown smart pointer kind"); 141 assert(false && "Unknown smart pointer kind");
158 } 142 }
OLDNEW
« no previous file with comments | « tools/clang/blink_gc_plugin/CheckFieldsVisitor.h ('k') | tools/clang/blink_gc_plugin/Edge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698