[PATCH] D57207: [clang-tidy] Make google-objc-function-naming ignore implicit functions 🙈
Stephane Moore via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 24 16:55:34 PST 2019
stephanemoore created this revision.
Herald added subscribers: cfe-commits, xazax.hun.
Implicit functions are outside the control of source authors and should
be exempt from style restrictions.
Tested via running clang tools tests.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D57207
Files:
clang-tidy/google/FunctionNamingCheck.cpp
test/clang-tidy/google-objc-function-naming.m
Index: test/clang-tidy/google-objc-function-naming.m
===================================================================
--- test/clang-tidy/google-objc-function-naming.m
+++ test/clang-tidy/google-objc-function-naming.m
@@ -1,5 +1,11 @@
// RUN: %check_clang_tidy %s google-objc-function-naming %t
+#import <stdio.h>
+
+static void TestImplicitlyDefinedFunction(int a) {
+ printf("%d", a);
+}
+
typedef _Bool bool;
static bool ispositive(int a) { return a > 0; }
Index: clang-tidy/google/FunctionNamingCheck.cpp
===================================================================
--- clang-tidy/google/FunctionNamingCheck.cpp
+++ clang-tidy/google/FunctionNamingCheck.cpp
@@ -98,7 +98,7 @@
Finder->addMatcher(
functionDecl(
unless(anyOf(isExpansionInSystemHeader(), cxxMethodDecl(),
- hasAncestor(namespaceDecl()), isMain(),
+ hasAncestor(namespaceDecl()), isMain(), isImplicit(),
matchesName(validFunctionNameRegex(true)),
allOf(isStaticStorageClass(),
matchesName(validFunctionNameRegex(false))))))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57207.183444.patch
Type: text/x-patch
Size: 1152 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190125/cdfd7232/attachment.bin>
More information about the cfe-commits
mailing list