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

Unified Diff: tools/clang/rewrite_scoped_refptr/tests/scoped_refptr.h

Issue 1385193002: Bisect clang Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 246985 Created 5 years, 2 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/rewrite_scoped_refptr/tests/scoped_refptr.h
diff --git a/tools/clang/rewrite_scoped_refptr/tests/scoped_refptr.h b/tools/clang/rewrite_scoped_refptr/tests/scoped_refptr.h
new file mode 100644
index 0000000000000000000000000000000000000000..1ebd323358b650ecef338a18ae3013407ee9d9f5
--- /dev/null
+++ b/tools/clang/rewrite_scoped_refptr/tests/scoped_refptr.h
@@ -0,0 +1,43 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SCOPED_REFPTR_H_
+#define SCOPED_REFPTR_H_
+
+// Stub scoped_refptr<T> class that supports an implicit cast to T*.
+template <class T>
+class scoped_refptr {
+ public:
+ typedef T element_type;
+ scoped_refptr() : ptr_(0) {}
+ scoped_refptr(T* p) : ptr_(p) {}
+ scoped_refptr(const scoped_refptr<T>& r) : ptr_(r.ptr_) {}
+
+ template <typename U>
+ scoped_refptr(const scoped_refptr<U>& r)
+ : ptr_(r.get()) {}
+
+ ~scoped_refptr() {}
+
+ T* get() const { return ptr_; }
+ operator T*() const { return ptr_; }
+ T* operator->() const { return ptr_; }
+
+ scoped_refptr<T>& operator=(T* p) {
+ ptr_ = p;
+ return *this;
+ }
+ scoped_refptr<T>& operator=(const scoped_refptr<T>& r) {
+ return *this = r.ptr_;
+ }
+ template <typename U>
+ scoped_refptr<T>& operator=(const scoped_refptr<U>& r) {
+ return *this = r.get();
+ }
+
+ protected:
+ T* ptr_;
+};
+
+#endif // SCOPED_REFPTR_H_

Powered by Google App Engine
This is Rietveld 408576698