This revision was automatically updated to reflect the committed changes. Closed by commit rL348317: [clang-tidy] Ignore namespaced and C++ member functions in google-objc-function… (authored by stephanemoore, committed by ). Herald added a subscriber: llvm-commits.
Changed prior to commit: https://reviews.llvm.org/D55101?vs=176206&id=176726#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55101/new/ https://reviews.llvm.org/D55101 Files: clang-tools-extra/trunk/clang-tidy/google/FunctionNamingCheck.cpp clang-tools-extra/trunk/test/clang-tidy/google-objc-function-naming.mm Index: clang-tools-extra/trunk/test/clang-tidy/google-objc-function-naming.mm =================================================================== --- clang-tools-extra/trunk/test/clang-tidy/google-objc-function-naming.mm +++ clang-tools-extra/trunk/test/clang-tidy/google-objc-function-naming.mm @@ -0,0 +1,30 @@ +// RUN: %check_clang_tidy %s google-objc-function-naming %t + +void printSomething() {} +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function name 'printSomething' not +// using function naming conventions described by Google Objective-C style guide + +void PrintSomething() {} +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function name 'PrintSomething' not +// using function naming conventions described by Google Objective-C style guide + +void ABCBad_Name() {} +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function name 'ABCBad_Name' not +// using function naming conventions described by Google Objective-C style guide + +namespace { + +int foo() { return 0; } + +} + +namespace bar { + +int convert() { return 0; } + +} + +class Baz { +public: + int value() { return 0; } +}; Index: clang-tools-extra/trunk/clang-tidy/google/FunctionNamingCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/google/FunctionNamingCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/google/FunctionNamingCheck.cpp @@ -98,8 +98,9 @@ // main. Finder->addMatcher( functionDecl( - unless(isExpansionInSystemHeader()), - unless(anyOf(isMain(), matchesName(validFunctionNameRegex(true)), + unless(anyOf(isExpansionInSystemHeader(), cxxMethodDecl(), + hasAncestor(namespaceDecl()), isMain(), + matchesName(validFunctionNameRegex(true)), allOf(isStaticStorageClass(), matchesName(validFunctionNameRegex(false)))))) .bind("function"),
Index: clang-tools-extra/trunk/test/clang-tidy/google-objc-function-naming.mm =================================================================== --- clang-tools-extra/trunk/test/clang-tidy/google-objc-function-naming.mm +++ clang-tools-extra/trunk/test/clang-tidy/google-objc-function-naming.mm @@ -0,0 +1,30 @@ +// RUN: %check_clang_tidy %s google-objc-function-naming %t + +void printSomething() {} +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function name 'printSomething' not +// using function naming conventions described by Google Objective-C style guide + +void PrintSomething() {} +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function name 'PrintSomething' not +// using function naming conventions described by Google Objective-C style guide + +void ABCBad_Name() {} +// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function name 'ABCBad_Name' not +// using function naming conventions described by Google Objective-C style guide + +namespace { + +int foo() { return 0; } + +} + +namespace bar { + +int convert() { return 0; } + +} + +class Baz { +public: + int value() { return 0; } +}; Index: clang-tools-extra/trunk/clang-tidy/google/FunctionNamingCheck.cpp =================================================================== --- clang-tools-extra/trunk/clang-tidy/google/FunctionNamingCheck.cpp +++ clang-tools-extra/trunk/clang-tidy/google/FunctionNamingCheck.cpp @@ -98,8 +98,9 @@ // main. Finder->addMatcher( functionDecl( - unless(isExpansionInSystemHeader()), - unless(anyOf(isMain(), matchesName(validFunctionNameRegex(true)), + unless(anyOf(isExpansionInSystemHeader(), cxxMethodDecl(), + hasAncestor(namespaceDecl()), isMain(), + matchesName(validFunctionNameRegex(true)), allOf(isStaticStorageClass(), matchesName(validFunctionNameRegex(false)))))) .bind("function"),
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits