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

Unified Diff: tools/clang/blink_gc_plugin/tests/stack_allocated.h

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
Index: tools/clang/blink_gc_plugin/tests/stack_allocated.h
diff --git a/tools/clang/blink_gc_plugin/tests/stack_allocated.h b/tools/clang/blink_gc_plugin/tests/stack_allocated.h
index 88c01ab174112f29f42d7f497052c9a70c44576d..10d8f41d16df2012c81c2d07d684f538854806b1 100644
--- a/tools/clang/blink_gc_plugin/tests/stack_allocated.h
+++ b/tools/clang/blink_gc_plugin/tests/stack_allocated.h
@@ -23,12 +23,6 @@ private:
Member<HeapObject> m_obj; // Does not need tracing.
};
-class AnotherStackObject : public PartObject { // Invalid base.
- STACK_ALLOCATED();
-private:
- StackObject m_part; // Can embed a stack allocated object.
-};
-
class HeapObject : public GarbageCollected<HeapObject> {
public:
void trace(Visitor*);
@@ -36,10 +30,19 @@ private:
StackObject m_part; // Cannot embed a stack allocated object.
};
+// Cannot derive from both heap- and stack-allocated objects.
+class DerivedHeapObject : public HeapObject, public StackObject {
+};
+
+// Cannot be stack-allocated and derive from a heap-allocated object.
+class DerivedHeapObject2 : public HeapObject {
+ STACK_ALLOCATED();
+};
+
// STACK_ALLOCATED is inherited.
class DerivedStackObject : public StackObject {
private:
- AnotherStackObject m_anotherPart; // Also fine.
+ StackObject m_anotherPart; // Also fine.
};
}
« no previous file with comments | « tools/clang/blink_gc_plugin/DiagnosticsReporter.cpp ('k') | tools/clang/blink_gc_plugin/tests/stack_allocated.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698