clang-tools 20.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"
16
17namespace clang::tidy {
18namespace llvm_libc {
19
21public:
22 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
23 CheckFactories.registerCheck<CalleeNamespaceCheck>(
24 "llvmlibc-callee-namespace");
26 "llvmlibc-implementation-in-namespace");
28 "llvmlibc-inline-function-decl");
30 "llvmlibc-restrict-system-libc-headers");
31 }
32};
33
34// Register the LLVMLibcTidyModule using this statically initialized variable.
35static ClangTidyModuleRegistry::Add<LLVMLibcModule>
36 X("llvmlibc-module", "Adds LLVM libc standards checks.");
37
38} // namespace llvm_libc
39
40// This anchor is used to force the linker to link in the generated object file
41// and thus register the LLVMLibcModule.
43
44} // namespace clang::tidy
int X
A collection of ClangTidyCheckFactory instances.
void registerCheck(llvm::StringRef CheckName)
Registers the CheckType with the name Name.
A clang-tidy module groups a number of ClangTidyChecks and gives them a prefixed name.
Checks all calls resolve to functions within __llvm_libc namespace.
Checks all llvm-libc implementation is within the correct namespace.
Checks that explicitly and implicitly inline functions in headers files are tagged with the LIBC_INLI...
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override
Implement this function in order to register all CheckFactories belonging to this module.
Warns of accidental inclusions of system libc headers that aren't compiler provided.
volatile int LLVMLibcModuleAnchorSource