File tree Expand file tree Collapse file tree 3 files changed +30
-7
lines changed
lib/StaticAnalyzer/Checkers/WebKit
test/Analysis/Checkers/WebKit Expand file tree Collapse file tree 3 files changed +30
-7
lines changed Original file line number Diff line number Diff line change @@ -192,8 +192,9 @@ bool isPtrConversion(const FunctionDecl *F) {
192
192
// FIXME: check # of params == 1
193
193
const auto FunctionName = safeGetName (F);
194
194
if (FunctionName == " getPtr" || FunctionName == " WeakPtr" ||
195
- FunctionName == " dynamicDowncast"
196
- || FunctionName == " downcast" || FunctionName == " bitwise_cast" )
195
+ FunctionName == " dynamicDowncast" || FunctionName == " downcast" ||
196
+ FunctionName == " checkedDowncast" ||
197
+ FunctionName == " uncheckedDowncast" || FunctionName == " bitwise_cast" )
197
198
return true ;
198
199
199
200
return false ;
Original file line number Diff line number Diff line change @@ -148,13 +148,14 @@ class UncountedCallArgsChecker
148
148
149
149
auto name = safeGetName (Callee);
150
150
if (name == " adoptRef" || name == " getPtr" || name == " WeakPtr" ||
151
- name == " dynamicDowncast" || name == " downcast" || name == " bitwise_cast" ||
152
- name == " is" || name == " equal" || name == " hash" ||
153
- name == " isType"
151
+ name == " dynamicDowncast" || name == " downcast" ||
152
+ name == " checkedDowncast" || name == " uncheckedDowncast" ||
153
+ name == " bitwise_cast" || name == " is" || name == " equal" ||
154
+ name == " hash" || name == " isType" ||
154
155
// FIXME: Most/all of these should be implemented via attributes.
155
- || name == " equalIgnoringASCIICase" ||
156
+ name == " equalIgnoringASCIICase" ||
156
157
name == " equalIgnoringASCIICaseCommon" ||
157
- name == " equalIgnoringNullity" )
158
+ name == " equalIgnoringNullity" || name == " toString " )
158
159
return true ;
159
160
160
161
return false ;
Original file line number Diff line number Diff line change @@ -23,13 +23,34 @@ class OtherObject {
23
23
Derived* obj ();
24
24
};
25
25
26
+ class String {
27
+ };
28
+
26
29
template <typename Target, typename Source>
27
30
inline Target* dynamicDowncast (Source* source)
28
31
{
29
32
return static_cast <Target*>(source);
30
33
}
31
34
35
+ template <typename Target, typename Source>
36
+ inline Target* checkedDowncast (Source* source)
37
+ {
38
+ return static_cast <Target*>(source);
39
+ }
40
+
41
+ template <typename Target, typename Source>
42
+ inline Target* uncheckedDowncast (Source* source)
43
+ {
44
+ return static_cast <Target*>(source);
45
+ }
46
+
47
+ template <typename ... Types>
48
+ String toString (const Types&... values);
49
+
32
50
void foo (OtherObject* other)
33
51
{
34
52
dynamicDowncast<SubDerived>(other->obj ());
53
+ checkedDowncast<SubDerived>(other->obj ());
54
+ uncheckedDowncast<SubDerived>(other->obj ());
55
+ toString (other->obj ());
35
56
}
You can’t perform that action at this time.
0 commit comments