| 1 |
// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UncountedCallArgsChecker -verify %s |
| 2 |
|
| 3 |
#include "mock-types.h" |
| 4 |
|
| 5 |
class Obj { |
| 6 |
public: |
| 7 |
static Obj* get(); |
| 8 |
static RefPtr<Obj> create(); |
| 9 |
void ref() const; |
| 10 |
void deref() const; |
| 11 |
}; |
| 12 |
|
| 13 |
void someFunction(Obj*, Obj* = nullptr); |
| 14 |
void otherFunction(Obj*, Obj* = Obj::get()); |
| 15 |
// expected-warning@-1{{Call argument is uncounted and unsafe [alpha.webkit.UncountedCallArgsChecker]}} |
| 16 |
void anotherFunction(Obj*, Obj* = Obj::create().get()); |
| 17 |
|
| 18 |
void otherFunction() { |
| 19 |
someFunction(nullptr); |
| 20 |
someFunction(Obj::get()); |
| 21 |
// expected-warning@-1{{Call argument is uncounted and unsafe [alpha.webkit.UncountedCallArgsChecker]}} |
| 22 |
someFunction(Obj::create().get()); |
| 23 |
otherFunction(nullptr); |
| 24 |
anotherFunction(nullptr); |
| 25 |
} |