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

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

Issue 278513005: Blink GC plugin: disallow pure-virtual trace methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove pure related code Created 6 years, 7 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 | Annotate | Revision Log
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 #include "Config.h" 5 #include "Config.h"
6 #include "RecordInfo.h" 6 #include "RecordInfo.h"
7 7
8 using namespace clang; 8 using namespace clang;
9 using std::string; 9 using std::string;
10 10
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 DetermineTracingMethods(); 265 DetermineTracingMethods();
266 return finalize_dispatch_method_; 266 return finalize_dispatch_method_;
267 } 267 }
268 268
269 RecordInfo::Bases& RecordInfo::GetBases() { 269 RecordInfo::Bases& RecordInfo::GetBases() {
270 if (!bases_) 270 if (!bases_)
271 bases_ = CollectBases(); 271 bases_ = CollectBases();
272 return *bases_; 272 return *bases_;
273 } 273 }
274 274
275 bool RecordInfo::InheritsNonPureTrace() { 275 bool RecordInfo::InheritsTrace() {
276 if (CXXMethodDecl* trace = GetTraceMethod()) 276 if (GetTraceMethod())
277 return !trace->isPure(); 277 return true;
278 for (Bases::iterator it = GetBases().begin(); it != GetBases().end(); ++it) { 278 for (Bases::iterator it = GetBases().begin(); it != GetBases().end(); ++it) {
279 if (it->second.info()->InheritsNonPureTrace()) 279 if (it->second.info()->InheritsTrace())
280 return true; 280 return true;
281 } 281 }
282 return false; 282 return false;
283 } 283 }
284 284
285 CXXMethodDecl* RecordInfo::InheritsNonVirtualTrace() { 285 CXXMethodDecl* RecordInfo::InheritsNonVirtualTrace() {
286 if (CXXMethodDecl* trace = GetTraceMethod()) 286 if (CXXMethodDecl* trace = GetTraceMethod())
287 return trace->isVirtual() ? 0 : trace; 287 return trace->isVirtual() ? 0 : trace;
288 for (Bases::iterator it = GetBases().begin(); it != GetBases().end(); ++it) { 288 for (Bases::iterator it = GetBases().begin(); it != GetBases().end(); ++it) {
289 if (CXXMethodDecl* trace = it->second.info()->InheritsNonVirtualTrace()) 289 if (CXXMethodDecl* trace = it->second.info()->InheritsNonVirtualTrace())
(...skipping 26 matching lines...) Expand all
316 if (!record_->hasDefinition()) 316 if (!record_->hasDefinition())
317 return bases; 317 return bases;
318 for (CXXRecordDecl::base_class_iterator it = record_->bases_begin(); 318 for (CXXRecordDecl::base_class_iterator it = record_->bases_begin();
319 it != record_->bases_end(); 319 it != record_->bases_end();
320 ++it) { 320 ++it) {
321 const CXXBaseSpecifier& spec = *it; 321 const CXXBaseSpecifier& spec = *it;
322 RecordInfo* info = cache_->Lookup(spec.getType()); 322 RecordInfo* info = cache_->Lookup(spec.getType());
323 if (!info) 323 if (!info)
324 continue; 324 continue;
325 CXXRecordDecl* base = info->record(); 325 CXXRecordDecl* base = info->record();
326 TracingStatus status = info->InheritsNonPureTrace() 326 TracingStatus status = info->InheritsTrace()
327 ? TracingStatus::Needed() 327 ? TracingStatus::Needed()
328 : TracingStatus::Unneeded(); 328 : TracingStatus::Unneeded();
329 bases->insert(std::make_pair(base, BasePoint(spec, info, status))); 329 bases->insert(std::make_pair(base, BasePoint(spec, info, status)));
330 } 330 }
331 return bases; 331 return bases;
332 } 332 }
333 333
334 RecordInfo::Fields& RecordInfo::GetFields() { 334 RecordInfo::Fields& RecordInfo::GetFields() {
335 if (!fields_) 335 if (!fields_)
336 fields_ = CollectFields(); 336 fields_ = CollectFields();
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 edge->members().push_back(member); 516 edge->members().push_back(member);
517 } 517 }
518 // TODO: Handle the case where we fail to create an edge (eg, if the 518 // TODO: Handle the case where we fail to create an edge (eg, if the
519 // argument is a primitive type or just not fully known yet). 519 // argument is a primitive type or just not fully known yet).
520 } 520 }
521 return edge; 521 return edge;
522 } 522 }
523 523
524 return new Value(info); 524 return new Value(info);
525 } 525 }
OLDNEW
« no previous file with comments | « tools/clang/blink_gc_plugin/RecordInfo.h ('k') | tools/clang/blink_gc_plugin/tests/pure_virtual_trace.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698