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: "\"\";Foo;Bar", \
5*e8a3ddafSNathan James // RUN:     bugprone-easily-swappable-parameters.IgnoredParameterTypeSuffixes: "T", \
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: 0, \
9*e8a3ddafSNathan James // RUN:     bugprone-easily-swappable-parameters.NamePrefixSuffixSilenceDissimilarityTreshold: 0 \
10*e8a3ddafSNathan James // RUN:  }}' --
1189a1d03eSRichard 
ignoredUnnamed(int I,int,int)1289a1d03eSRichard void ignoredUnnamed(int I, int, int) {} // NO-WARN: No >= 2 length of non-unnamed.
1389a1d03eSRichard 
nothingIgnored(int I,int J)1489a1d03eSRichard void nothingIgnored(int I, int J) {}
1589a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: 2 adjacent parameters of 'nothingIgnored' of similar type ('int') are easily swapped by mistake [bugprone-easily-swappable-parameters]
1689a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-2]]:25: note: the first parameter in the range is 'I'
1789a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-3]]:32: note: the last parameter in the range is 'J'
1889a1d03eSRichard 
ignoredParameter(int Foo,int I,int J)1989a1d03eSRichard void ignoredParameter(int Foo, int I, int J) {}
2089a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:32: warning: 2 adjacent parameters of 'ignoredParameter' of similar type ('int')
2189a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-2]]:36: note: the first parameter in the range is 'I'
2289a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-3]]:43: note: the last parameter in the range is 'J'
2389a1d03eSRichard 
ignoredParameterBoth(int Foo,int Bar)2489a1d03eSRichard void ignoredParameterBoth(int Foo, int Bar) {} // NO-WARN.
2589a1d03eSRichard 
2689a1d03eSRichard struct S {};
2789a1d03eSRichard struct T {};
2889a1d03eSRichard struct MyT {};
2989a1d03eSRichard 
notIgnoredType(S S1,S S2)3089a1d03eSRichard void notIgnoredType(S S1, S S2) {}
3189a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: 2 adjacent parameters of 'notIgnoredType' of similar type ('S')
3289a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-2]]:23: note: the first parameter in the range is 'S1'
3389a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-3]]:29: note: the last parameter in the range is 'S2'
3489a1d03eSRichard 
ignoredTypeExact(T T1,T T2)3589a1d03eSRichard void ignoredTypeExact(T T1, T T2) {} // NO-WARN.
3689a1d03eSRichard 
ignoredTypeSuffix(MyT M1,MyT M2)3789a1d03eSRichard void ignoredTypeSuffix(MyT M1, MyT M2) {} // NO-WARN.
38