Victor Chernyakin 1bcf74006b
[clang-tidy] Merge ClangTidyModuleRegistry.h into ClangTidyModule.h (#173231)
As far as I can tell, the only effect of having
`ClangTidyModuleRegistry.h` be a separate header is that it forces you
to include two headers instead of one before you can actually define
your clang-tidy module.
2025-12-23 15:06:47 -06:00

40 lines
1.3 KiB
C++

//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "../ClangTidy.h"
#include "../ClangTidyModule.h"
#include "MustCheckErrsCheck.h"
namespace clang::tidy {
namespace linuxkernel {
namespace {
/// This module is for checks specific to the Linux kernel.
class LinuxKernelModule : public ClangTidyModule {
public:
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
CheckFactories.registerCheck<MustCheckErrsCheck>(
"linuxkernel-must-check-errs");
}
};
} // namespace
// Register the LinuxKernelTidyModule using this statically initialized
// variable.
static ClangTidyModuleRegistry::Add<LinuxKernelModule>
X("linux-module", "Adds checks specific to the Linux kernel.");
} // namespace linuxkernel
// This anchor is used to force the linker to link in the generated object file
// and thus register the LinuxKernelModule.
// NOLINTNEXTLINE(misc-use-internal-linkage)
volatile int LinuxKernelModuleAnchorSource = 0;
} // namespace clang::tidy