File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
lib/StaticAnalyzer/Checkers/WebKit
test/Analysis/Checkers/WebKit Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,9 @@ class UncountedCallArgsChecker
91
91
92
92
const auto *Arg = CE->getArg (ArgIdx);
93
93
94
+ if (auto *defaultArg = dyn_cast<CXXDefaultArgExpr>(Arg))
95
+ Arg = defaultArg->getExpr ();
96
+
94
97
std::pair<const clang::Expr *, bool > ArgOrigin =
95
98
tryToFindPtrOrigin (Arg, true );
96
99
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments