================
@@ -0,0 +1,41 @@
+// RUN: %check_clang_tidy -std=c++20-or-later %s readability-else-after-return 
%t
+
+void g();
+
+void f() {
+  if (true) [[likely]] {
+    return;
+  } else { // comment-0
+      // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: do not use 'else' after 
'return'
+      // CHECK-FIXES: {{^}}     } // comment-0
+  }
+
+  if (false) [[unlikely]] {
+    return;
+  } else { // comment-1
+      // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: do not use 'else' after 
'return'
+      // CHECK-FIXES: {{^}}     } // comment-1
+  }
+
+  if (true) [[likely]]
+    return;
+  else // comment-2
+    // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not use 'else' after 
'return'
+    // CHECK-FIXES: {{^}}  else // comment-2
----------------
zeyi2 wrote:

Thanks!

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

Reply via email to