1 // RUN: %check_clang_tidy %s bugprone-easily-swappable-parameters %t \
2 // RUN:   -config='{CheckOptions: [ \
3 // RUN:     {key: bugprone-easily-swappable-parameters.MinimumLength, value: 2}, \
4 // RUN:     {key: bugprone-easily-swappable-parameters.IgnoredParameterNames, value: ""}, \
5 // RUN:     {key: bugprone-easily-swappable-parameters.IgnoredParameterTypeSuffixes, value: ""}, \
6 // RUN:     {key: bugprone-easily-swappable-parameters.QualifiersMix, value: 0}, \
7 // RUN:     {key: bugprone-easily-swappable-parameters.ModelImplicitConversions, value: 0}, \
8 // RUN:     {key: bugprone-easily-swappable-parameters.SuppressParametersUsedTogether, value: 1}, \
9 // RUN:     {key: bugprone-easily-swappable-parameters.NamePrefixSuffixSilenceDissimilarityTreshold, value: 0} \
10 // RUN:  ]}' -- -x c
11 
12 int myprint();
13 int add(int X, int Y);
14 
notRelated(int A,int B)15 void notRelated(int A, int B) {}
16 // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: 2 adjacent parameters of 'notRelated' of similar type ('int')
17 // CHECK-MESSAGES: :[[@LINE-2]]:21: note: the first parameter in the range is 'A'
18 // CHECK-MESSAGES: :[[@LINE-3]]:28: note: the last parameter in the range is 'B'
19 
addedTogether(int A,int B)20 int addedTogether(int A, int B) { return add(A, B); } // NO-WARN: Passed to same function.
21 
passedToSameKNRFunction(int A,int B)22 void passedToSameKNRFunction(int A, int B) {
23   myprint("foo", A);
24   myprint("bar", B);
25 }
26 // CHECK-MESSAGES: :[[@LINE-4]]:30: warning: 2 adjacent parameters of 'passedToSameKNRFunction' of similar type ('int')
27 // CHECK-MESSAGES: :[[@LINE-5]]:34: note: the first parameter in the range is 'A'
28 // CHECK-MESSAGES: :[[@LINE-6]]:41: note: the last parameter in the range is 'B'
29 // This is actually a false positive: the "passed to same function" heuristic
30 // can't map the parameter index 1 to A and B because myprint() has no
31 // parameters.
32