blob: 8c5a7ac2016163bacf9a97a9c975191a1db9c12c [file] [log] [blame]
Paula Totheb41cc62020-03-12 11:38:05 -07001//===--- LLVMLibcTidyModule.cpp - clang-tidy ------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "../ClangTidy.h"
10#include "../ClangTidyModule.h"
11#include "../ClangTidyModuleRegistry.h"
Paula Toth00a57552020-04-06 10:40:50 -070012#include "ImplementationInNamespaceCheck.h"
Paula Totheb41cc62020-03-12 11:38:05 -070013#include "RestrictSystemLibcHeadersCheck.h"
14
15namespace clang {
16namespace tidy {
17namespace llvm_libc {
18
19class LLVMLibcModule : public ClangTidyModule {
20public:
21 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
Paula Toth00a57552020-04-06 10:40:50 -070022 CheckFactories.registerCheck<ImplementationInNamespaceCheck>(
23 "llvmlibc-implementation-in-namespace");
Paula Totheb41cc62020-03-12 11:38:05 -070024 CheckFactories.registerCheck<RestrictSystemLibcHeadersCheck>(
25 "llvmlibc-restrict-system-libc-headers");
26 }
27};
28
29// Register the LLVMLibcTidyModule using this statically initialized variable.
30static ClangTidyModuleRegistry::Add<LLVMLibcModule>
31 X("llvmlibc-module", "Adds LLVM libc standards checks.");
32
33} // namespace llvm_libc
34
35// This anchor is used to force the linker to link in the generated object file
36// and thus register the LLVMLibcModule.
37volatile int LLVMLibcModuleAnchorSource = 0;
38
39} // namespace tidy
40} // namespace clang