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

Side by Side Diff: tools/clang/blink_gc_plugin/Edge.h

Issue 2711633002: blink clang plugin: Fix some Winconsistent-missing-override warnings (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | no next file » | 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 #ifndef TOOLS_BLINK_GC_PLUGIN_EDGE_H_ 5 #ifndef TOOLS_BLINK_GC_PLUGIN_EDGE_H_
6 #define TOOLS_BLINK_GC_PLUGIN_EDGE_H_ 6 #define TOOLS_BLINK_GC_PLUGIN_EDGE_H_
7 7
8 #include <cassert> 8 #include <cassert>
9 #include <deque> 9 #include <deque>
10 #include <vector> 10 #include <vector>
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 }; 136 };
137 137
138 class RawPtr : public PtrEdge { 138 class RawPtr : public PtrEdge {
139 public: 139 public:
140 RawPtr(Edge* ptr, bool is_ref_type) 140 RawPtr(Edge* ptr, bool is_ref_type)
141 : PtrEdge(ptr) 141 : PtrEdge(ptr)
142 , is_ref_type_(is_ref_type) 142 , is_ref_type_(is_ref_type)
143 { 143 {
144 } 144 }
145 145
146 bool IsRawPtr() { return true; } 146 bool IsRawPtr() override { return true; }
147 LivenessKind Kind() { return kWeak; } 147 LivenessKind Kind() override { return kWeak; }
148 bool NeedsFinalization() { return false; } 148 bool NeedsFinalization() override { return false; }
149 TracingStatus NeedsTracing(NeedsTracingOption) { 149 TracingStatus NeedsTracing(NeedsTracingOption) override {
150 return TracingStatus::Illegal(); 150 return TracingStatus::Illegal();
151 } 151 }
152 void Accept(EdgeVisitor* visitor) { visitor->VisitRawPtr(this); } 152 void Accept(EdgeVisitor* visitor) override { visitor->VisitRawPtr(this); }
153 153
154 bool HasReferenceType() { return is_ref_type_; } 154 bool HasReferenceType() { return is_ref_type_; }
155 private: 155 private:
156 bool is_ref_type_; 156 bool is_ref_type_;
157 }; 157 };
158 158
159 class RefPtr : public PtrEdge { 159 class RefPtr : public PtrEdge {
160 public: 160 public:
161 explicit RefPtr(Edge* ptr) : PtrEdge(ptr) { } 161 explicit RefPtr(Edge* ptr) : PtrEdge(ptr) { }
162 bool IsRefPtr() { return true; } 162 bool IsRefPtr() override { return true; }
163 LivenessKind Kind() { return kStrong; } 163 LivenessKind Kind() override { return kStrong; }
164 bool NeedsFinalization() { return true; } 164 bool NeedsFinalization() override { return true; }
165 TracingStatus NeedsTracing(NeedsTracingOption) { 165 TracingStatus NeedsTracing(NeedsTracingOption) override {
166 return TracingStatus::Illegal(); 166 return TracingStatus::Illegal();
167 } 167 }
168 void Accept(EdgeVisitor* visitor) { visitor->VisitRefPtr(this); } 168 void Accept(EdgeVisitor* visitor) override { visitor->VisitRefPtr(this); }
169 }; 169 };
170 170
171 class OwnPtr : public PtrEdge { 171 class OwnPtr : public PtrEdge {
172 public: 172 public:
173 explicit OwnPtr(Edge* ptr) : PtrEdge(ptr) { } 173 explicit OwnPtr(Edge* ptr) : PtrEdge(ptr) { }
174 bool IsOwnPtr() { return true; } 174 bool IsOwnPtr() override { return true; }
175 LivenessKind Kind() { return kStrong; } 175 LivenessKind Kind() override { return kStrong; }
176 bool NeedsFinalization() { return true; } 176 bool NeedsFinalization() override { return true; }
177 TracingStatus NeedsTracing(NeedsTracingOption) { 177 TracingStatus NeedsTracing(NeedsTracingOption) override {
178 return TracingStatus::Illegal(); 178 return TracingStatus::Illegal();
179 } 179 }
180 void Accept(EdgeVisitor* visitor) { visitor->VisitOwnPtr(this); } 180 void Accept(EdgeVisitor* visitor) override { visitor->VisitOwnPtr(this); }
181 }; 181 };
182 182
183 class UniquePtr : public PtrEdge { 183 class UniquePtr : public PtrEdge {
184 public: 184 public:
185 explicit UniquePtr(Edge* ptr) : PtrEdge(ptr) { } 185 explicit UniquePtr(Edge* ptr) : PtrEdge(ptr) { }
186 bool IsUniquePtr() { return true; } 186 bool IsUniquePtr() override { return true; }
187 LivenessKind Kind() { return kStrong; } 187 LivenessKind Kind() override { return kStrong; }
188 bool NeedsFinalization() { return true; } 188 bool NeedsFinalization() override { return true; }
189 TracingStatus NeedsTracing(NeedsTracingOption) { 189 TracingStatus NeedsTracing(NeedsTracingOption) override {
190 return TracingStatus::Illegal(); 190 return TracingStatus::Illegal();
191 } 191 }
192 void Accept(EdgeVisitor* visitor) { visitor->VisitUniquePtr(this); } 192 void Accept(EdgeVisitor* visitor) override { visitor->VisitUniquePtr(this); }
193 }; 193 };
194 194
195 class Member : public PtrEdge { 195 class Member : public PtrEdge {
196 public: 196 public:
197 explicit Member(Edge* ptr) : PtrEdge(ptr) { } 197 explicit Member(Edge* ptr) : PtrEdge(ptr) { }
198 bool IsMember() { return true; } 198 bool IsMember() override { return true; }
199 LivenessKind Kind() { return kStrong; } 199 LivenessKind Kind() override { return kStrong; }
200 bool NeedsFinalization() { return false; } 200 bool NeedsFinalization() override { return false; }
201 TracingStatus NeedsTracing(NeedsTracingOption) { 201 TracingStatus NeedsTracing(NeedsTracingOption) override {
202 return TracingStatus::Needed(); 202 return TracingStatus::Needed();
203 } 203 }
204 void Accept(EdgeVisitor* visitor) { visitor->VisitMember(this); } 204 void Accept(EdgeVisitor* visitor) override { visitor->VisitMember(this); }
205 }; 205 };
206 206
207 class WeakMember : public PtrEdge { 207 class WeakMember : public PtrEdge {
208 public: 208 public:
209 explicit WeakMember(Edge* ptr) : PtrEdge(ptr) { } 209 explicit WeakMember(Edge* ptr) : PtrEdge(ptr) { }
210 bool IsWeakMember() { return true; } 210 bool IsWeakMember() override { return true; }
211 LivenessKind Kind() { return kWeak; } 211 LivenessKind Kind() override { return kWeak; }
212 bool NeedsFinalization() { return false; } 212 bool NeedsFinalization() override { return false; }
213 TracingStatus NeedsTracing(NeedsTracingOption) { 213 TracingStatus NeedsTracing(NeedsTracingOption) override {
214 return TracingStatus::Needed(); 214 return TracingStatus::Needed();
215 } 215 }
216 void Accept(EdgeVisitor* visitor) { visitor->VisitWeakMember(this); } 216 void Accept(EdgeVisitor* visitor) override { visitor->VisitWeakMember(this); }
217 }; 217 };
218 218
219 class Persistent : public PtrEdge { 219 class Persistent : public PtrEdge {
220 public: 220 public:
221 explicit Persistent(Edge* ptr) : PtrEdge(ptr) { } 221 explicit Persistent(Edge* ptr) : PtrEdge(ptr) { }
222 LivenessKind Kind() { return kRoot; } 222 LivenessKind Kind() override { return kRoot; }
223 bool NeedsFinalization() { return true; } 223 bool NeedsFinalization() override { return true; }
224 TracingStatus NeedsTracing(NeedsTracingOption) { 224 TracingStatus NeedsTracing(NeedsTracingOption) override {
225 return TracingStatus::Unneeded(); 225 return TracingStatus::Unneeded();
226 } 226 }
227 void Accept(EdgeVisitor* visitor) { visitor->VisitPersistent(this); } 227 void Accept(EdgeVisitor* visitor) override { visitor->VisitPersistent(this); }
228 }; 228 };
229 229
230 class CrossThreadPersistent : public PtrEdge { 230 class CrossThreadPersistent : public PtrEdge {
231 public: 231 public:
232 explicit CrossThreadPersistent(Edge* ptr) : PtrEdge(ptr) { } 232 explicit CrossThreadPersistent(Edge* ptr) : PtrEdge(ptr) { }
233 LivenessKind Kind() { return kRoot; } 233 LivenessKind Kind() override { return kRoot; }
234 bool NeedsFinalization() { return true; } 234 bool NeedsFinalization() override { return true; }
235 TracingStatus NeedsTracing(NeedsTracingOption) { 235 TracingStatus NeedsTracing(NeedsTracingOption) override {
236 return TracingStatus::Illegal(); 236 return TracingStatus::Illegal();
237 } 237 }
238 void Accept(EdgeVisitor* visitor) { 238 void Accept(EdgeVisitor* visitor) override {
239 visitor->VisitCrossThreadPersistent(this); 239 visitor->VisitCrossThreadPersistent(this);
240 } 240 }
241 }; 241 };
242 242
243 class Collection : public Edge { 243 class Collection : public Edge {
244 public: 244 public:
245 typedef std::vector<Edge*> Members; 245 typedef std::vector<Edge*> Members;
246 Collection(RecordInfo* info, bool on_heap, bool is_root) 246 Collection(RecordInfo* info, bool on_heap, bool is_root)
247 : info_(info), 247 : info_(info),
248 on_heap_(on_heap), 248 on_heap_(on_heap),
249 is_root_(is_root) {} 249 is_root_(is_root) {}
250 ~Collection() { 250 ~Collection() {
251 for (Members::iterator it = members_.begin(); it != members_.end(); ++it) { 251 for (Members::iterator it = members_.begin(); it != members_.end(); ++it) {
252 assert(*it && "Collection-edge members must be non-null"); 252 assert(*it && "Collection-edge members must be non-null");
253 delete *it; 253 delete *it;
254 } 254 }
255 } 255 }
256 bool IsCollection() { return true; } 256 bool IsCollection() override { return true; }
257 LivenessKind Kind() { return is_root_ ? kRoot : kStrong; } 257 LivenessKind Kind() override { return is_root_ ? kRoot : kStrong; }
258 bool on_heap() { return on_heap_; } 258 bool on_heap() { return on_heap_; }
259 bool is_root() { return is_root_; } 259 bool is_root() { return is_root_; }
260 Members& members() { return members_; } 260 Members& members() { return members_; }
261 void Accept(EdgeVisitor* visitor) { visitor->VisitCollection(this); } 261 void Accept(EdgeVisitor* visitor) override { visitor->VisitCollection(this); }
262 void AcceptMembers(EdgeVisitor* visitor) { 262 void AcceptMembers(EdgeVisitor* visitor) {
263 for (Members::iterator it = members_.begin(); it != members_.end(); ++it) 263 for (Members::iterator it = members_.begin(); it != members_.end(); ++it)
264 (*it)->Accept(visitor); 264 (*it)->Accept(visitor);
265 } 265 }
266 bool NeedsFinalization(); 266 bool NeedsFinalization() override;
267 TracingStatus NeedsTracing(NeedsTracingOption) { 267 TracingStatus NeedsTracing(NeedsTracingOption) override {
268 if (is_root_) 268 if (is_root_)
269 return TracingStatus::Unneeded(); 269 return TracingStatus::Unneeded();
270 if (on_heap_) 270 if (on_heap_)
271 return TracingStatus::Needed(); 271 return TracingStatus::Needed();
272 // For off-heap collections, determine tracing status of members. 272 // For off-heap collections, determine tracing status of members.
273 TracingStatus status = TracingStatus::Unneeded(); 273 TracingStatus status = TracingStatus::Unneeded();
274 for (Members::iterator it = members_.begin(); it != members_.end(); ++it) { 274 for (Members::iterator it = members_.begin(); it != members_.end(); ++it) {
275 // Do a non-recursive test here since members could equal the holder. 275 // Do a non-recursive test here since members could equal the holder.
276 status = status.LUB((*it)->NeedsTracing(kNonRecursive)); 276 status = status.LUB((*it)->NeedsTracing(kNonRecursive));
277 } 277 }
278 return status; 278 return status;
279 } 279 }
280 280
281 private: 281 private:
282 RecordInfo* info_; 282 RecordInfo* info_;
283 Members members_; 283 Members members_;
284 bool on_heap_; 284 bool on_heap_;
285 bool is_root_; 285 bool is_root_;
286 }; 286 };
287 287
288 // An iterator edge is a direct edge to some iterator type. 288 // An iterator edge is a direct edge to some iterator type.
289 class Iterator : public Edge { 289 class Iterator : public Edge {
290 public: 290 public:
291 Iterator(RecordInfo* info, bool on_heap, bool is_unsafe) 291 Iterator(RecordInfo* info, bool on_heap, bool is_unsafe)
292 : info_(info), on_heap_(on_heap), is_unsafe_(is_unsafe) {} 292 : info_(info), on_heap_(on_heap), is_unsafe_(is_unsafe) {}
293 ~Iterator() {} 293 ~Iterator() {}
294 294
295 void Accept(EdgeVisitor* visitor) { visitor->VisitIterator(this); } 295 void Accept(EdgeVisitor* visitor) override { visitor->VisitIterator(this); }
296 LivenessKind Kind() override { return kStrong; } 296 LivenessKind Kind() override { return kStrong; }
297 bool NeedsFinalization() { return false; } 297 bool NeedsFinalization() override { return false; }
298 TracingStatus NeedsTracing(NeedsTracingOption) { 298 TracingStatus NeedsTracing(NeedsTracingOption) override {
299 if (on_heap_) 299 if (on_heap_)
300 return TracingStatus::Needed(); 300 return TracingStatus::Needed();
301 return TracingStatus::Unneeded(); 301 return TracingStatus::Unneeded();
302 } 302 }
303 303
304 RecordInfo* info() const { return info_; } 304 RecordInfo* info() const { return info_; }
305 305
306 bool IsUnsafe() const { return is_unsafe_; } 306 bool IsUnsafe() const { return is_unsafe_; }
307 307
308 private: 308 private:
309 RecordInfo* info_; 309 RecordInfo* info_;
310 bool on_heap_; 310 bool on_heap_;
311 bool is_unsafe_; 311 bool is_unsafe_;
312 }; 312 };
313 313
314 #endif // TOOLS_BLINK_GC_PLUGIN_EDGE_H_ 314 #endif // TOOLS_BLINK_GC_PLUGIN_EDGE_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698