diff options
-rw-r--r-- | clang-tools-extra/clang-tidy/objc/PropertyDeclarationCheck.cpp | 9 | ||||
-rw-r--r-- | clang-tools-extra/test/clang-tidy/objc-property-declaration.m | 1 |
2 files changed, 5 insertions, 5 deletions
diff --git a/clang-tools-extra/clang-tidy/objc/PropertyDeclarationCheck.cpp b/clang-tools-extra/clang-tidy/objc/PropertyDeclarationCheck.cpp index d460c6bbd5f..b772a5e6a0a 100644 --- a/clang-tools-extra/clang-tidy/objc/PropertyDeclarationCheck.cpp +++ b/clang-tools-extra/clang-tidy/objc/PropertyDeclarationCheck.cpp @@ -201,8 +201,7 @@ PropertyDeclarationCheck::PropertyDeclarationCheck(StringRef Name, 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 +234,9 @@ void PropertyDeclarationCheck::check(const MatchFinder::MatchResult &Result) { auto *DeclContext = MatchedDecl->getDeclContext(); auto *CategoryDecl = llvm::dyn_cast<ObjCCategoryDecl>(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 && diff --git a/clang-tools-extra/test/clang-tidy/objc-property-declaration.m b/clang-tools-extra/test/clang-tidy/objc-property-declaration.m index 7f70784d354..26e2f9a5281 100644 --- a/clang-tools-extra/test/clang-tidy/objc-property-declaration.m +++ b/clang-tools-extra/test/clang-tidy/objc-property-declaration.m @@ -38,6 +38,7 @@ // 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 () |