136206206SYan Wang //===--- AndroidTidyModule.cpp - clang-tidy--------------------------------===// 236206206SYan Wang // 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 636206206SYan Wang // 736206206SYan Wang //===----------------------------------------------------------------------===// 836206206SYan Wang 936206206SYan Wang #include "../ClangTidy.h" 1036206206SYan Wang #include "../ClangTidyModule.h" 1136206206SYan Wang #include "../ClangTidyModuleRegistry.h" 125ac20c9cSChih-Hung Hsieh #include "CloexecAccept4Check.h" 13ae3527e6SChih-Hung Hsieh #include "CloexecAcceptCheck.h" 140b974147SYan Wang #include "CloexecCreatCheck.h" 15e0c2c49aSGeorge Burgess IV #include "CloexecDupCheck.h" 163be4ecb1SChih-Hung Hsieh #include "CloexecEpollCreate1Check.h" 1741d29b15SChih-Hung Hsieh #include "CloexecEpollCreateCheck.h" 1824340252SYan Wang #include "CloexecFopenCheck.h" 197651e66cSChih-Hung Hsieh #include "CloexecInotifyInit1Check.h" 202e6f9a16SChih-Hung Hsieh #include "CloexecInotifyInitCheck.h" 21b21739f9SYan Wang #include "CloexecMemfdCreateCheck.h" 22600a6133SYan Wang #include "CloexecOpenCheck.h" 233da331b4SGeorge Burgess IV #include "CloexecPipe2Check.h" 24ab2d3ce4SAlexander Kornienko #include "CloexecPipeCheck.h" 25b38045d0SYan Wang #include "CloexecSocketCheck.h" 263b151b21SGeorge Burgess IV #include "ComparisonInTempFailureRetryCheck.h" 2736206206SYan Wang 2836206206SYan Wang using namespace clang::ast_matchers; 2936206206SYan Wang 30*7d2ea6c4SCarlos Galvez namespace clang::tidy { 3136206206SYan Wang namespace android { 3236206206SYan Wang 3336206206SYan Wang /// This module is for Android specific checks. 3436206206SYan Wang class AndroidModule : public ClangTidyModule { 3536206206SYan Wang public: addCheckFactories(ClangTidyCheckFactories & CheckFactories)3636206206SYan Wang void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { 375ac20c9cSChih-Hung Hsieh CheckFactories.registerCheck<CloexecAccept4Check>("android-cloexec-accept4"); 38ae3527e6SChih-Hung Hsieh CheckFactories.registerCheck<CloexecAcceptCheck>("android-cloexec-accept"); 390b974147SYan Wang CheckFactories.registerCheck<CloexecCreatCheck>("android-cloexec-creat"); 4004d38c5fSEugene Zelenko CheckFactories.registerCheck<CloexecDupCheck>("android-cloexec-dup"); 413be4ecb1SChih-Hung Hsieh CheckFactories.registerCheck<CloexecEpollCreate1Check>( 423be4ecb1SChih-Hung Hsieh "android-cloexec-epoll-create1"); 4341d29b15SChih-Hung Hsieh CheckFactories.registerCheck<CloexecEpollCreateCheck>( 4441d29b15SChih-Hung Hsieh "android-cloexec-epoll-create"); 4524340252SYan Wang CheckFactories.registerCheck<CloexecFopenCheck>("android-cloexec-fopen"); 467651e66cSChih-Hung Hsieh CheckFactories.registerCheck<CloexecInotifyInit1Check>( 477651e66cSChih-Hung Hsieh "android-cloexec-inotify-init1"); 4804d38c5fSEugene Zelenko CheckFactories.registerCheck<CloexecInotifyInitCheck>( 4904d38c5fSEugene Zelenko "android-cloexec-inotify-init"); 50b21739f9SYan Wang CheckFactories.registerCheck<CloexecMemfdCreateCheck>( 51b21739f9SYan Wang "android-cloexec-memfd-create"); 52600a6133SYan Wang CheckFactories.registerCheck<CloexecOpenCheck>("android-cloexec-open"); 535b2a85d0SGeorge Burgess IV CheckFactories.registerCheck<CloexecPipeCheck>("android-cloexec-pipe"); 543da331b4SGeorge Burgess IV CheckFactories.registerCheck<CloexecPipe2Check>("android-cloexec-pipe2"); 55b38045d0SYan Wang CheckFactories.registerCheck<CloexecSocketCheck>("android-cloexec-socket"); 563b151b21SGeorge Burgess IV CheckFactories.registerCheck<ComparisonInTempFailureRetryCheck>( 573b151b21SGeorge Burgess IV "android-comparison-in-temp-failure-retry"); 5836206206SYan Wang } 5936206206SYan Wang }; 6036206206SYan Wang 6136206206SYan Wang // Register the AndroidTidyModule using this statically initialized variable. 6236206206SYan Wang static ClangTidyModuleRegistry::Add<AndroidModule> 6336206206SYan Wang X("android-module", "Adds Android platform checks."); 6436206206SYan Wang 6536206206SYan Wang } // namespace android 6636206206SYan Wang 6736206206SYan Wang // This anchor is used to force the linker to link in the generated object file 6836206206SYan Wang // and thus register the AndroidModule. 6936206206SYan Wang volatile int AndroidModuleAnchorSource = 0; 7036206206SYan Wang 71*7d2ea6c4SCarlos Galvez } // namespace clang::tidy 72