1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Implicit Checks</title>
<link type="text/css" rel="stylesheet" href="menu.css">
<link type="text/css" rel="stylesheet" href="content.css">
<script type="text/javascript" src="scripts/menu.js"></script>
<script type="text/javascript" src="scripts/expandcollapse.js"></script>
<style type="text/css">
tr:first-child { width:20%; }
</style>
</head>
<body onload="initExpandCollapse()">
<div id="page">
<!--#include virtual="menu.html.incl"-->
<div id="content">
<h1>Implicit Checkers</h1>
Even though the implicit checkers do not produce any warnings, they are used to
support the analyzer core and model known APIs. See also
<a href = "available_checks.html">Default Checkers</a>
and <a href = "alpha_checks.html">Experimental (Alpha) Checkers</a>.
<ul>
<li><a href="#core_implicit_checkers">Core Implicit Checkers</a></li>
<li><a href="#osx_implicit_checkers">OS X Implicit Checkers</a></li>
</ul>
<!-- =========================== core implicit =========================== -->
<h3 id="core_implicit_checkers">Core Implicit Checkers</h3>
<table class="checkers">
<colgroup><col class="namedescr"><col class="example"></colgroup>
<thead><tr><td>Name, Description</td><td>Example</td></tr></thead>
<tbody>
<tr><td><div class="namedescr expandable"><span class="name">
core.DynamicTypePropagation</span><span class="lang">
(C++, ObjC)</span><div class="descr">
Generate dynamic type information.</div></div></td>
<td><div class="exampleContainer expandable">
<div class="example"><pre>
// C++
class A {
public:
A(int x) {}
virtual int foo();
};
class B: public A {
public:
B()
:A(foo())
// DynamicTypeInfo for 'this' rigion will wrap type 'A'
// unless the base constructor call expression is processed
{}
virtual int foo();
};
</pre></div><div class="separator"></div>
<div class="example"><pre>
// Objective-C
@interface MyClass : NSObject {}
@end
@implementation MyClass
+ (void)foo {
MyClass *x = [[self alloc] init];
// DynamicTypeInfo from a cast: from 'id' to 'MyClass *'
}
@end
void test() {
MyClass *x = [MyClass alloc];
// DynamicTypeInfo from a call to alloc:
// from 'id' to 'MyClass *'
}
</pre></div></div></td></tr>
<tr><td><div class="namedescr expandable"><span class="name">
core.builtin.BuiltinFunctions</span><span class="lang">
(C)</span><div class="descr">
Evaluate compiler builtin functions (e.g., <code>alloca()</code>)</div></div></td>
<td><div class="exampleContainer expandable">
<div class="example"><pre>
void test(int x) {
int *p = (int *)__builtin_alloca(8);
// evaluates to AllocaRegion
if(__builtin_expect(x > 10, 0)) // evaluates to 'x > 10'
x = 0;
}
</pre></div></div></td></tr>
<tr><td><div class="namedescr expandable"><span class="name">
core.builtin.NoReturnFunctions</span><span class="lang">
(C, ObjC)</span><div class="descr">
Evaluate "panic" functions that are known to not return to the caller.</div></div></td>
<td><div class="exampleContainer expandable">
<div class="example"><pre>
// C
void test() {
panic(); // generate sink
}
</pre></div><div class="separator"></div>
<div class="example"><pre>
// Objective-C
@interface MyObj : NSObject {}
- (void)foo;
@end
@implementation MyObj
- (void)foo {
[[NSAssertionHandler currentHandler] handleFailureInMethod:_cmd
object:self
file:(@"somefile.m")
lineNumber:1
description:(@"some text")];
// generate sink
}
@end
</pre></div></div></td></tr>
</tbody></table>
<!-- =========================== OS X implicit =========================== -->
<h3 id="osx_implicit_checkers">OS X Implicit Checkers</h3>
<table class="checkers">
<colgroup><col class="namedescr"><col class="example"></colgroup>
<thead><tr><td>Name, Description</td><td>Example</td></tr></thead>
<tbody>
<tr><td><div class="namedescr expandable"><span class="name">
osx.cocoa.Loops</span><span class="lang">
(ObjC)</span><div class="descr">
Improved modeling of loops using Cocoa collection types.</div></div></td>
<td><div class="exampleContainer expandable">
<div class="example"><pre>
void test() {
id x;
for (x in [NSArray testObject]) {
// assume the value of 'x' is non-nil
}
}
</pre></div></div></td></tr>
<tr><td><div class="namedescr expandable"><span class="name">
osx.cocoa.NonNilReturnValue</span><span class="lang">
(ObjC)</span><div class="descr">
Model the APIs that are guaranteed to return a non-nil value.</div></div></td>
<td><div class="exampleContainer expandable">
<div class="example"><pre>
void test(NSArray *A) {
id subscriptObj = A[1]; // assume the value is non-nil
}
</pre></div></div></td></tr>
</tbody></table>
</div> <!-- page -->
</div> <!-- content -->
</body>
</html>
|