Index: tools/clang/blink_gc_plugin/RecordInfo.cpp |
diff --git a/tools/clang/blink_gc_plugin/RecordInfo.cpp b/tools/clang/blink_gc_plugin/RecordInfo.cpp |
index bda33fa992fb5cd92a907fcbb8d9b1c18c94a61b..516a40a04daec50f420e1262ef2cff2d4a349202 100644 |
--- a/tools/clang/blink_gc_plugin/RecordInfo.cpp |
+++ b/tools/clang/blink_gc_plugin/RecordInfo.cpp |
@@ -21,6 +21,7 @@ RecordInfo::RecordInfo(CXXRecordDecl* record, RecordCache* cache) |
does_need_finalization_(kNotComputed), |
has_gc_mixin_methods_(kNotComputed), |
is_declaring_local_trace_(kNotComputed), |
+ is_eagerly_finalized_(kNotComputed), |
determined_trace_methods_(false), |
trace_method_(0), |
trace_dispatch_method_(0), |
@@ -168,6 +169,27 @@ bool RecordInfo::IsGCAllocated() { |
return IsGCDerived() || IsHeapAllocatedCollection(); |
} |
+bool RecordInfo::IsEagerlyFinalized() { |
+ if (is_eagerly_finalized_ == kNotComputed) { |
+ is_eagerly_finalized_ = kFalse; |
+ if (IsGCFinalized()) { |
+ for (Decl* decl : record_->decls()) { |
+ if (TypedefDecl* typedef_decl = dyn_cast<TypedefDecl>(decl)) { |
+ if (typedef_decl->getNameAsString() == kIsEagerlyFinalizedName) { |
+ is_eagerly_finalized_ = kTrue; |
+ break; |
+ } |
+ } |
+ } |
+ } |
+ } |
+ return is_eagerly_finalized_; |
+} |
+ |
+bool RecordInfo::HasDefinition() { |
+ return record_->hasDefinition(); |
+} |
+ |
RecordInfo* RecordCache::Lookup(CXXRecordDecl* record) { |
// Ignore classes annotated with the GC_PLUGIN_IGNORE macro. |
if (!record || Config::IsIgnoreAnnotated(record)) |
@@ -570,9 +592,9 @@ Edge* RecordInfo::CreateEdge(const Type* type) { |
return 0; |
} |
- if (type->isPointerType()) { |
+ if (type->isPointerType() || type->isReferenceType()) { |
if (Edge* ptr = CreateEdge(type->getPointeeType().getTypePtrOrNull())) |
- return new RawPtr(ptr, false); |
+ return new RawPtr(ptr, false, type->isReferenceType()); |
return 0; |
} |
@@ -587,7 +609,7 @@ Edge* RecordInfo::CreateEdge(const Type* type) { |
if (Config::IsRawPtr(info->name()) && info->GetTemplateArgs(1, &args)) { |
if (Edge* ptr = CreateEdge(args[0])) |
- return new RawPtr(ptr, true); |
+ return new RawPtr(ptr, true, false); |
return 0; |
} |