chromium/tools/clang/rewrite_scoped_refptr/tests/test9-expected.cc

// Copyright 2013 The Chromium Authors
// 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.get(); }
};

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().get());
}

void CallsRawWithMemberRawPtr() {
  HasAScopedRefptr object;
  ExpectsRawPtr(object.GetMemberAsRawPtr());
}

void CallsScopedWithMemberScopedRefptr() {
  HasAScopedRefptr object;
  ExpectsScopedRefptr(object.GetMemberAsScopedRefptr());
}

void CallsScopedWithMemberRawPtr() {
  HasAScopedRefptr object;
  ExpectsScopedRefptr(object.GetMemberAsScopedRefptr());
}