1 // RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UncountedCallArgsChecker -verify %s
3 #include "mock-types.h"
8 namespace call_args_const_refptr_member
{
16 const RefPtr
<RefCountable
> m_obj1
;
17 RefPtr
<RefCountable
> m_obj2
;
23 // expected-warning@-1{{Call argument for 'this' parameter is uncounted and unsafe}}
26 } // namespace call_args_const_refptr_member
28 namespace call_args_const_ref_member
{
36 const Ref
<RefCountable
> m_obj1
;
37 Ref
<RefCountable
> m_obj2
;
43 // expected-warning@-1{{Call argument for 'this' parameter is uncounted and unsafe}}
46 } // namespace call_args_const_ref_member
48 namespace call_args_const_unique_ptr
{
55 RefCountable
& ensureObj3() {
57 const_cast<std::unique_ptr
<RefCountable
>&>(m_obj3
) = RefCountable::makeUnique();
61 RefCountable
& badEnsureObj4() {
63 const_cast<std::unique_ptr
<RefCountable
>&>(m_obj4
) = RefCountable::makeUnique();
64 if (auto* next
= m_obj4
->next())
69 RefCountable
* ensureObj5() {
71 const_cast<std::unique_ptr
<RefCountable
>&>(m_obj5
) = RefCountable::makeUnique();
78 const std::unique_ptr
<RefCountable
> m_obj1
;
79 std::unique_ptr
<RefCountable
> m_obj2
;
80 const std::unique_ptr
<RefCountable
> m_obj3
;
81 const std::unique_ptr
<RefCountable
> m_obj4
;
82 const std::unique_ptr
<RefCountable
> m_obj5
;
88 // expected-warning@-1{{Call argument for 'this' parameter is uncounted and unsafe}}
89 ensureObj3().method();
90 badEnsureObj4().method();
91 // expected-warning@-1{{Call argument for 'this' parameter is uncounted and unsafe}}
92 ensureObj5()->method();
95 } // namespace call_args_const_unique_ptr
97 namespace call_args_const_unique_ref
{
105 const UniqueRef
<RefCountable
> m_obj1
;
106 UniqueRef
<RefCountable
> m_obj2
;
112 // expected-warning@-1{{Call argument for 'this' parameter is uncounted and unsafe}}
115 } // namespace call_args_const_unique_ref