blob: 39872fa1c7d0476cd39d2d4f4361f33426826328 [file] [log] [blame]
Julie Hockettd9b3d082019-06-18 18:07:33 +00001//===--- FuchsiaTidyModule.cpp - clang-tidy -------------------------------===//
Aaron Ballmand3d78b92017-11-28 21:09:25 +00002//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// 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
Aaron Ballmand3d78b92017-11-28 21:09:25 +00006//
7//===----------------------------------------------------------------------===//
8
9#include "../ClangTidy.h"
10#include "../ClangTidyModule.h"
11#include "../ClangTidyModuleRegistry.h"
Julie Hockett8c1ee672018-04-10 16:53:51 +000012#include "../google/UnnamedNamespaceInHeaderCheck.h"
Julie Hockettd9b3d082019-06-18 18:07:33 +000013#include "DefaultArgumentsCallsCheck.h"
14#include "DefaultArgumentsDeclarationsCheck.h"
Julie Hockett587deb42018-01-19 23:59:59 +000015#include "MultipleInheritanceCheck.h"
Julie Hocketta966f452017-12-22 16:52:25 +000016#include "OverloadedOperatorCheck.h"
Julie Hockett1ee1f492018-01-11 21:17:43 +000017#include "StaticallyConstructedObjectsCheck.h"
Julie Hockett93a88e32018-01-17 21:18:15 +000018#include "TrailingReturnCheck.h"
Julie Hockett63b57db2017-12-15 18:54:28 +000019#include "VirtualInheritanceCheck.h"
Aaron Ballmand3d78b92017-11-28 21:09:25 +000020
21using namespace clang::ast_matchers;
22
23namespace clang {
24namespace tidy {
25namespace fuchsia {
26
Julie Hocketta0d50ce2017-12-05 18:50:49 +000027/// This module is for Fuchsia-specific checks.
Aaron Ballmand3d78b92017-11-28 21:09:25 +000028class FuchsiaModule : public ClangTidyModule {
29public:
30 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
Julie Hockettd9b3d082019-06-18 18:07:33 +000031 CheckFactories.registerCheck<DefaultArgumentsCallsCheck>(
32 "fuchsia-default-arguments-calls");
33 CheckFactories.registerCheck<DefaultArgumentsDeclarationsCheck>(
34 "fuchsia-default-arguments-declarations");
Julie Hockett8c1ee672018-04-10 16:53:51 +000035 CheckFactories.registerCheck<google::build::UnnamedNamespaceInHeaderCheck>(
36 "fuchsia-header-anon-namespaces");
Julie Hockett587deb42018-01-19 23:59:59 +000037 CheckFactories.registerCheck<MultipleInheritanceCheck>(
38 "fuchsia-multiple-inheritance");
Julie Hocketta966f452017-12-22 16:52:25 +000039 CheckFactories.registerCheck<OverloadedOperatorCheck>(
40 "fuchsia-overloaded-operator");
Julie Hockett1ee1f492018-01-11 21:17:43 +000041 CheckFactories.registerCheck<StaticallyConstructedObjectsCheck>(
42 "fuchsia-statically-constructed-objects");
Julie Hockett93a88e32018-01-17 21:18:15 +000043 CheckFactories.registerCheck<TrailingReturnCheck>(
44 "fuchsia-trailing-return");
Julie Hockett63b57db2017-12-15 18:54:28 +000045 CheckFactories.registerCheck<VirtualInheritanceCheck>(
46 "fuchsia-virtual-inheritance");
Aaron Ballmand3d78b92017-11-28 21:09:25 +000047 }
48};
49// Register the FuchsiaTidyModule using this statically initialized variable.
50static ClangTidyModuleRegistry::Add<FuchsiaModule>
51 X("fuchsia-module", "Adds Fuchsia platform checks.");
52} // namespace fuchsia
53
54// This anchor is used to force the linker to link in the generated object file
55// and thus register the FuchsiaModule.
56volatile int FuchsiaModuleAnchorSource = 0;
57
58} // namespace tidy
59} // namespace clang