Index: clang-tidy/objc/PropertyDeclarationCheck.cpp =================================================================== --- clang-tidy/objc/PropertyDeclarationCheck.cpp +++ clang-tidy/objc/PropertyDeclarationCheck.cpp @@ -81,7 +81,8 @@ } bool hasCategoryPropertyPrefix(llvm::StringRef PropertyName) { - auto RegexExp = llvm::Regex("^[a-zA-Z]+_[a-zA-Z0-9][a-zA-Z0-9_]+$"); + auto RegexExp = + llvm::Regex("^[a-zA-Z][a-zA-Z0-9]*_[a-zA-Z0-9][a-zA-Z0-9_]+$"); return RegexExp.match(PropertyName); } @@ -92,8 +93,7 @@ if (Prefix.lower() != Prefix) { return false; } - auto RegexExp = - llvm::Regex(llvm::StringRef(validPropertyNameRegex(false))); + auto RegexExp = llvm::Regex(llvm::StringRef(validPropertyNameRegex(false))); return RegexExp.match(PropertyName.substr(Start + 1)); } } // namespace @@ -110,13 +110,12 @@ // this check should only be applied to ObjC sources. if (!getLangOpts().ObjC) return; - Finder->addMatcher( - objcPropertyDecl( - // the property name should be in Lower Camel Case like - // 'lowerCamelCase' - unless(matchesName(validPropertyNameRegex(true)))) - .bind("property"), - this); + Finder->addMatcher(objcPropertyDecl( + // the property name should be in Lower Camel Case like + // 'lowerCamelCase' + unless(matchesName(validPropertyNameRegex(true)))) + .bind("property"), + this); } void PropertyDeclarationCheck::check(const MatchFinder::MatchResult &Result) { Index: test/clang-tidy/objc-property-declaration.m =================================================================== --- test/clang-tidy/objc-property-declaration.m +++ test/clang-tidy/objc-property-declaration.m @@ -46,9 +46,10 @@ @property(strong, nonatomic) NSString *URLStr; @property(assign, nonatomic) int abc_camelCase; @property(strong, nonatomic) NSString *abc_URL; +@property(strong, nonatomic) NSString *opac2_sourceComponent; @end @interface Foo () @property(assign, nonatomic) int abc_inClassExtension; // CHECK-MESSAGES: :[[@LINE-1]]:34: warning: property name 'abc_inClassExtension' not using lowerCamelCase style or not prefixed in a category, according to the Apple Coding Guidelines [objc-property-declaration] @end \ No newline at end of file