Index: clang-tidy/readability/IdentifierNamingCheck.cpp =================================================================== --- clang-tidy/readability/IdentifierNamingCheck.cpp +++ clang-tidy/readability/IdentifierNamingCheck.cpp @@ -109,6 +109,7 @@ m(TemplateParameter) \ m(TypeAlias) \ m(MacroDefinition) \ + m(ObjcIvar) \ enum StyleKind { #define ENUMERATE(v) SK_ ## v, @@ -384,6 +385,9 @@ const NamedDecl *D, const std::vector> &NamingStyles) { + if (isa(D) && NamingStyles[SK_ObjcIvar]) + return SK_ObjcIvar; + if (isa(D) && NamingStyles[SK_Typedef]) return SK_Typedef; Index: test/clang-tidy/readability-identifier-naming-objc.m =================================================================== --- test/clang-tidy/readability-identifier-naming-objc.m +++ 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