Commit 9f2665e
Automerge: [analyzer] Fix FP for cplusplus.placement new #149240 (#150161)
Fix false positive where warnings were asserted for placement new even
when no additional space is requested
The PlacementNewChecker incorrectly triggered warnings when the storage
provided matched or exceeded the allocated type size, causing false
positives. Now the warning triggers only when the provided storage is
strictly less than the required size.
Add test cases covering exact size, undersize, and oversize scenarios to
validate the fix.
Fixes #149240File tree
2 files changed
+31
-31
lines changed- clang
- lib/StaticAnalyzer/Checkers
- test/Analysis
2 files changed
+31
-31
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
115 | | - | |
116 | | - | |
| 114 | + | |
117 | 115 | | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
140 | 120 | | |
141 | 121 | | |
142 | 122 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
170 | 189 | | |
171 | | - | |
172 | | - | |
| 190 | + | |
| 191 | + | |
173 | 192 | | |
174 | 193 | | |
175 | 194 | | |
176 | 195 | | |
177 | 196 | | |
178 | 197 | | |
179 | 198 | | |
180 | | - | |
| 199 | + | |
| 200 | + | |
181 | 201 | | |
182 | | - | |
183 | | - | |
| 202 | + | |
| 203 | + | |
184 | 204 | | |
185 | 205 | | |
186 | 206 | | |
| |||
0 commit comments