• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: %check_clang_tidy %s google-objc-function-naming %t -- -- -isystem %S/Inputs/Headers
2
3#include <stdio.h>
4
5static 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
11typedef _Bool bool;
12
13static 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
18static 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
23static 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
28static 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
33static bool IsPositive(int a) { return a > 0; }
34
35bool 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
40static 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
45static const char *MD5(const char *str) { return 0; }
46
47static const char *URL(void) { return "https://clang.llvm.org/"; }
48
49static const char *DEFURL(void) { return "https://clang.llvm.org/"; }
50
51static const char *DEFFooURL(void) { return "https://clang.llvm.org/"; }
52
53static const char *StringFromNSString(id str) { return ""; }
54
55void 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
60void ABLogString(const char *str);
61
62bool 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
67const char *ABURL(void) { return "https://clang.llvm.org/"; }
68
69const char *ABFooURL(void) { return "https://clang.llvm.org/"; }
70
71int main(int argc, const char **argv) { return 0; }
72