summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test
diff options
context:
space:
mode:
authorYan Zhang <ynzhang@google.com>2018-04-20 23:18:09 +0000
committerYan Zhang <ynzhang@google.com>2018-04-20 23:18:09 +0000
commite3f50ecb3a0886923c697ba8246d8cb8756480c1 (patch)
treed69f40cd7519fa5a65820f1e6e30f811d3c7cb34 /clang-tools-extra/test
parentc8ac0a6f979c36ad7f7c3e1b9b2e8260f483aa15 (diff)
downloadbcm5719-llvm-e3f50ecb3a0886923c697ba8246d8cb8756480c1.tar.gz
bcm5719-llvm-e3f50ecb3a0886923c697ba8246d8cb8756480c1.zip
[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
Diffstat (limited to 'clang-tools-extra/test')
-rw-r--r--clang-tools-extra/test/clang-tidy/readability-identifier-naming-objc.m15
1 files changed, 15 insertions, 0 deletions
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
OpenPOWER on IntegriCloud