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..6e591a5484584987a9e326377e29be0641772a88 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,23 @@ 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_; |
+} |
+ |
RecordInfo* RecordCache::Lookup(CXXRecordDecl* record) { |
// Ignore classes annotated with the GC_PLUGIN_IGNORE macro. |
if (!record || Config::IsIgnoreAnnotated(record)) |