//===--- PropertyDeclarationCheck.cpp - clang-tidy-------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "PropertyDeclarationCheck.h" #include "../utils/OptionsUtils.h" #include "clang/AST/ASTContext.h" #include "clang/ASTMatchers/ASTMatchFinder.h" #include "clang/Basic/CharInfo.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Support/Regex.h" #include <algorithm> usingnamespaceclang::ast_matchers; namespace clang::tidy::objc { namespace { // For StandardProperty the naming style is 'lowerCamelCase'. // For CategoryProperty especially in categories of system class, // to avoid naming conflict, the suggested naming style is // 'abc_lowerCamelCase' (adding lowercase prefix followed by '_'). // Regardless of the style, all acronyms and initialisms should be capitalized. enum NamingStyle { … }; /// For now we will only fix 'CamelCase' or 'abc_CamelCase' property to /// 'camelCase' or 'abc_camelCase'. For other cases the users need to /// come up with a proper name by their own. /// FIXME: provide fix for snake_case to snakeCase FixItHint generateFixItHint(const ObjCPropertyDecl *Decl, NamingStyle Style) { … } std::string validPropertyNameRegex(bool UsedInMatcher) { … } bool hasCategoryPropertyPrefix(llvm::StringRef PropertyName) { … } bool prefixedPropertyNameValid(llvm::StringRef PropertyName) { … } } // namespace void PropertyDeclarationCheck::registerMatchers(MatchFinder *Finder) { … } void PropertyDeclarationCheck::check(const MatchFinder::MatchResult &Result) { … } } // namespace clang::tidy::objc