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 @@ -194,8 +194,9 @@ bool isPtrConversion(const FunctionDecl *F) {
194
194
// FIXME: check # of params == 1
195
195
const auto FunctionName = safeGetName (F);
196
196
if (FunctionName == " getPtr" || FunctionName == " WeakPtr" ||
197
- FunctionName == " dynamicDowncast"
198
- || FunctionName == " downcast" || FunctionName == " bitwise_cast" )
197
+ FunctionName == " dynamicDowncast" || FunctionName == " downcast" ||
198
+ FunctionName == " checkedDowncast" ||
199
+ FunctionName == " uncheckedDowncast" || FunctionName == " bitwise_cast" )
199
200
return true ;
200
201
201
202
return false ;
Original file line number Diff line number Diff line change @@ -174,13 +174,14 @@ class UncountedCallArgsChecker
174
174
175
175
auto name = safeGetName (Callee);
176
176
if (name == " adoptRef" || name == " getPtr" || name == " WeakPtr" ||
177
- name == " dynamicDowncast" || name == " downcast" || name == " bitwise_cast" ||
178
- name == " is" || name == " equal" || name == " hash" ||
179
- name == " isType"
177
+ name == " dynamicDowncast" || name == " downcast" ||
178
+ name == " checkedDowncast" || name == " uncheckedDowncast" ||
179
+ name == " bitwise_cast" || name == " is" || name == " equal" ||
180
+ name == " hash" || name == " isType" ||
180
181
// FIXME: Most/all of these should be implemented via attributes.
181
- || name == " equalIgnoringASCIICase" ||
182
+ name == " equalIgnoringASCIICase" ||
182
183
name == " equalIgnoringASCIICaseCommon" ||
183
- name == " equalIgnoringNullity" )
184
+ name == " equalIgnoringNullity" || name == " toString " )
184
185
return true ;
185
186
186
187
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