llvm.org GIT mirror llvm / 22b4918
Deprecate IntrusiveRefCntPtr::getPtr() in favour of get() This better aligns with other LLVM-specific and C++ standard library smart pointer types. In particular there are at least a few uses of intrusive refcounting in the frontend where it's worth investigating std::shared_ptr as a more appropriate alternative. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212366 91177308-0d34-0410-b5e6-96231b3b80d8 Alp Toker 6 years ago
1 changed file(s) with 13 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
153153 }
154154
155155 template
156 IntrusiveRefCntPtr(IntrusiveRefCntPtr&& S) : Obj(S.getPtr()) {
156 IntrusiveRefCntPtr(IntrusiveRefCntPtr&& S) : Obj(S.get()) {
157157 S.Obj = 0;
158158 }
159159
160160 template
161161 IntrusiveRefCntPtr(const IntrusiveRefCntPtr& S)
162 : Obj(S.getPtr()) {
162 : Obj(S.get()) {
163163 retain();
164164 }
165165
174174
175175 T* operator->() const { return Obj; }
176176
177 T* get() const { return Obj; }
178
179 /// Deprecated: use get().
177180 T* getPtr() const { return Obj; }
178181
179182 LLVM_EXPLICIT operator bool() const { return Obj; }
202205 inline bool operator==(const IntrusiveRefCntPtr& A,
203206 const IntrusiveRefCntPtr& B)
204207 {
205 return A.getPtr() == B.getPtr();
208 return A.get() == B.get();
206209 }
207210
208211 template
209212 inline bool operator!=(const IntrusiveRefCntPtr& A,
210213 const IntrusiveRefCntPtr& B)
211214 {
212 return A.getPtr() != B.getPtr();
215 return A.get() != B.get();
213216 }
214217
215218 template
216219 inline bool operator==(const IntrusiveRefCntPtr& A,
217220 U* B)
218221 {
219 return A.getPtr() == B;
222 return A.get() == B;
220223 }
221224
222225 template
223226 inline bool operator!=(const IntrusiveRefCntPtr& A,
224227 U* B)
225228 {
226 return A.getPtr() != B;
229 return A.get() != B;
227230 }
228231
229232 template
230233 inline bool operator==(T* A,
231234 const IntrusiveRefCntPtr& B)
232235 {
233 return A == B.getPtr();
236 return A == B.get();
234237 }
235238
236239 template
237240 inline bool operator!=(T* A,
238241 const IntrusiveRefCntPtr& B)
239242 {
240 return A != B.getPtr();
243 return A != B.get();
241244 }
242245
243246 template
267270 template struct simplify_type > {
268271 typedef T* SimpleType;
269272 static SimpleType getSimplifiedValue(IntrusiveRefCntPtr& Val) {
270 return Val.getPtr();
273 return Val.get();
271274 }
272275 };
273276
274277 template struct simplify_type > {
275278 typedef /*const*/ T* SimpleType;
276279 static SimpleType getSimplifiedValue(const IntrusiveRefCntPtr& Val) {
277 return Val.getPtr();
280 return Val.get();
278281 }
279282 };
280283