| 1 | // RUN: %check_clang_tidy -check-suffix=NON-STRICT-REGEX %s bugprone-unsafe-functions %t --\ |
| 2 | // RUN: -config="{CheckOptions: {bugprone-unsafe-functions.CustomFunctions: '::name_match,replacement,is a qualname match;^::prefix_match,,is matched on qualname prefix'}}" |
| 3 | // RUN: %check_clang_tidy -check-suffix=STRICT-REGEX %s bugprone-unsafe-functions %t --\ |
| 4 | // RUN: -config="{CheckOptions: {bugprone-unsafe-functions.CustomFunctions: '^name_match$,replacement,is matched on function name only;^::prefix_match$,,is a full qualname match'}}" |
| 5 | |
| 6 | void name_match(); |
| 7 | void prefix_match(); |
| 8 | |
| 9 | void name_match_regex(); |
| 10 | void prefix_match_regex(); |
| 11 | |
| 12 | void f1() { |
| 13 | name_match(); |
| 14 | // CHECK-MESSAGES-NON-STRICT-REGEX: :[[@LINE-1]]:3: warning: function 'name_match' is a qualname match; 'replacement' should be used instead |
| 15 | // CHECK-MESSAGES-STRICT-REGEX: :[[@LINE-2]]:3: warning: function 'name_match' is matched on function name only; 'replacement' should be used instead |
| 16 | prefix_match(); |
| 17 | // CHECK-MESSAGES-NON-STRICT-REGEX: :[[@LINE-1]]:3: warning: function 'prefix_match' is matched on qualname prefix; it should not be used |
| 18 | // CHECK-MESSAGES-STRICT-REGEX: :[[@LINE-2]]:3: warning: function 'prefix_match' is a full qualname match; it should not be used |
| 19 | |
| 20 | name_match_regex(); |
| 21 | // CHECK-MESSAGES-NON-STRICT-REGEX: :[[@LINE-1]]:3: warning: function 'name_match_regex' is a qualname match; 'replacement' should be used instead |
| 22 | // no-warning STRICT-REGEX |
| 23 | |
| 24 | prefix_match_regex(); |
| 25 | // CHECK-MESSAGES-NON-STRICT-REGEX: :[[@LINE-1]]:3: warning: function 'prefix_match_regex' is matched on qualname prefix; it should not be used |
| 26 | // no-warning STRICT-REGEX |
| 27 | } |
| 28 | |