refactor(tidy)!: rebuild fairmq-tidy on top of clang-tidy

- Implement the checks as a clang-tidy module (object library
  fairmq-tidy-module) instead of a standalone LibTooling program.
- Build fairmq-tidy from clangTidyMain plus the module. It gets all
  clang-tidy features: --fix, --export-fixes, .clang-tidy files, NOLINT,
  header filter, and the upstream checks on the same parse.
- Without a --checks option, add fairmq-* to the configured checks.
- Point the driver to the resource directory of the LLVM installation it
  was built with, so it finds the Clang builtin headers from any install
  location. The -I hint in fairmq_target_tidy() is no longer necessary.
- Add the include directories of LLVM and Clang. The old target compiled
  only where they are in /usr/include.
- Port fairmq-modernize-nonnamespaced-types. Match deprecated global
  aliases into fair::mq instead of the name prefix "FairMQ": this also
  finds e.g. InputMsgCallback and skips aliases that are not deprecated.
  Match only the TypedefTypeLoc, so each use is reported once.

BREAKING CHANGE: fairmq-tidy takes the options of clang-tidy and reads
.clang-tidy files. With no .clang-tidy file it now also runs the default
clang-tidy checks (clang-diagnostic-*, clang-analyzer-*).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Claude
2026-11-09 22:38:46 +00:00
parent 2fea52a071
commit cbcd0d3324
8 changed files with 223 additions and 199 deletions

35
fairmq/tidy/Module.cxx Normal file
View File

@@ -0,0 +1,35 @@
/********************************************************************************
* Copyright (C) 2026 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#include <fairmq/tidy/NonNamespacedTypesCheck.h>
#include <clang-tidy/ClangTidyModule.h>
#include <clang-tidy/ClangTidyModuleRegistry.h>
namespace fair::mq::tidy {
/// The `fairmq-*` checks as a clang-tidy module. Every front end links this
/// module: the `fairmq-tidy` executable and, later, the plugin and clangd.
class Module : public clang::tidy::ClangTidyModule
{
public:
void addCheckFactories(clang::tidy::ClangTidyCheckFactories& factories) override
{
factories.registerCheck<NonNamespacedTypesCheck>("fairmq-modernize-nonnamespaced-types");
}
};
} // namespace fair::mq::tidy
static clang::tidy::ClangTidyModuleRegistry::Add<fair::mq::tidy::Module>
fairmqModule("fairmq-module", "Adds the FairMQ checks.");
// A front end that links this module statically references this symbol, so
// the linker keeps the registration above.
// NOLINTNEXTLINE(misc-use-internal-linkage)
volatile int FairMQTidyModuleAnchorSource = 0;