aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/clang-tidy/objc/PropertyDeclarationCheck.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clang-tidy/objc/PropertyDeclarationCheck.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/objc/PropertyDeclarationCheck.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/clang-tools-extra/clang-tidy/objc/PropertyDeclarationCheck.cpp b/clang-tools-extra/clang-tidy/objc/PropertyDeclarationCheck.cpp
index 4a586c8..690572f 100644
--- a/clang-tools-extra/clang-tidy/objc/PropertyDeclarationCheck.cpp
+++ b/clang-tools-extra/clang-tidy/objc/PropertyDeclarationCheck.cpp
@@ -39,7 +39,7 @@ static FixItHint generateFixItHint(const ObjCPropertyDecl *Decl,
auto NewName = Decl->getName().str();
size_t Index = 0;
if (Style == CategoryProperty) {
- size_t UnderScorePos = Name.find_first_of('_');
+ const size_t UnderScorePos = Name.find_first_of('_');
if (UnderScorePos != llvm::StringRef::npos) {
Index = UnderScorePos + 1;
NewName.replace(0, Index - 1, Name.substr(0, Index - 1).lower());
@@ -74,7 +74,7 @@ static std::string validPropertyNameRegex(bool UsedInMatcher) {
//
// aRbITRaRyCapS is allowed to avoid generating false positives for names
// like isVitaminBSupplement, CProgrammingLanguage, and isBeforeM.
- std::string StartMatcher = UsedInMatcher ? "::" : "^";
+ const std::string StartMatcher = UsedInMatcher ? "::" : "^";
return StartMatcher + "([a-z]|[A-Z][A-Z0-9])[a-z0-9A-Z]*$";
}
@@ -85,7 +85,7 @@ static bool hasCategoryPropertyPrefix(llvm::StringRef PropertyName) {
}
static bool prefixedPropertyNameValid(llvm::StringRef PropertyName) {
- size_t Start = PropertyName.find_first_of('_');
+ const size_t Start = PropertyName.find_first_of('_');
assert(Start != llvm::StringRef::npos && Start + 1 < PropertyName.size());
auto Prefix = PropertyName.substr(0, Start);
if (Prefix.lower() != Prefix) {
@@ -115,8 +115,9 @@ void PropertyDeclarationCheck::check(const MatchFinder::MatchResult &Result) {
hasCategoryPropertyPrefix(MatchedDecl->getName())) {
if (!prefixedPropertyNameValid(MatchedDecl->getName()) ||
CategoryDecl->IsClassExtension()) {
- NamingStyle Style = CategoryDecl->IsClassExtension() ? StandardProperty
- : CategoryProperty;
+ const NamingStyle Style = CategoryDecl->IsClassExtension()
+ ? StandardProperty
+ : CategoryProperty;
diag(MatchedDecl->getLocation(),
"property name '%0' not using lowerCamelCase style or not prefixed "
"in a category, according to the Apple Coding Guidelines")