xref: /llvm-project/clang-tools-extra/clang-tidy/google/GlobalVariableDeclarationCheck.h (revision 4718da506091a37ca4863d979bc541e359b79b10)
15529a244SHaojian Wu //===--- GlobalVariableDeclarationCheck.h - clang-tidy-----------*- C++ -*-===//
25529a244SHaojian Wu //
32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
65529a244SHaojian Wu //
75529a244SHaojian Wu //===----------------------------------------------------------------------===//
85529a244SHaojian Wu 
95529a244SHaojian Wu #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_OBJC_GLOBAL_VARIABLE_DECLARATION_H
105529a244SHaojian Wu #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_OBJC_GLOBAL_VARIABLE_DECLARATION_H
115529a244SHaojian Wu 
12478fc5c8SAlexander Kornienko #include "../ClangTidyCheck.h"
135529a244SHaojian Wu 
14*4718da50SCarlos Galvez namespace clang::tidy::google::objc {
155529a244SHaojian Wu 
165529a244SHaojian Wu /// The check for Objective-C global variables and constants naming convention.
175529a244SHaojian Wu /// The declaration should follow the patterns of 'k[A-Z].*' (constants) or
185529a244SHaojian Wu /// 'g[A-Z].*' (variables).
195529a244SHaojian Wu ///
205529a244SHaojian Wu /// For the user-facing documentation see:
216e566bc5SRichard /// http://clang.llvm.org/extra/clang-tidy/checks/google/objc-global-variable-declaration.html
225529a244SHaojian Wu class GlobalVariableDeclarationCheck : public ClangTidyCheck {
235529a244SHaojian Wu  public:
GlobalVariableDeclarationCheck(StringRef Name,ClangTidyContext * Context)245529a244SHaojian Wu   GlobalVariableDeclarationCheck(StringRef Name, ClangTidyContext *Context)
255529a244SHaojian Wu       : ClangTidyCheck(Name, Context) {}
isLanguageVersionSupported(const LangOptions & LangOpts)26e40a742aSNathan James   bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
27e40a742aSNathan James     return LangOpts.ObjC;
28e40a742aSNathan James   }
295529a244SHaojian Wu   void registerMatchers(ast_matchers::MatchFinder *Finder) override;
305529a244SHaojian Wu   void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
315529a244SHaojian Wu };
325529a244SHaojian Wu 
33*4718da50SCarlos Galvez } // namespace clang::tidy::google::objc
345529a244SHaojian Wu 
355529a244SHaojian Wu #endif  // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_GOOGLE_OBJC_GLOBAL_VARIABLE_DECLARATION_H
36