clang-tools  14.0.0git
LLVMLibcTidyModule.cpp
Go to the documentation of this file.
1 //===--- 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 "CalleeNamespaceCheck.h"
15 
16 namespace clang {
17 namespace tidy {
18 namespace llvm_libc {
19 
21 public:
22  void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
23  CheckFactories.registerCheck<CalleeNamespaceCheck>(
24  "llvmlibc-callee-namespace");
26  "llvmlibc-implementation-in-namespace");
28  "llvmlibc-restrict-system-libc-headers");
29  }
30 };
31 
32 // Register the LLVMLibcTidyModule using this statically initialized variable.
33 static ClangTidyModuleRegistry::Add<LLVMLibcModule>
34  X("llvmlibc-module", "Adds LLVM libc standards checks.");
35 
36 } // namespace llvm_libc
37 
38 // This anchor is used to force the linker to link in the generated object file
39 // and thus register the LLVMLibcModule.
40 volatile int LLVMLibcModuleAnchorSource = 0;
41 
42 } // namespace tidy
43 } // namespace clang
clang::tidy::llvm_libc::LLVMLibcModule::addCheckFactories
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override
Implement this function in order to register all CheckFactories belonging to this module.
Definition: LLVMLibcTidyModule.cpp:22
clang::tidy::llvm_libc::RestrictSystemLibcHeadersCheck
Warns of accidental inclusions of system libc headers that aren't compiler provided.
Definition: RestrictSystemLibcHeadersCheck.h:24
clang::tidy::llvm_libc::ImplementationInNamespaceCheck
Checks all llvm-libc implementation is within the correct namespace.
Definition: ImplementationInNamespaceCheck.h:22
clang::tidy::LLVMLibcModuleAnchorSource
volatile int LLVMLibcModuleAnchorSource
Definition: LLVMLibcTidyModule.cpp:40
clang::tidy::llvm_libc::LLVMLibcModule
Definition: LLVMLibcTidyModule.cpp:20
clang::tidy::ClangTidyCheckFactories
A collection of ClangTidyCheckFactory instances.
Definition: ClangTidyModule.h:28
CalleeNamespaceCheck.h
RestrictSystemLibcHeadersCheck.h
clang::tidy::llvm_libc::X
static ClangTidyModuleRegistry::Add< LLVMLibcModule > X("llvmlibc-module", "Adds LLVM libc standards checks.")
clang::tidy::llvm_libc::CalleeNamespaceCheck
Checks all calls resolve to functions within __llvm_libc namespace.
Definition: CalleeNamespaceCheck.h:22
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ApplyReplacements.h:27
clang::tidy::ClangTidyModule
A clang-tidy module groups a number of ClangTidyChecks and gives them a prefixed name.
Definition: ClangTidyModule.h:81
ImplementationInNamespaceCheck.h
clang::tidy::ClangTidyCheckFactories::registerCheck
void registerCheck(llvm::StringRef CheckName)
Registers the CheckType with the name Name.
Definition: ClangTidyModule.h:59