You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: clang-tools-extra/test/clang-tidy/checkers/readability/avoid-return-with-void-value.cpp
+13-10Lines changed: 13 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ void f2() {
12
12
returnf1();
13
13
// 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]
14
14
// 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]
15
-
// CHECK-FIXES: f1(); return;
15
+
// CHECK-FIXES: f1();
16
16
}
17
17
18
18
voidf3(bool b) {
@@ -23,19 +23,19 @@ void f3(bool b) {
23
23
returnf2();
24
24
// 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]
25
25
// 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]
26
-
// CHECK-FIXES: f2(); return;
27
-
// CHECK-FIXES-LENIENT: f2(); return;
26
+
// CHECK-FIXES: f2();
27
+
// CHECK-FIXES-LENIENT: f2();
28
28
}
29
29
30
30
template<classT>
31
31
T f4() {}
32
32
33
33
voidf5() {
34
-
return f4<void>();
35
-
// 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]
36
-
// 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]
37
-
// CHECK-FIXES: f4<void>(); return;
38
-
// CHECK-FIXES-LENIENT: f4<void>(); return;
34
+
{ return f4<void>(); }
35
+
// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: return statement within a void function should not have a specified return value [readability-avoid-return-with-void-value]
36
+
// CHECK-MESSAGES-LENIENT: :[[@LINE-2]]:7: warning: return statement within a void function should not have a specified return value [readability-avoid-return-with-void-value]
37
+
// CHECK-FIXES: { f4<void>(); return; }
38
+
// CHECK-FIXES-LENIENT: { f4<void>(); return; }
39
39
}
40
40
41
41
voidf6() { return; }
@@ -48,8 +48,8 @@ void f9() {
48
48
return (void)f7();
49
49
// 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]
50
50
// 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]
51
-
// CHECK-FIXES: (void)f7(); return;
52
-
// CHECK-FIXES-LENIENT: (void)f7(); return;
51
+
// CHECK-FIXES: (void)f7();
52
+
// CHECK-FIXES-LENIENT: (void)f7();
53
53
}
54
54
55
55
#defineRETURN_VOIDreturn (void)1
@@ -77,6 +77,7 @@ VOID f13() {
77
77
// 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]
78
78
// CHECK-FIXES: f12(); return;
79
79
// CHECK-FIXES-LENIENT: f12(); return;
80
+
(void)1;
80
81
}
81
82
82
83
voidf14() {
@@ -85,6 +86,7 @@ void f14() {
85
86
// 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-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]
0 commit comments