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