commit | 5cc177589751a7196ad4bbe3c15fee1006c52aec | [log] [tgz] |
---|---|---|
author | [email protected] <[email protected]@0039d316-1c4b-4281-b951-d872f2087c98> | Mon Aug 11 21:26:05 2014 |
committer | [email protected] <[email protected]@0039d316-1c4b-4281-b951-d872f2087c98> | Mon Aug 11 21:27:37 2014 |
tree | 046e7b48868e4e7317c09836c5bc3c6fe59ea558 | |
parent | 0df485fda68e92d779ad7f49ffa2064ebc48188b [diff] [blame] |
Implement rewrite logic for assigning a temporary scoped_refptr to T*. This is always potentially dangerous. For example: scoped_refptr<Foo> CreateFoo(); void BuggyFunction() { Foo* x = CreateFoo(); // x now points to a deleted object. } In these cases, the tool prefers to rewrite the declaration type to scoped_refptr<T> instead of adding an explicit conversion to T* with get(). BUG=110610 [email protected], [email protected] Review URL: https://codereview.chromium.org/453873002 Cr-Commit-Position: refs/heads/master@{#288795} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288795 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/tools/clang/rewrite_scoped_refptr/tests/test11-expected.cc b/tools/clang/rewrite_scoped_refptr/tests/test11-expected.cc index de4c01ca..4557b52 100644 --- a/tools/clang/rewrite_scoped_refptr/tests/test11-expected.cc +++ b/tools/clang/rewrite_scoped_refptr/tests/test11-expected.cc
@@ -17,6 +17,8 @@ list.push_back(new Foo); list.push_back(new Foo); for (FooList::const_iterator it = list.begin(); it != list.end(); ++it) { + if (!it->get()) + continue; Foo* item = it->get(); } }