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

Unified Diff: tools/clang/rewrite_scoped_ptr_ctor_null/tests/test-original.cc

Issue 16606002: Tool to fix calls to scoped_ptr<T>(NULL) to use the default ctor instead (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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_ptr_ctor_null/tests/test-original.cc
diff --git a/tools/clang/rewrite_scoped_ptr_ctor_null/tests/test-original.cc b/tools/clang/rewrite_scoped_ptr_ctor_null/tests/test-original.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4fb3f2e28c4d8059946aa6c073169ce3a63898ab
--- /dev/null
+++ b/tools/clang/rewrite_scoped_ptr_ctor_null/tests/test-original.cc
@@ -0,0 +1,35 @@
+// 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 "base/memory/scoped_ptr.h"
+
+void TestDeclarations() {
+ scoped_ptr<int> a(NULL), b(new int), c(NULL);
+ scoped_ptr_malloc<int> d(NULL);
+}
+
+void TestNew() {
+ scoped_ptr<int>* a = new scoped_ptr<int>(NULL),
Nico 2013/06/11 19:58:13 Do you want to check `scoped_ptr<int>( (NULL) )` s
dcheng 2013/06/11 20:07:41 I think that's covered by lines 30-33?
+ *b = new scoped_ptr<int>(new int),
+ *c = new scoped_ptr<int>(NULL);
+}
+
+class TestInitializers {
+ public:
+ TestInitializers() : a(NULL) {}
+ TestInitializers(bool) : a(NULL), b(NULL) {}
+ TestInitializers(double) : a(NULL), b(new int), c() {}
+
+ private:
+ scoped_ptr<int> a;
+ scoped_ptr<int> b;
+ scoped_ptr<int> c;
+};
+
+scoped_ptr<int> TestTemporaries(scoped_ptr<int> a, scoped_ptr<int> b) {
+ scoped_ptr<int> c =
+ TestTemporaries(scoped_ptr<int>(NULL), scoped_ptr<int>(new int));
+ return scoped_ptr<int>(NULL);
+}
+

Powered by Google App Engine
This is Rietveld 408576698