Skip to content
Commit 5d82cb3c authored by mydeveloperday's avatar mydeveloperday
Browse files

[clang-format] @lefticus just taught the world how to use [[unlikely]] but we...

[clang-format] @lefticus just taught the world how to use [[unlikely]] but we forgot to teach clang-format

Summary:
https://twitter.com/lefticus/status/1262392152950288384?s=20

Jason Turner's (@lefticus) most recent C++ weekly explains the usage of [[likely]] and [[unlikely]] in an 'if/else' context in C++ 20

clang-format leaves the code a little messy afterwards..

```
if (argc > 5)
  [[unlikely]] {
    // ...
  }
else if (argc < 0)
  [[likely]] {
    // ...
  }
else
  [[likely]] {
    // ...
  }
```

try to improve the situation

```
if (argc > 5) [[unlikely]] {
  // ...
} else if (argc < 0) [[likely]] {
  // ...
} else [[likely]] {
  // ...
}
```

Reviewed By: JakeMerdichAMD

Subscribers: cfe-commits, lefticus

Tags: #clang, #clang-format

Differential Revision: https://reviews.llvm.org/D80144
parent 575c59cf
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment