Commit 7df9ba1
committed
Thread safety analysis: Skip functions acquiring/releasing parameters
The analysis already excludes functions with a zero-argument acquire or
release attribute. According to the requirements enforced by
-Wthread-safety-attributes, these are methods of a capability class
where the attribute implicitly refers to `this`.
C doesn't have class methods, so the lock/unlock implementations are
free functions. If we disable the analysis for all free functions with
attributes, this would obviously exclude too much. But maybe we can
exclude functions where the attribute directly refers to a parameter.
Mutex implementations should typically do that, and I don't see why
other functions should. (Typically, other functions acquire or release a
global mutex or a member of a parameter.)
Fixes #139933.1 parent d0acddb commit 7df9ba1
File tree
2 files changed
+46
-2
lines changed- clang
- lib/Analysis
- test/SemaCXX
2 files changed
+46
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2344 | 2344 | | |
2345 | 2345 | | |
2346 | 2346 | | |
| 2347 | + | |
| 2348 | + | |
| 2349 | + | |
| 2350 | + | |
| 2351 | + | |
| 2352 | + | |
| 2353 | + | |
| 2354 | + | |
| 2355 | + | |
| 2356 | + | |
| 2357 | + | |
| 2358 | + | |
| 2359 | + | |
| 2360 | + | |
2347 | 2361 | | |
2348 | 2362 | | |
2349 | 2363 | | |
| |||
2421 | 2435 | | |
2422 | 2436 | | |
2423 | 2437 | | |
2424 | | - | |
| 2438 | + | |
2425 | 2439 | | |
2426 | 2440 | | |
2427 | 2441 | | |
2428 | 2442 | | |
2429 | 2443 | | |
2430 | | - | |
| 2444 | + | |
2431 | 2445 | | |
2432 | 2446 | | |
2433 | 2447 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2401 | 2401 | | |
2402 | 2402 | | |
2403 | 2403 | | |
| 2404 | + | |
| 2405 | + | |
| 2406 | + | |
| 2407 | + | |
| 2408 | + | |
| 2409 | + | |
| 2410 | + | |
| 2411 | + | |
| 2412 | + | |
| 2413 | + | |
| 2414 | + | |
| 2415 | + | |
| 2416 | + | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
| 2421 | + | |
| 2422 | + | |
| 2423 | + | |
| 2424 | + | |
| 2425 | + | |
| 2426 | + | |
| 2427 | + | |
| 2428 | + | |
| 2429 | + | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
2404 | 2434 | | |
2405 | 2435 | | |
2406 | 2436 | | |
| |||
0 commit comments