From e3f50ecb3a0886923c697ba8246d8cb8756480c1 Mon Sep 17 00:00:00 2001 From: Yan Zhang Date: Fri, 20 Apr 2018 23:18:09 +0000 Subject: [clang-tidy] add new check to find out objc ivars which do not have prefix '_' Summary: For code of ivar declaration: int barWithoutPrefix; The fix will be: int _barWithoutPrefix; Reviewers: benhamilton, hokein, alexfh, aaron.ballman, ilya-biryukov Reviewed By: alexfh Subscribers: Eugene.Zelenko, xazax.hun, klimek, mgorny, cfe-commits Tags: #clang-tools-extra Differential Revision: https://reviews.llvm.org/D45392 llvm-svn: 330492 --- .../test/clang-tidy/readability-identifier-naming-objc.m | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 clang-tools-extra/test/clang-tidy/readability-identifier-naming-objc.m (limited to 'clang-tools-extra/test/clang-tidy') diff --git a/clang-tools-extra/test/clang-tidy/readability-identifier-naming-objc.m b/clang-tools-extra/test/clang-tidy/readability-identifier-naming-objc.m new file mode 100644 index 00000000000..4b3be03fe92 --- /dev/null +++ b/clang-tools-extra/test/clang-tidy/readability-identifier-naming-objc.m @@ -0,0 +1,15 @@ +// RUN: %check_clang_tidy %s readability-identifier-naming %t \ +// RUN: -config='{CheckOptions: \ +// RUN: [{key: readability-identifier-naming.ObjcIvarPrefix, value: '_'}]}' \ +// RUN: -- + +@interface Foo +@end + +@interface Foo () { + int _bar; + int barWithoutPrefix; + // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: invalid case style for objc ivar 'barWithoutPrefix' [readability-identifier-naming] + // CHECK-FIXES: int _barWithoutPrefix; +} +@end -- cgit v1.2.1