[all-commits] [llvm/llvm-project] fe8663: [clang-tidy] [PR50069] readability-braces-around-s...

MyDeveloperDay via All-commits all-commits at lists.llvm.org
Sat Aug 14 04:06:02 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fe866327c1f98a327767e80290dd08cedeadbfd6
      https://github.com/llvm/llvm-project/commit/fe866327c1f98a327767e80290dd08cedeadbfd6
  Author: mydeveloperday <mydeveloperday at gmail.com>
  Date:   2021-08-14 (Sat, 14 Aug 2021)

  Changed paths:
    M clang-tools-extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp
    A clang-tools-extra/test/clang-tidy/checkers/readability-braces-around-statements-attributes.cpp

  Log Message:
  -----------
  [clang-tidy] [PR50069] readability-braces-around-statements doesn't work well with [[likely]] [[unlikely]]

https://bugs.llvm.org/show_bug.cgi?id=50069

When clang-tidy sees:

```
if (true) [[unlikely]] {
    ...
}
```

It thinks the braces are missing and add them again.

```
if (true)  { [[unlikely]] {
    ...
  }
}
```

This revision aims to prevent that incorrect code generation

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D105479




More information about the All-commits mailing list