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

Unified Diff: tools/clang/blink_gc_plugin/RecordInfo.cpp

Issue 1158623002: Extend destructor checks to account for eagerly finalized class types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updated to look for IsEagerlyFinalizedMarker instead Created 5 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 side-by-side diff with in-line comments
Download patch
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))
« no previous file with comments | « tools/clang/blink_gc_plugin/RecordInfo.h ('k') | tools/clang/blink_gc_plugin/tests/destructor_eagerly_finalized.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698