blob: 9874cae17d3486f34970c2b26c37c8f750bfcb0b [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"
12#include "RestrictSystemLibcHeadersCheck.h"
13
14namespace clang {
15namespace tidy {
16namespace llvm_libc {
17
18class LLVMLibcModule : public ClangTidyModule {
19public:
20 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
21 CheckFactories.registerCheck<RestrictSystemLibcHeadersCheck>(
22 "llvmlibc-restrict-system-libc-headers");
23 }
24};
25
26// Register the LLVMLibcTidyModule using this statically initialized variable.
27static ClangTidyModuleRegistry::Add<LLVMLibcModule>
28 X("llvmlibc-module", "Adds LLVM libc standards checks.");
29
30} // namespace llvm_libc
31
32// This anchor is used to force the linker to link in the generated object file
33// and thus register the LLVMLibcModule.
34volatile int LLVMLibcModuleAnchorSource = 0;
35
36} // namespace tidy
37} // namespace clang