blob: 0d3bbfe7475a4cbefd240a20ce7fecc565c86929 [file] [log] [blame]
Aaron Ballmand3d78b92017-11-28 21:09:25 +00001//===--- FuchsiaTidyModule.cpp - clang-tidy--------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "../ClangTidy.h"
11#include "../ClangTidyModule.h"
12#include "../ClangTidyModuleRegistry.h"
Julie Hockett8c1ee672018-04-10 16:53:51 +000013#include "../google/UnnamedNamespaceInHeaderCheck.h"
Aaron Ballmand3d78b92017-11-28 21:09:25 +000014#include "DefaultArgumentsCheck.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 {
32 CheckFactories.registerCheck<DefaultArgumentsCheck>(
33 "fuchsia-default-arguments");
Julie Hockett8c1ee672018-04-10 16:53:51 +000034 CheckFactories.registerCheck<google::build::UnnamedNamespaceInHeaderCheck>(
35 "fuchsia-header-anon-namespaces");
Julie Hockett587deb42018-01-19 23:59:59 +000036 CheckFactories.registerCheck<MultipleInheritanceCheck>(
37 "fuchsia-multiple-inheritance");
Julie Hocketta966f452017-12-22 16:52:25 +000038 CheckFactories.registerCheck<OverloadedOperatorCheck>(
39 "fuchsia-overloaded-operator");
Julie Hockettf108a8f2018-05-11 21:08:59 +000040 CheckFactories.registerCheck<RestrictSystemIncludesCheck>(
41 "fuchsia-restrict-system-includes");
Julie Hockett1ee1f492018-01-11 21:17:43 +000042 CheckFactories.registerCheck<StaticallyConstructedObjectsCheck>(
43 "fuchsia-statically-constructed-objects");
Julie Hockett93a88e32018-01-17 21:18:15 +000044 CheckFactories.registerCheck<TrailingReturnCheck>(
45 "fuchsia-trailing-return");
Julie Hockett63b57db2017-12-15 18:54:28 +000046 CheckFactories.registerCheck<VirtualInheritanceCheck>(
47 "fuchsia-virtual-inheritance");
Aaron Ballmand3d78b92017-11-28 21:09:25 +000048 }
49};
50// Register the FuchsiaTidyModule using this statically initialized variable.
51static ClangTidyModuleRegistry::Add<FuchsiaModule>
52 X("fuchsia-module", "Adds Fuchsia platform checks.");
53} // namespace fuchsia
54
55// This anchor is used to force the linker to link in the generated object file
56// and thus register the FuchsiaModule.
57volatile int FuchsiaModuleAnchorSource = 0;
58
59} // namespace tidy
60} // namespace clang