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

Unified Diff: tools/clang/rewrite_scoped_refptr/tests/test9-original.cc

Issue 446203003: scoped_refptr implicit conversion cleanup tool. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 6 years, 4 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
« no previous file with comments | « tools/clang/rewrite_scoped_refptr/tests/test9-expected.cc ('k') | tools/clang/scripts/run_tool.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/clang/rewrite_scoped_refptr/tests/test9-original.cc
diff --git a/tools/clang/rewrite_scoped_refptr/tests/test9-original.cc b/tools/clang/rewrite_scoped_refptr/tests/test9-original.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e59ed6e9e10a82dced821bf27325fedea8609045
--- /dev/null
+++ b/tools/clang/rewrite_scoped_refptr/tests/test9-original.cc
@@ -0,0 +1,45 @@
+// 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.
+
+#include "scoped_refptr.h"
+
+struct Foo {
+ int dummy;
+};
+
+struct HasAScopedRefptr {
+ scoped_refptr<Foo> member;
+
+ const scoped_refptr<Foo>& GetMemberAsScopedRefptr() const { return member; }
+
+ Foo* GetMemberAsRawPtr() const { return member; }
+};
+
+void ExpectsRawPtr(Foo* param) {
+ Foo* temp = param;
+}
+
+void ExpectsScopedRefptr(const scoped_refptr<Foo>& param) {
+ Foo* temp = param.get();
+}
+
+void CallsRawWithMemberScopedRefptr() {
+ HasAScopedRefptr object;
+ ExpectsRawPtr(object.GetMemberAsScopedRefptr());
+}
+
+void CallsRawWithMemberRawPtr() {
+ HasAScopedRefptr object;
+ ExpectsRawPtr(object.GetMemberAsRawPtr());
+}
+
+void CallsScopedWithMemberScopedRefptr() {
+ HasAScopedRefptr object;
+ ExpectsScopedRefptr(object.GetMemberAsScopedRefptr());
+}
+
+void CallsScopedWithMemberRawPtr() {
+ HasAScopedRefptr object;
+ ExpectsScopedRefptr(object.GetMemberAsScopedRefptr());
+}
« no previous file with comments | « tools/clang/rewrite_scoped_refptr/tests/test9-expected.cc ('k') | tools/clang/scripts/run_tool.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698