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

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

Issue 1274403002: GC plugin: consider references equal to raw pointers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Propagate reference type into error/warning messages Created 5 years, 4 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
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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 GetFields(); 585 GetFields();
586 586
587 return fields_need_tracing_; 587 return fields_need_tracing_;
588 } 588 }
589 589
590 Edge* RecordInfo::CreateEdge(const Type* type) { 590 Edge* RecordInfo::CreateEdge(const Type* type) {
591 if (!type) { 591 if (!type) {
592 return 0; 592 return 0;
593 } 593 }
594 594
595 if (type->isPointerType()) { 595 if (type->isPointerType() || type->isReferenceType()) {
596 if (Edge* ptr = CreateEdge(type->getPointeeType().getTypePtrOrNull())) 596 if (Edge* ptr = CreateEdge(type->getPointeeType().getTypePtrOrNull()))
597 return new RawPtr(ptr, false); 597 return new RawPtr(ptr, false, type->isReferenceType());
598 return 0; 598 return 0;
599 } 599 }
600 600
601 RecordInfo* info = cache_->Lookup(type); 601 RecordInfo* info = cache_->Lookup(type);
602 602
603 // If the type is neither a pointer or a C++ record we ignore it. 603 // If the type is neither a pointer or a C++ record we ignore it.
604 if (!info) { 604 if (!info) {
605 return 0; 605 return 0;
606 } 606 }
607 607
608 TemplateArgs args; 608 TemplateArgs args;
609 609
610 if (Config::IsRawPtr(info->name()) && info->GetTemplateArgs(1, &args)) { 610 if (Config::IsRawPtr(info->name()) && info->GetTemplateArgs(1, &args)) {
611 if (Edge* ptr = CreateEdge(args[0])) 611 if (Edge* ptr = CreateEdge(args[0]))
612 return new RawPtr(ptr, true); 612 return new RawPtr(ptr, true, false);
613 return 0; 613 return 0;
614 } 614 }
615 615
616 if (Config::IsRefPtr(info->name()) && info->GetTemplateArgs(1, &args)) { 616 if (Config::IsRefPtr(info->name()) && info->GetTemplateArgs(1, &args)) {
617 if (Edge* ptr = CreateEdge(args[0])) 617 if (Edge* ptr = CreateEdge(args[0]))
618 return new RefPtr(ptr); 618 return new RefPtr(ptr);
619 return 0; 619 return 0;
620 } 620 }
621 621
622 if (Config::IsOwnPtr(info->name()) && info->GetTemplateArgs(1, &args)) { 622 if (Config::IsOwnPtr(info->name()) && info->GetTemplateArgs(1, &args)) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 edge->members().push_back(member); 664 edge->members().push_back(member);
665 } 665 }
666 // TODO: Handle the case where we fail to create an edge (eg, if the 666 // TODO: Handle the case where we fail to create an edge (eg, if the
667 // argument is a primitive type or just not fully known yet). 667 // argument is a primitive type or just not fully known yet).
668 } 668 }
669 return edge; 669 return edge;
670 } 670 }
671 671
672 return new Value(info); 672 return new Value(info);
673 } 673 }
OLDNEW
« no previous file with comments | « tools/clang/blink_gc_plugin/Edge.h ('k') | tools/clang/blink_gc_plugin/tests/raw_ptr_to_gc_managed_class.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698