1eb41cc61SPaula Toth //===--- LLVMLibcTidyModule.cpp - clang-tidy ------------------------------===// 2eb41cc61SPaula Toth // 3eb41cc61SPaula Toth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4eb41cc61SPaula Toth // See https://llvm.org/LICENSE.txt for license information. 5eb41cc61SPaula Toth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6eb41cc61SPaula Toth // 7eb41cc61SPaula Toth //===----------------------------------------------------------------------===// 8eb41cc61SPaula Toth 9eb41cc61SPaula Toth #include "../ClangTidy.h" 10eb41cc61SPaula Toth #include "../ClangTidyModule.h" 11eb41cc61SPaula Toth #include "../ClangTidyModuleRegistry.h" 128683f5deSPaula Toth #include "CalleeNamespaceCheck.h" 1300a57558SPaula Toth #include "ImplementationInNamespaceCheck.h" 14*b7b28c6cSSiva Chandra Reddy #include "InlineFunctionDeclCheck.h" 15eb41cc61SPaula Toth #include "RestrictSystemLibcHeadersCheck.h" 16eb41cc61SPaula Toth 177d2ea6c4SCarlos Galvez namespace clang::tidy { 18eb41cc61SPaula Toth namespace llvm_libc { 19eb41cc61SPaula Toth 20eb41cc61SPaula Toth class LLVMLibcModule : public ClangTidyModule { 21eb41cc61SPaula Toth public: addCheckFactories(ClangTidyCheckFactories & CheckFactories)22eb41cc61SPaula Toth void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { 238683f5deSPaula Toth CheckFactories.registerCheck<CalleeNamespaceCheck>( 248683f5deSPaula Toth "llvmlibc-callee-namespace"); 2500a57558SPaula Toth CheckFactories.registerCheck<ImplementationInNamespaceCheck>( 2600a57558SPaula Toth "llvmlibc-implementation-in-namespace"); 27*b7b28c6cSSiva Chandra Reddy CheckFactories.registerCheck<InlineFunctionDeclCheck>( 28*b7b28c6cSSiva Chandra Reddy "llvmlibc-inline-function-decl"); 29eb41cc61SPaula Toth CheckFactories.registerCheck<RestrictSystemLibcHeadersCheck>( 30eb41cc61SPaula Toth "llvmlibc-restrict-system-libc-headers"); 31eb41cc61SPaula Toth } 32eb41cc61SPaula Toth }; 33eb41cc61SPaula Toth 34eb41cc61SPaula Toth // Register the LLVMLibcTidyModule using this statically initialized variable. 35eb41cc61SPaula Toth static ClangTidyModuleRegistry::Add<LLVMLibcModule> 36eb41cc61SPaula Toth X("llvmlibc-module", "Adds LLVM libc standards checks."); 37eb41cc61SPaula Toth 38eb41cc61SPaula Toth } // namespace llvm_libc 39eb41cc61SPaula Toth 40eb41cc61SPaula Toth // This anchor is used to force the linker to link in the generated object file 41eb41cc61SPaula Toth // and thus register the LLVMLibcModule. 42eb41cc61SPaula Toth volatile int LLVMLibcModuleAnchorSource = 0; 43eb41cc61SPaula Toth 447d2ea6c4SCarlos Galvez } // namespace clang::tidy 45