[clang-tools-extra] [clang-tidy] Add fix-its to `avoid-return-with-void-value` check (PR #81420)

Danny Mösch via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 11 08:10:08 PST 2024


================
@@ -12,14 +12,18 @@ void f2() {
     return f1();
     // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: return statement within a void function should not have a specified return value [readability-avoid-return-with-void-value]
     // CHECK-MESSAGES-LENIENT: :[[@LINE-2]]:5: warning: return statement within a void function should not have a specified return value [readability-avoid-return-with-void-value]
+    // CHECK-FIXES: f1(); return;
 }
 
 void f3(bool b) {
     if (b) return f1();
     // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: return statement within a void function should not have a specified return value [readability-avoid-return-with-void-value]
+    // CHECK-FIXES: if (b) {f1(); return;}
----------------
SimplyDanny wrote:

Is it okay to assume some formatter will run afterwards to make the output readable?

https://github.com/llvm/llvm-project/pull/81420


More information about the cfe-commits mailing list