================
@@ -14,6 +14,20 @@ void f(bool b) {
     return;
   // CHECK-MESSAGES: :[[@LINE-2]]:9: warning: statement should have braces 
[readability-inconsistent-ifelse-braces]
   // CHECK-FIXES: } else { {{[[][[]}}unlikely{{[]][]]}}
+
+  if (b) [[likely]] {
+  } else [[unlikely]]
+    return;
+  // CHECK-MESSAGES: :[[@LINE-2]]:9: warning: statement should have braces 
[readability-inconsistent-ifelse-braces]
+  // CHECK-FIXES: } else { {{[[][[]}}unlikely{{[]][]]}}
+
+  if (b) [[likely]]
+    return;
+  else [[unlikely]] {
+  }
+  // CHECK-MESSAGES: :[[@LINE-4]]:9: warning: statement should have braces 
[readability-inconsistent-ifelse-braces]
+  // CHECK-FIXES: if (b) { {{[[][[]}}likely{{[]][]]}}
----------------
zwuis wrote:

It's up to you, but it would be better to not hard-code where to add braces.

```diff
 // expected fix-it, explicitly ignore return value
-if (b) [[maybe_unused]] auto _ = foo();
+if (b) { [[maybe_unused]] auto _ = foo(); }
 else {
 }
```

https://github.com/llvm/llvm-project/pull/184095
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to