[all-commits] [llvm/llvm-project] 8d902f: [clang] Force AttributedStmtClass to not be scope ...

Yutong Zhu via All-commits all-commits at lists.llvm.org
Tue Feb 11 05:53:42 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8d902f2cb0bc8825bcde911897e99aadbd5d28e9
      https://github.com/llvm/llvm-project/commit/8d902f2cb0bc8825bcde911897e99aadbd5d28e9
  Author: Yutong Zhu <115899167+YutongZhuu at users.noreply.github.com>
  Date:   2025-02-11 (Tue, 11 Feb 2025)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Sema/JumpDiagnostics.cpp
    A clang/test/CXX/stmt.stmt/stmt.select/stmt.switch/p4.cpp

  Log Message:
  -----------
  [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



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list