Debian Codegraph @

clang-tools-extra/test/clang-tidy/checkers/google/objc-function-naming.m

raw
1 // RUN: %check_clang_tidy %s google-objc-function-naming %t -- -- -isystem %clang_tidy_headers
2
3 #include <stdio.h>
4
5 static void TestImplicitFunctionDeclaration(int a) {
6 // Call a builtin function so that the compiler generates an implicit
7 // function declaration.
8 printf("%d", a);
9 }
10
11 typedef _Bool bool;
12
13 static bool ispositive(int a) { return a > 0; }
14 // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: static function named 'ispositive'
15 // must be in Pascal case as required by Google Objective-C style guide
16 // CHECK-FIXES: static bool Ispositive(int a) { return a > 0; }
17
18 static bool is_positive(int a) { return a > 0; }
19 // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: static function named 'is_positive'
20 // must be in Pascal case as required by Google Objective-C style guide
21 // CHECK-FIXES: static bool IsPositive(int a) { return a > 0; }
22
23 static bool isPositive(int a) { return a > 0; }
24 // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: static function named 'isPositive'
25 // must be in Pascal case as required by Google Objective-C style guide
26 // CHECK-FIXES: static bool IsPositive(int a) { return a > 0; }
27
28 static bool Is_Positive(int a) { return a > 0; }
29 // CHECK-MESSAGES: :[[@LINE-1]]:13: warning: static function named 'Is_Positive'
30 // must be in Pascal case as required by Google Objective-C style guide
31 // CHECK-FIXES: static bool IsPositive(int a) { return a > 0; }
32
33 static bool IsPositive(int a) { return a > 0; }
34
35 bool ispalindrome(const char *str);
36 // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function in global namespace named
37 // 'ispalindrome' must have an appropriate prefix followed by Pascal case as
38 // required by Google Objective-C style guide
39
40 static const char *md5(const char *str) { return 0; }
41 // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: static function named 'md5' must be
42 // in Pascal case as required by Google Objective-C style guide
43 // CHECK-FIXES: static const char *Md5(const char *str) { return 0; }
44
45 static const char *MD5(const char *str) { return 0; }
46
47 static const char *URL(void) { return "https://clang.llvm.org/"; }
48
49 static const char *DEFURL(void) { return "https://clang.llvm.org/"; }
50
51 static const char *DEFFooURL(void) { return "https://clang.llvm.org/"; }
52
53 static const char *StringFromNSString(id str) { return ""; }
54
55 void ABLog_String(const char *str);
56 // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function in global namespace named
57 // 'ABLog_String' must have an appropriate prefix followed by Pascal case as
58 // required by Google Objective-C style guide
59
60 void ABLogString(const char *str);
61
62 bool IsPrime(int a);
63 // CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function in global namespace named
64 // 'IsPrime' must have an appropriate prefix followed by Pascal case as required
65 // by Google Objective-C style guide
66
67 const char *ABURL(void) { return "https://clang.llvm.org/"; }
68
69 const char *ABFooURL(void) { return "https://clang.llvm.org/"; }
70
71 int main(int argc, const char **argv) { return 0; }