Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang-tidy] add new check to find out objc ivars which do not have p…
…refix '_' 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
- Loading branch information
1 parent
c8ac0a6
commit e3f50ec
Showing
2 changed files
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
clang-tools-extra/test/clang-tidy/readability-identifier-naming-objc.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |