Index: clang-tidy/objc/PropertyDeclarationCheck.cpp =================================================================== --- clang-tidy/objc/PropertyDeclarationCheck.cpp +++ clang-tidy/objc/PropertyDeclarationCheck.cpp @@ -39,92 +39,16 @@ /// /// Keep this list sorted. constexpr llvm::StringLiteral DefaultSpecialAcronyms[] = { - "[2-9]G", - "ACL", - "API", - "APN", - "APNS", - "AR", - "ARGB", - "ASCII", - "AV", - "BGRA", - "CA", - "CDN", - "CF", - "CG", - "CI", - "CRC", - "CV", - "CMYK", - "DNS", - "FPS", - "FTP", - "GIF", - "GL", - "GPS", - "GUID", - "HD", - "HDR", - "HMAC", - "HTML", - "HTTP", - "HTTPS", - "HUD", - "ID", - "JPG", - "JS", - "JSON", - "LAN", - "LZW", - "LTR", - "MAC", - "MD", - "MDNS", - "MIDI", - "NS", - "OS", - "P2P", - "PDF", - "PIN", - "PNG", - "POI", - "PSTN", - "PTR", - "QA", - "QOS", - "RGB", - "RGBA", - "RGBX", - "RIPEMD", - "ROM", - "RPC", - "RTF", - "RTL", - "SC", - "SDK", - "SHA", - "SQL", - "SSO", - "TCP", - "TIFF", - "TOS", - "TTS", - "UI", - "URI", - "URL", - "UUID", - "VC", - "VO", - "VOIP", - "VPN", - "VR", - "W", - "WAN", - "X", - "XML", - "Y", - "Z", + "[2-9]G", "ACL", "API", "APN", "APNS", "AR", "ARGB", "ASCII", "AV", + "BGRA", "CA", "CDN", "CF", "CG", "CI", "CRC", "CV", "CMYK", + "DNS", "FPS", "FTP", "GIF", "GL", "GPS", "GUID", "HD", "HDR", + "HMAC", "HTML", "HTTP", "HTTPS", "HUD", "ID", "JPG", "JS", "JSON", + "LAN", "LZW", "LTR", "MAC", "MD", "MDNS", "MIDI", "NS", "OS", + "P2P", "PDF", "PIN", "PNG", "POI", "PSTN", "PTR", "QA", "QOS", + "RGB", "RGBA", "RGBX", "RIPEMD", "ROM", "RPC", "RTF", "RTL", "SC", + "SDK", "SHA", "SQL", "SSO", "TCP", "TIFF", "TOS", "TTS", "UI", + "URI", "URL", "UUID", "VC", "VO", "VOIP", "VPN", "VR", "W", + "WAN", "X", "XML", "Y", "Z", }; /// For now we will only fix 'CamelCase' or 'abc_CamelCase' property to @@ -201,8 +125,7 @@ void PropertyDeclarationCheck::registerMatchers(MatchFinder *Finder) { // this check should only be applied to ObjC sources. - if (!getLangOpts().ObjC) - return; + if (!getLangOpts().ObjC) return; if (IncludeDefaultAcronyms) { EscapedAcronyms.reserve(llvm::array_lengthof(DefaultSpecialAcronyms) + @@ -235,9 +158,9 @@ auto *DeclContext = MatchedDecl->getDeclContext(); auto *CategoryDecl = llvm::dyn_cast(DeclContext); - auto AcronymsRegex = - llvm::Regex("^" + AcronymsGroupRegex(EscapedAcronyms) + "$"); - if (AcronymsRegex.match(MatchedDecl->getName())) { + auto SingleAcronymRegex = + llvm::Regex("^([a-zA-Z]+_)?" + AcronymsGroupRegex(EscapedAcronyms) + "$"); + if (SingleAcronymRegex.match(MatchedDecl->getName())) { return; } if (CategoryDecl != nullptr && Index: test/clang-tidy/objc-property-declaration.m =================================================================== --- test/clang-tidy/objc-property-declaration.m +++ test/clang-tidy/objc-property-declaration.m @@ -38,9 +38,10 @@ // CHECK-MESSAGES: :[[@LINE-1]]:34: warning: property name 'wrongFormat_' not using lowerCamelCase style or not prefixed in a category, according to the Apple Coding Guidelines [objc-property-declaration] @property(strong, nonatomic) NSString *URLStr; @property(assign, nonatomic) int abc_camelCase; +@property(strong, nonatomic) NSString *abc_URL; @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