[all-commits] [llvm/llvm-project] ae2829: [clang-tidy] Fix readability-else-after-return for...

Berkay Sahin via All-commits all-commits at lists.llvm.org
Sun Mar 8 13:58:24 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ae282974b8a40e20a4c55dfffba84d24db843d74
      https://github.com/llvm/llvm-project/commit/ae282974b8a40e20a4c55dfffba84d24db843d74
  Author: Berkay Sahin <berkaysahindev at gmail.com>
  Date:   2026-03-08 (Sun, 08 Mar 2026)

  Changed paths:
    M clang-tools-extra/clang-tidy/readability/ElseAfterReturnCheck.cpp
    M clang-tools-extra/docs/ReleaseNotes.rst
    A clang-tools-extra/test/clang-tidy/checkers/readability/else-after-return-cxx20.cpp

  Log Message:
  -----------
  [clang-tidy] Fix readability-else-after-return for [[likely]]/[[unlikely]] if (#184684)

Following the PR #181878 I have noticed a false negative when if is
attributed.

Repro:

```cpp
void f()
{
    if (true) {
        return;
    } else {
        // Warns as expected
    }

    if (true) [[likely]] {
        return;
    } else {
        // False-negative
    }
}
```

Godbolt: https://godbolt.org/z/cvGdovjhx



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