1 // RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UncountedCallArgsChecker -verify %s 2 // expected-no-diagnostics 3 4 #include "mock-types.h" 5 6 template <typename T> struct RefAllowingPartiallyDestroyed { 7 T *t; 8 RefAllowingPartiallyDestroyedRefAllowingPartiallyDestroyed9 RefAllowingPartiallyDestroyed() : t{} {}; RefAllowingPartiallyDestroyedRefAllowingPartiallyDestroyed10 RefAllowingPartiallyDestroyed(T &) {} getRefAllowingPartiallyDestroyed11 T *get() { return t; } ptrRefAllowingPartiallyDestroyed12 T *ptr() { return t; } operator ->RefAllowingPartiallyDestroyed13 T *operator->() { return t; } operator const T&RefAllowingPartiallyDestroyed14 operator const T &() const { return *t; } operator T&RefAllowingPartiallyDestroyed15 operator T &() { return *t; } 16 }; 17 18 template <typename T> struct RefPtrAllowingPartiallyDestroyed { 19 T *t; 20 RefPtrAllowingPartiallyDestroyedRefPtrAllowingPartiallyDestroyed21 RefPtrAllowingPartiallyDestroyed() : t(new T) {} RefPtrAllowingPartiallyDestroyedRefPtrAllowingPartiallyDestroyed22 RefPtrAllowingPartiallyDestroyed(T *t) : t(t) {} getRefPtrAllowingPartiallyDestroyed23 T *get() { return t; } operator ->RefPtrAllowingPartiallyDestroyed24 T *operator->() { return t; } operator ->RefPtrAllowingPartiallyDestroyed25 const T *operator->() const { return t; } operator *RefPtrAllowingPartiallyDestroyed26 T &operator*() { return *t; } operator =RefPtrAllowingPartiallyDestroyed27 RefPtrAllowingPartiallyDestroyed &operator=(T *) { return *this; } operator boolRefPtrAllowingPartiallyDestroyed28 operator bool() { return t; } 29 }; 30 31 class RefCounted { 32 public: 33 void ref() const; 34 void deref() const; 35 void someFunction(); 36 }; 37 38 RefAllowingPartiallyDestroyed<RefCounted> object1(); 39 RefPtrAllowingPartiallyDestroyed<RefCounted> object2(); 40 testFunction()41void testFunction() { 42 object1()->someFunction(); 43 object2()->someFunction(); 44 } 45