xref: /llvm-project/clang-tools-extra/clang-tidy/android/AndroidTidyModule.cpp (revision 36206206cdb20b17f8cf80b10b483af6efd4880e)
1 //===--- AndroidTidyModule.cpp - clang-tidy--------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "../ClangTidy.h"
11 #include "../ClangTidyModule.h"
12 #include "../ClangTidyModuleRegistry.h"
13 #include "FileOpenFlagCheck.h"
14 
15 using namespace clang::ast_matchers;
16 
17 namespace clang {
18 namespace tidy {
19 namespace android {
20 
21 /// This module is for Android specific checks.
22 class AndroidModule : public ClangTidyModule {
23 public:
24   void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
25     CheckFactories.registerCheck<FileOpenFlagCheck>("android-file-open-flag");
26   }
27 };
28 
29 // Register the AndroidTidyModule using this statically initialized variable.
30 static ClangTidyModuleRegistry::Add<AndroidModule>
31     X("android-module", "Adds Android platform checks.");
32 
33 } // namespace android
34 
35 // This anchor is used to force the linker to link in the generated object file
36 // and thus register the AndroidModule.
37 volatile int AndroidModuleAnchorSource = 0;
38 
39 } // namespace tidy
40 } // namespace clang
41