Commit 70fa703
[clang] Force AttributedStmtClass to not be scope parents (llvm#125370)
Example from the issue:
```c++
void Func(int x) {
switch (x) {
[[likely]] case 0:
case 1:
int i = 3;
case 2:
break;
}
}
```
Clang checks if ``case 2`` can be reachable by checking its scope. The
variable declaration should create a scope containing ``case 2``, but
due to the structure of the AST, ``case 2`` gets the scope of the
``likely`` statement, but not ``int i = 3;``. Therefore, I changed this
code to force attribute statement not to be scope parents.
Fixes llvm#840721 parent d567c94 commit 70fa703
File tree
3 files changed
+21
-11
lines changed- clang
- docs
- lib/Sema
- test/CXX/stmt.stmt/stmt.select/stmt.switch
3 files changed
+21
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| 132 | + | |
| 133 | + | |
132 | 134 | | |
133 | 135 | | |
134 | 136 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
597 | 597 | | |
598 | 598 | | |
599 | 599 | | |
600 | | - | |
601 | | - | |
602 | | - | |
603 | | - | |
604 | | - | |
605 | | - | |
606 | | - | |
607 | | - | |
608 | | - | |
609 | 600 | | |
610 | 601 | | |
611 | 602 | | |
| |||
649 | 640 | | |
650 | 641 | | |
651 | 642 | | |
652 | | - | |
| 643 | + | |
653 | 644 | | |
654 | 645 | | |
655 | 646 | | |
| |||
658 | 649 | | |
659 | 650 | | |
660 | 651 | | |
661 | | - | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
662 | 659 | | |
663 | 660 | | |
664 | 661 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
0 commit comments