diff options
Diffstat (limited to 'clang-tools-extra/clang-tidy/google/FunctionNamingCheck.cpp')
| -rw-r--r-- | clang-tools-extra/clang-tidy/google/FunctionNamingCheck.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/clang-tools-extra/clang-tidy/google/FunctionNamingCheck.cpp b/clang-tools-extra/clang-tidy/google/FunctionNamingCheck.cpp index ce0e4e6..2b9183c 100644 --- a/clang-tools-extra/clang-tidy/google/FunctionNamingCheck.cpp +++ b/clang-tools-extra/clang-tidy/google/FunctionNamingCheck.cpp @@ -33,7 +33,7 @@ static std::string validFunctionNameRegex(bool RequirePrefix) { // If a prefix is required, the regex checks for a capital letter followed by // another capital letter or number that is part of the prefix and another // capital letter or number that begins the name following the prefix. - std::string FunctionNameMatcher = + const std::string FunctionNameMatcher = std::string(RequirePrefix ? "[A-Z][A-Z0-9]+" : "") + "[A-Z][a-zA-Z0-9]*"; return std::string("::(") + FunctionNameMatcher + ")$"; } @@ -48,13 +48,13 @@ static FixItHint generateFixItHint(const FunctionDecl *Decl) { if (Decl->getStorageClass() != SC_Static) return {}; - StringRef Name = Decl->getName(); + const StringRef Name = Decl->getName(); std::string NewName = Decl->getName().str(); size_t Index = 0; bool AtWordBoundary = true; while (Index < NewName.size()) { - char Ch = NewName[Index]; + const char Ch = NewName[Index]; if (isalnum(Ch)) { // Capitalize the first letter after every word boundary. if (AtWordBoundary) { @@ -101,7 +101,7 @@ void FunctionNamingCheck::registerMatchers(MatchFinder *Finder) { void FunctionNamingCheck::check(const MatchFinder::MatchResult &Result) { const auto *MatchedDecl = Result.Nodes.getNodeAs<FunctionDecl>("function"); - bool IsGlobal = MatchedDecl->getStorageClass() != SC_Static; + const bool IsGlobal = MatchedDecl->getStorageClass() != SC_Static; diag(MatchedDecl->getLocation(), "%select{static function|function in global namespace}1 named %0 must " "%select{be in|have an appropriate prefix followed by}1 Pascal case as " |
