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

Side by Side Diff: tools/clang/blink_gc_plugin/tests/heap/stubs.h

Issue 2588943002: Disallow heap objects containing unsafe on-heap iterators. (Closed)
Patch Set: formatting Created 4 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef HEAP_STUBS_H_ 5 #ifndef HEAP_STUBS_H_
6 #define HEAP_STUBS_H_ 6 #define HEAP_STUBS_H_
7 7
8 #include "stddef.h" 8 #include "stddef.h"
9 9
10 #define WTF_MAKE_FAST_ALLOCATED \ 10 #define WTF_MAKE_FAST_ALLOCATED \
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 template<> 61 template<>
62 class VectorDestructorBase<0, true, true> {}; 62 class VectorDestructorBase<0, true, true> {};
63 63
64 template< 64 template<
65 typename T, 65 typename T,
66 size_t inlineCapacity = 0, 66 size_t inlineCapacity = 0,
67 typename Allocator = DefaultAllocator> 67 typename Allocator = DefaultAllocator>
68 class Vector : public VectorDestructorBase<inlineCapacity, 68 class Vector : public VectorDestructorBase<inlineCapacity,
69 Allocator::isGarbageCollected, 69 Allocator::isGarbageCollected,
70 VectorTraits<T>::needsDestruction> { 70 VectorTraits<T>::needsDestruction> {
71 public: 71 public:
72 size_t size(); 72 using iterator = T*;
73 T& operator[](size_t); 73 using const_iterator = const T*;
74 using reverse_iterator = T*;
75 using const_reverse_iterator = const T*;
76
77 size_t size();
78 T& operator[](size_t);
79 };
80
81 template <typename T,
82 size_t inlineCapacity = 0,
83 typename Allocator = DefaultAllocator>
84 class Deque {
85 public:
86 using iterator = T*;
87 using const_iterator = const T*;
88 using reverse_iterator = T*;
89 using const_reverse_iterator = const T*;
90 };
91
92 template <typename ValueArg,
93 typename HashArg = void,
94 typename TraitsArg = void,
95 typename Allocator = DefaultAllocator>
96 class HashSet {
97 public:
98 typedef ValueArg* iterator;
99 typedef const ValueArg* const_iterator;
100 typedef ValueArg* reverse_iterator;
101 typedef const ValueArg* const_reverse_iterator;
102 };
103
104 template <typename ValueArg,
105 typename HashArg = void,
106 typename TraitsArg = void,
107 typename Allocator = DefaultAllocator>
108 class ListHashSet {
109 public:
110 typedef ValueArg* iterator;
111 typedef const ValueArg* const_iterator;
112 typedef ValueArg* reverse_iterator;
113 typedef const ValueArg* const_reverse_iterator;
114 };
115
116 template <typename ValueArg,
117 typename HashArg = void,
118 typename TraitsArg = void,
119 typename Allocator = DefaultAllocator>
120 class LinkedHashSet {
121 public:
122 typedef ValueArg* iterator;
123 typedef const ValueArg* const_iterator;
124 typedef ValueArg* reverse_iterator;
125 typedef const ValueArg* const_reverse_iterator;
74 }; 126 };
75 127
76 template< 128 template<
77 typename T,
78 size_t inlineCapacity = 0,
79 typename Allocator = DefaultAllocator>
80 class Deque {};
81
82 template<
83 typename ValueArg, 129 typename ValueArg,
84 typename HashArg = void,
85 typename TraitsArg = void,
86 typename Allocator = DefaultAllocator>
87 class HashSet {};
88
89 template<
90 typename ValueArg,
91 typename HashArg = void,
92 typename TraitsArg = void,
93 typename Allocator = DefaultAllocator>
94 class ListHashSet {};
95
96 template<
97 typename ValueArg,
98 typename HashArg = void,
99 typename TraitsArg = void,
100 typename Allocator = DefaultAllocator>
101 class LinkedHashSet {};
102
103 template<
104 typename ValueArg,
105 typename HashArg = void, 130 typename HashArg = void,
106 typename TraitsArg = void, 131 typename TraitsArg = void,
107 typename Allocator = DefaultAllocator> 132 typename Allocator = DefaultAllocator>
108 class HashCountedSet {}; 133 class HashCountedSet {};
109 134
110 template< 135 template <typename KeyArg,
111 typename KeyArg, 136 typename MappedArg,
112 typename MappedArg, 137 typename HashArg = void,
113 typename HashArg = void, 138 typename KeyTraitsArg = void,
114 typename KeyTraitsArg = void, 139 typename MappedTraitsArg = void,
115 typename MappedTraitsArg = void, 140 typename Allocator = DefaultAllocator>
116 typename Allocator = DefaultAllocator> 141 class HashMap {
117 class HashMap {}; 142 public:
118 143 typedef MappedArg* iterator;
144 typedef const MappedArg* const_iterator;
145 typedef MappedArg* reverse_iterator;
146 typedef const MappedArg* const_reverse_iterator;
147 };
119 } 148 }
120 149
121 // Empty namespace declaration to exercise internal 150 // Empty namespace declaration to exercise internal
122 // handling of namespace equality. 151 // handling of namespace equality.
123 namespace std { 152 namespace std {
124 /* empty */ 153 /* empty */
125 } 154 }
126 155
127 namespace std { 156 namespace std {
128 157
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 namespace WTF { 315 namespace WTF {
287 316
288 template<typename T> 317 template<typename T>
289 struct VectorTraits<blink::Member<T> > { 318 struct VectorTraits<blink::Member<T> > {
290 static const bool needsDestruction = false; 319 static const bool needsDestruction = false;
291 }; 320 };
292 321
293 } 322 }
294 323
295 #endif 324 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698