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

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

Issue 2323463002: [blink_gc_plugin] Complain about stack-allocated classes with GC bases, but not arbitrary non-stack… (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « no previous file | tools/clang/blink_gc_plugin/DiagnosticsReporter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/clang/blink_gc_plugin/BlinkGCPluginConsumer.cpp
diff --git a/tools/clang/blink_gc_plugin/BlinkGCPluginConsumer.cpp b/tools/clang/blink_gc_plugin/BlinkGCPluginConsumer.cpp
index ca6bb18a04ab467dce61120d7b8c773bccdb2236..ba5ba4a999980bca83dcf5498b11053ae8aed510 100644
--- a/tools/clang/blink_gc_plugin/BlinkGCPluginConsumer.cpp
+++ b/tools/clang/blink_gc_plugin/BlinkGCPluginConsumer.cpp
@@ -177,13 +177,6 @@ void BlinkGCPluginConsumer::CheckClass(RecordInfo* info) {
if (!info)
return;
- // Check consistency of stack-allocated hierarchies.
- if (info->IsStackAllocated()) {
- for (auto& base : info->GetBases())
- if (!base.second.info()->IsStackAllocated())
- reporter_.DerivesNonStackAllocated(info, &base.second);
- }
-
if (CXXMethodDecl* trace = info->GetTraceMethod()) {
if (trace->isPure())
reporter_.ClassDeclaresPureVirtualTrace(info, trace);
@@ -206,6 +199,17 @@ void BlinkGCPluginConsumer::CheckClass(RecordInfo* info) {
}
if (info->IsGCDerived()) {
+ // It is illegal for a class to be both stack allocated and garbage
+ // collected.
+ if (info->IsStackAllocated()) {
+ for (auto& base : info->GetBases()) {
+ RecordInfo* base_info = base.second.info();
+ if (Config::IsGCBase(base_info->name()) || base_info->IsGCDerived()) {
+ reporter_.StackAllocatedDerivesGarbageCollected(info, &base.second);
+ }
+ }
+ }
+
if (!info->IsGCMixin()) {
CheckLeftMostDerived(info);
CheckDispatch(info);
« no previous file with comments | « no previous file | tools/clang/blink_gc_plugin/DiagnosticsReporter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698