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

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

Issue 273873002: Blink GC plugin: require a trace method if a class derives multiple bases that need tracing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 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 a7c9a756bfaa057da957be5e6193095121bca440..c766d28a54bfa67ee0fef72daba9f7e771ec8b73 100644
--- a/tools/clang/blink_gc_plugin/RecordInfo.cpp
+++ b/tools/clang/blink_gc_plugin/RecordInfo.cpp
@@ -240,10 +240,18 @@ CXXMethodDecl* RecordInfo::DeclaresNewOperator() {
return 0;
}
-// An object requires a tracing method if it has any fields that need tracing.
+// An object requires a tracing method if it has any fields that need tracing
+// or if it inherits from multiple bases that need tracing.
bool RecordInfo::RequiresTraceMethod() {
if (IsStackAllocated())
return false;
+ unsigned bases_with_trace = 0;
+ for (Bases::iterator it = GetBases().begin(); it != GetBases().end(); ++it) {
+ if (it->second.NeedsTracing().IsNeeded())
+ ++bases_with_trace;
+ }
+ if (bases_with_trace > 1)
+ return true;
GetFields();
return fields_need_tracing_.IsNeeded();
}
« no previous file with comments | « tools/clang/blink_gc_plugin/RecordInfo.h ('k') | tools/clang/blink_gc_plugin/tests/class_multiple_trace_bases.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698