1// RUN: %check_clang_tidy %s fuchsia-default-arguments-calls %t
2
3int foo(int value = 5) { return value; }
4
5int f() {
6 foo();
7 // CHECK-NOTES: [[@LINE-1]]:3: warning: calling a function that uses a default argument is disallowed [fuchsia-default-arguments-calls]
8 // CHECK-NOTES: [[@LINE-5]]:9: note: default parameter was declared here
9}
10
11int bar(int value) { return value; }
12
13int n() {
14 foo(value: 0);
15 bar(value: 0);
16}
17
18void x(int i = 12);
19
20struct S {
21 void x(int i);
22};
23
24void S::x(int i = 12) {}
25
26int main() {
27 S s;
28 s.x();
29 // CHECK-NOTES: [[@LINE-1]]:3: warning: calling a function that uses a default argument is disallowed [fuchsia-default-arguments-calls]
30 // CHECK-NOTES: [[@LINE-6]]:11: note: default parameter was declared here
31 // CHECK-NEXT: void S::x(int i = 12) {}
32 x();
33 // CHECK-NOTES: [[@LINE-1]]:3: warning: calling a function that uses a default argument is disallowed [fuchsia-default-arguments-calls]
34 // CHECK-NOTES: [[@LINE-16]]:8: note: default parameter was declared here
35 // CHECK-NEXT: void x(int i = 12);
36}
37

source code of clang-tools-extra/test/clang-tidy/checkers/fuchsia/default-arguments-calls.cpp