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 #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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 return fields_need_tracing_; | 577 return fields_need_tracing_; |
578 } | 578 } |
579 | 579 |
580 Edge* RecordInfo::CreateEdge(const Type* type) { | 580 Edge* RecordInfo::CreateEdge(const Type* type) { |
581 if (!type) { | 581 if (!type) { |
582 return 0; | 582 return 0; |
583 } | 583 } |
584 | 584 |
585 if (type->isPointerType() || type->isReferenceType()) { | 585 if (type->isPointerType() || type->isReferenceType()) { |
586 if (Edge* ptr = CreateEdge(type->getPointeeType().getTypePtrOrNull())) | 586 if (Edge* ptr = CreateEdge(type->getPointeeType().getTypePtrOrNull())) |
587 return new RawPtr(ptr, false, type->isReferenceType()); | 587 return new RawPtr(ptr, type->isReferenceType()); |
588 return 0; | 588 return 0; |
589 } | 589 } |
590 | 590 |
591 RecordInfo* info = cache_->Lookup(type); | 591 RecordInfo* info = cache_->Lookup(type); |
592 | 592 |
593 // If the type is neither a pointer or a C++ record we ignore it. | 593 // If the type is neither a pointer or a C++ record we ignore it. |
594 if (!info) { | 594 if (!info) { |
595 return 0; | 595 return 0; |
596 } | 596 } |
597 | 597 |
598 TemplateArgs args; | 598 TemplateArgs args; |
599 | 599 |
600 if (Config::IsRawPtr(info->name()) && info->GetTemplateArgs(1, &args)) { | |
601 if (Edge* ptr = CreateEdge(args[0])) | |
602 return new RawPtr(ptr, true, false); | |
603 return 0; | |
604 } | |
605 | |
606 if (Config::IsRefPtr(info->name()) && info->GetTemplateArgs(1, &args)) { | 600 if (Config::IsRefPtr(info->name()) && info->GetTemplateArgs(1, &args)) { |
607 if (Edge* ptr = CreateEdge(args[0])) | 601 if (Edge* ptr = CreateEdge(args[0])) |
608 return new RefPtr(ptr); | 602 return new RefPtr(ptr); |
609 return 0; | 603 return 0; |
610 } | 604 } |
611 | 605 |
612 if (Config::IsOwnPtr(info->name()) && info->GetTemplateArgs(1, &args)) { | 606 if (Config::IsOwnPtr(info->name()) && info->GetTemplateArgs(1, &args)) { |
613 if (Edge* ptr = CreateEdge(args[0])) | 607 if (Edge* ptr = CreateEdge(args[0])) |
614 return new OwnPtr(ptr); | 608 return new OwnPtr(ptr); |
615 return 0; | 609 return 0; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 edge->members().push_back(member); | 648 edge->members().push_back(member); |
655 } | 649 } |
656 // TODO: Handle the case where we fail to create an edge (eg, if the | 650 // TODO: Handle the case where we fail to create an edge (eg, if the |
657 // argument is a primitive type or just not fully known yet). | 651 // argument is a primitive type or just not fully known yet). |
658 } | 652 } |
659 return edge; | 653 return edge; |
660 } | 654 } |
661 | 655 |
662 return new Value(info); | 656 return new Value(info); |
663 } | 657 } |
OLD | NEW |