189a1d03eSRichard // RUN: %check_clang_tidy %s bugprone-easily-swappable-parameters %t \
2*e8a3ddafSNathan James // RUN:   -config='{CheckOptions: { \
3*e8a3ddafSNathan James // RUN:     bugprone-easily-swappable-parameters.MinimumLength: 2, \
4*e8a3ddafSNathan James // RUN:     bugprone-easily-swappable-parameters.IgnoredParameterNames: "", \
5*e8a3ddafSNathan James // RUN:     bugprone-easily-swappable-parameters.IgnoredParameterTypeSuffixes: "", \
6*e8a3ddafSNathan James // RUN:     bugprone-easily-swappable-parameters.QualifiersMix: 0, \
7*e8a3ddafSNathan James // RUN:     bugprone-easily-swappable-parameters.ModelImplicitConversions: 0, \
8*e8a3ddafSNathan James // RUN:     bugprone-easily-swappable-parameters.SuppressParametersUsedTogether: 1, \
9*e8a3ddafSNathan James // RUN:     bugprone-easily-swappable-parameters.NamePrefixSuffixSilenceDissimilarityTreshold: 0 \
10*e8a3ddafSNathan James // RUN:  }}' -- -Wno-strict-prototypes -x c
1189a1d03eSRichard 
1289a1d03eSRichard int myprint();
1389a1d03eSRichard int add(int X, int Y);
1489a1d03eSRichard 
notRelated(int A,int B)1589a1d03eSRichard void notRelated(int A, int B) {}
1689a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: 2 adjacent parameters of 'notRelated' of similar type ('int')
1789a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-2]]:21: note: the first parameter in the range is 'A'
1889a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-3]]:28: note: the last parameter in the range is 'B'
1989a1d03eSRichard 
addedTogether(int A,int B)2089a1d03eSRichard int addedTogether(int A, int B) { return add(A, B); } // NO-WARN: Passed to same function.
2189a1d03eSRichard 
passedToSameKNRFunction(int A,int B)2289a1d03eSRichard void passedToSameKNRFunction(int A, int B) {
2389a1d03eSRichard   myprint("foo", A);
2489a1d03eSRichard   myprint("bar", B);
2589a1d03eSRichard }
2689a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-4]]:30: warning: 2 adjacent parameters of 'passedToSameKNRFunction' of similar type ('int')
2789a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-5]]:34: note: the first parameter in the range is 'A'
2889a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-6]]:41: note: the last parameter in the range is 'B'
2989a1d03eSRichard // This is actually a false positive: the "passed to same function" heuristic
3089a1d03eSRichard // can't map the parameter index 1 to A and B because myprint() has no
3189a1d03eSRichard // parameters.
32