Files
clang-p2996/clang/lib/Sema/JumpDiagnostics.cpp
Yutong Zhu 8d902f2cb0 [clang] Force AttributedStmtClass to not be scope parents (#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 #84072
2025-02-11 08:53:19 -05:00

40 KiB