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/tests/stack_allocated.h

Issue 206123004: Add checks for stack-allocated types and their uses in fields. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 9 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 8fe3241053ce9b88be142ec6dd065c9e87ca9a79..b1839b71e8ae4be0dbfd4480cd634f4ab42253da 100644
--- a/tools/clang/blink_gc_plugin/tests/stack_allocated.h
+++ b/tools/clang/blink_gc_plugin/tests/stack_allocated.h
@@ -9,7 +9,7 @@
namespace WebCore {
-class HeapObject : public GarbageCollected<HeapObject> { };
+class HeapObject;
class PartObject {
DISALLOW_ALLOCATION();
@@ -23,6 +23,25 @@ private:
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*);
+private:
+ StackObject m_part; // Cannot embed a stack allocated object.
+};
+
+// STACK_ALLOCATED is inherited.
+class DerivedStackObject : public StackObject {
+private:
+ AnotherStackObject m_anotherPart; // Also fine.
+};
+
}
#endif
« no previous file with comments | « tools/clang/blink_gc_plugin/tests/heap/stubs.h ('k') | tools/clang/blink_gc_plugin/tests/stack_allocated.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698