Commit 6dca33c
authored
Check for mutability better (llvm#127843)
This PR adds a function to determine if a type "looks" mutable. Since
it's impossible to be totally sure if something can or can't be modified
in C++, this makes a best-effort attempt to determine if variables of
that type can be modified or not.
The motivation for this change is the -Wunique-object-duplication
warning, which had a false positive due to a missed case while checking
for mutability. Pulling the logic into a separate function allows it to
be written much more cleanly. There should be no behavior change, except
that we no longer report function references to be mutable.1 parent d2d1f14 commit 6dca33c
File tree
2 files changed
+22
-16
lines changed- clang
- lib/Sema
- test/SemaCXX
2 files changed
+22
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13441 | 13441 | | |
13442 | 13442 | | |
13443 | 13443 | | |
| 13444 | + | |
| 13445 | + | |
| 13446 | + | |
| 13447 | + | |
| 13448 | + | |
| 13449 | + | |
| 13450 | + | |
| 13451 | + | |
| 13452 | + | |
| 13453 | + | |
| 13454 | + | |
| 13455 | + | |
| 13456 | + | |
| 13457 | + | |
| 13458 | + | |
| 13459 | + | |
| 13460 | + | |
13444 | 13461 | | |
13445 | 13462 | | |
13446 | 13463 | | |
| |||
13455 | 13472 | | |
13456 | 13473 | | |
13457 | 13474 | | |
13458 | | - | |
13459 | | - | |
13460 | | - | |
13461 | | - | |
| 13475 | + | |
| 13476 | + | |
13462 | 13477 | | |
13463 | 13478 | | |
13464 | | - | |
13465 | | - | |
13466 | | - | |
13467 | | - | |
13468 | | - | |
13469 | | - | |
13470 | | - | |
13471 | | - | |
13472 | | - | |
13473 | | - | |
13474 | | - | |
13475 | | - | |
13476 | 13479 | | |
13477 | 13480 | | |
13478 | 13481 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
102 | 105 | | |
103 | 106 | | |
104 | 107 | | |
| |||
0 commit comments