Commit 2f4754d
committed
Thread Safety Analysis: Support passing scoped locks between functions with appropriate annotations
This is helpful when multiple functions operate on the same capabilities, but we still want to use scoped lockable types for readability and exception safety. - Introduce support for thread safety annotations on function parameters marked with the 'scoped_lockable' attribute. - Add semantic checks for annotated function parameters, ensuring correct usage. - Enhance the analysis to recognize and handle parameters annotated for thread safety, extending the scope of analysis to track these across function boundries. - Verify that the underlying mutexes of function arguments match the expectations set by the annotations. Limitation: This does not work when the attribute arguments are class members, because attributes on function parameters are parsed differently from attributes on functions.1 parent f404207 commit 2f4754d
File tree
9 files changed
+749
-30
lines changed- clang
- docs
- include/clang
- Analysis/Analyses
- Basic
- lib
- Analysis
- Sema
- test/SemaCXX
9 files changed
+749
-30
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | | - | |
| 190 | + | |
| 191 | + | |
191 | 192 | | |
192 | 193 | | |
193 | 194 | | |
| 195 | + | |
| 196 | + | |
194 | 197 | | |
195 | 198 | | |
196 | 199 | | |
| |||
211 | 214 | | |
212 | 215 | | |
213 | 216 | | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
214 | 232 | | |
215 | 233 | | |
216 | 234 | | |
217 | 235 | | |
218 | 236 | | |
219 | 237 | | |
220 | 238 | | |
221 | | - | |
222 | | - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
223 | 242 | | |
224 | 243 | | |
| 244 | + | |
| 245 | + | |
225 | 246 | | |
226 | 247 | | |
227 | 248 | | |
| |||
249 | 270 | | |
250 | 271 | | |
251 | 272 | | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
252 | 281 | | |
253 | 282 | | |
254 | 283 | | |
| |||
283 | 312 | | |
284 | 313 | | |
285 | 314 | | |
286 | | - | |
| 315 | + | |
| 316 | + | |
287 | 317 | | |
288 | 318 | | |
289 | 319 | | |
| 320 | + | |
| 321 | + | |
290 | 322 | | |
291 | 323 | | |
292 | 324 | | |
| |||
305 | 337 | | |
306 | 338 | | |
307 | 339 | | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
308 | 350 | | |
309 | 351 | | |
310 | 352 | | |
| |||
393 | 435 | | |
394 | 436 | | |
395 | 437 | | |
| 438 | + | |
396 | 439 | | |
397 | 440 | | |
398 | 441 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
226 | 262 | | |
227 | 263 | | |
228 | 264 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3685 | 3685 | | |
3686 | 3686 | | |
3687 | 3687 | | |
3688 | | - | |
| 3688 | + | |
3689 | 3689 | | |
3690 | 3690 | | |
3691 | 3691 | | |
| |||
3717 | 3717 | | |
3718 | 3718 | | |
3719 | 3719 | | |
3720 | | - | |
| 3720 | + | |
3721 | 3721 | | |
3722 | 3722 | | |
3723 | 3723 | | |
| |||
3741 | 3741 | | |
3742 | 3742 | | |
3743 | 3743 | | |
3744 | | - | |
| 3744 | + | |
3745 | 3745 | | |
3746 | 3746 | | |
3747 | 3747 | | |
| |||
3863 | 3863 | | |
3864 | 3864 | | |
3865 | 3865 | | |
3866 | | - | |
| 3866 | + | |
3867 | 3867 | | |
3868 | 3868 | | |
3869 | 3869 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3984 | 3984 | | |
3985 | 3985 | | |
3986 | 3986 | | |
| 3987 | + | |
| 3988 | + | |
| 3989 | + | |
| 3990 | + | |
3987 | 3991 | | |
3988 | 3992 | | |
3989 | 3993 | | |
| |||
4039 | 4043 | | |
4040 | 4044 | | |
4041 | 4045 | | |
| 4046 | + | |
| 4047 | + | |
| 4048 | + | |
| 4049 | + | |
| 4050 | + | |
| 4051 | + | |
| 4052 | + | |
| 4053 | + | |
| 4054 | + | |
| 4055 | + | |
| 4056 | + | |
4042 | 4057 | | |
4043 | 4058 | | |
4044 | 4059 | | |
| |||
0 commit comments