16e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// Copyright (c) 2013 The Chromium Authors. All rights reserved. 26e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 36e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// found in the LICENSE file. 46e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 56e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)#include "scoped_refptr.h" 66e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 76e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)struct Foo { 86e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) int dummy; 96e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)}; 106e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) 116e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// A temporary scoped_refptr<T> is used in a boolean test. This doesn't result 126e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// in memory safety issues, but probably indicates a code smell. As such, the 136e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)// tool intentionally skips this case so it can be manually handled. 146e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)scoped_refptr<Foo> GetBuggyFoo() { 156e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) return new Foo; 166e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)} 176e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)void UseBuggyFoo() { 186e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) if (GetBuggyFoo()) 196e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles) return; 206e8cce623b6e4fe0c9e4af605d675dd9d0338c38Torne (Richard Coles)} 21