1 // RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UncheckedCallArgsChecker -verify %s
3 #include "mock-types.h"
5 namespace call_args_const_checkedptr_member
{
13 const CheckedPtr
<CheckedObj
> m_obj1
;
14 CheckedPtr
<CheckedObj
> m_obj2
;
20 // expected-warning@-1{{Call argument for 'this' parameter is unchecked and unsafe}}
23 } // namespace call_args_const_checkedptr_member
25 namespace call_args_const_checkedref_member
{
33 const CheckedRef
<CheckedObj
> m_obj1
;
34 CheckedRef
<CheckedObj
> m_obj2
;
40 // expected-warning@-1{{Call argument for 'this' parameter is unchecked and unsafe}}
43 } // namespace call_args_const_checkedref_member
45 namespace call_args_const_unique_ptr
{
52 CheckedObj
& ensureObj3() {
54 const_cast<std::unique_ptr
<CheckedObj
>&>(m_obj3
) = new CheckedObj
;
58 CheckedObj
& badEnsureObj4() {
60 const_cast<std::unique_ptr
<CheckedObj
>&>(m_obj4
) = new CheckedObj
;
61 if (auto* next
= m_obj4
->next())
66 CheckedObj
* ensureObj5() {
68 const_cast<std::unique_ptr
<CheckedObj
>&>(m_obj5
) = new CheckedObj
;
75 const std::unique_ptr
<CheckedObj
> m_obj1
;
76 std::unique_ptr
<CheckedObj
> m_obj2
;
77 const std::unique_ptr
<CheckedObj
> m_obj3
;
78 const std::unique_ptr
<CheckedObj
> m_obj4
;
79 const std::unique_ptr
<CheckedObj
> m_obj5
;
85 // expected-warning@-1{{Call argument for 'this' parameter is unchecked and unsafe}}
86 ensureObj3().method();
87 badEnsureObj4().method();
88 // expected-warning@-1{{Call argument for 'this' parameter is unchecked and unsafe}}
89 ensureObj5()->method();
92 } // namespace call_args_const_unique_ptr