blob: c59ec85468c3fe155d89a14ac9da323b18d90917 [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 Hockettf108a8f2018-05-11 21:08:59 +000017#include "RestrictSystemIncludesCheck.h"
Julie Hockett1ee1f492018-01-11 21:17:43 +000018#include "StaticallyConstructedObjectsCheck.h"
Julie Hockett93a88e32018-01-17 21:18:15 +000019#include "TrailingReturnCheck.h"
Julie Hockett63b57db2017-12-15 18:54:28 +000020#include "VirtualInheritanceCheck.h"
Aaron Ballmand3d78b92017-11-28 21:09:25 +000021
22using namespace clang::ast_matchers;
23
24namespace clang {
25namespace tidy {
26namespace fuchsia {
27
Julie Hocketta0d50ce2017-12-05 18:50:49 +000028/// This module is for Fuchsia-specific checks.
Aaron Ballmand3d78b92017-11-28 21:09:25 +000029class FuchsiaModule : public ClangTidyModule {
30public:
31 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
Julie Hockettd9b3d082019-06-18 18:07:33 +000032 CheckFactories.registerCheck<DefaultArgumentsCallsCheck>(
33 "fuchsia-default-arguments-calls");
34 CheckFactories.registerCheck<DefaultArgumentsDeclarationsCheck>(
35 "fuchsia-default-arguments-declarations");
Julie Hockett8c1ee672018-04-10 16:53:51 +000036 CheckFactories.registerCheck<google::build::UnnamedNamespaceInHeaderCheck>(
37 "fuchsia-header-anon-namespaces");
Julie Hockett587deb42018-01-19 23:59:59 +000038 CheckFactories.registerCheck<MultipleInheritanceCheck>(
39 "fuchsia-multiple-inheritance");
Julie Hocketta966f452017-12-22 16:52:25 +000040 CheckFactories.registerCheck<OverloadedOperatorCheck>(
41 "fuchsia-overloaded-operator");
Julie Hockettf108a8f2018-05-11 21:08:59 +000042 CheckFactories.registerCheck<RestrictSystemIncludesCheck>(
43 "fuchsia-restrict-system-includes");
Julie Hockett1ee1f492018-01-11 21:17:43 +000044 CheckFactories.registerCheck<StaticallyConstructedObjectsCheck>(
45 "fuchsia-statically-constructed-objects");
Julie Hockett93a88e32018-01-17 21:18:15 +000046 CheckFactories.registerCheck<TrailingReturnCheck>(
47 "fuchsia-trailing-return");
Julie Hockett63b57db2017-12-15 18:54:28 +000048 CheckFactories.registerCheck<VirtualInheritanceCheck>(
49 "fuchsia-virtual-inheritance");
Aaron Ballmand3d78b92017-11-28 21:09:25 +000050 }
51};
52// Register the FuchsiaTidyModule using this statically initialized variable.
53static ClangTidyModuleRegistry::Add<FuchsiaModule>
54 X("fuchsia-module", "Adds Fuchsia platform checks.");
55} // namespace fuchsia
56
57// This anchor is used to force the linker to link in the generated object file
58// and thus register the FuchsiaModule.
59volatile int FuchsiaModuleAnchorSource = 0;
60
61} // namespace tidy
62} // namespace clang