clang-tools 10.0.0

FuchsiaTidyModule.cpp
Go to the documentation of this file.
1 //===--- FuchsiaTidyModule.cpp - clang-tidy -------------------------------===//
2 //
3 // 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
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "../ClangTidy.h"
10 #include "../ClangTidyModule.h"
11 #include "../ClangTidyModuleRegistry.h"
12 #include "../google/UnnamedNamespaceInHeaderCheck.h"
13 #include "DefaultArgumentsCallsCheck.h"
14 #include "DefaultArgumentsDeclarationsCheck.h"
15 #include "MultipleInheritanceCheck.h"
16 #include "OverloadedOperatorCheck.h"
17 #include "RestrictSystemIncludesCheck.h"
18 #include "StaticallyConstructedObjectsCheck.h"
19 #include "TrailingReturnCheck.h"
20 #include "VirtualInheritanceCheck.h"
21
22 using namespace clang::ast_matchers;
23
24 namespace clang {
25 namespace tidy {
26 namespace fuchsia {
27
28 /// This module is for Fuchsia-specific checks.
29 class FuchsiaModule : public ClangTidyModule {
30 public:
31 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
32 CheckFactories.registerCheck<DefaultArgumentsCallsCheck>(
33 "fuchsia-default-arguments-calls");
34 CheckFactories.registerCheck<DefaultArgumentsDeclarationsCheck>(
35 "fuchsia-default-arguments-declarations");
36 CheckFactories.registerCheck<google::build::UnnamedNamespaceInHeaderCheck>(
37 "fuchsia-header-anon-namespaces");
38 CheckFactories.registerCheck<MultipleInheritanceCheck>(
39 "fuchsia-multiple-inheritance");
40 CheckFactories.registerCheck<OverloadedOperatorCheck>(
41 "fuchsia-overloaded-operator");
42 CheckFactories.registerCheck<RestrictSystemIncludesCheck>(
43 "fuchsia-restrict-system-includes");
44 CheckFactories.registerCheck<StaticallyConstructedObjectsCheck>(
45 "fuchsia-statically-constructed-objects");
46 CheckFactories.registerCheck<TrailingReturnCheck>(
47 "fuchsia-trailing-return");
48 CheckFactories.registerCheck<VirtualInheritanceCheck>(
49 "fuchsia-virtual-inheritance");
50 }
51 };
52 // Register the FuchsiaTidyModule using this statically initialized variable.
53 static 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.
59 volatile int FuchsiaModuleAnchorSource = 0;
60
61 } // namespace tidy
62 } // namespace clang
clang::ast_matchers
Definition: AbseilMatcher.h:14
OverloadedOperatorCheck.h
VirtualInheritanceCheck.h
clang::tidy::ClangTidyCheckFactories::registerCheck
void registerCheck(StringRef CheckName)
Registers the CheckType with the name Name.
Definition: ClangTidyModule.h:58
DefaultArgumentsCallsCheck.h
DefaultArgumentsDeclarationsCheck.h
clang::tidy::fuchsia::RestrictSystemIncludesCheck
Checks for allowed includes and suggests removal of any others.
Definition: RestrictSystemIncludesCheck.h:24
clang::tidy::fuchsia::TrailingReturnCheck
Functions that have trailing returns are disallowed, except for those using decltype specifiers and l...
Definition: TrailingReturnCheck.h:24
clang::tidy::fuchsia::DefaultArgumentsCallsCheck
Default arguments are not allowed in called functions.
Definition: DefaultArgumentsCallsCheck.h:22
clang::tidy::ClangTidyCheckFactories
A collection of ClangTidyCheckFactory instances.
Definition: ClangTidyModule.h:27
RestrictSystemIncludesCheck.h
TrailingReturnCheck.h
clang::tidy::fuchsia::StaticallyConstructedObjectsCheck
Constructing global, non-trivial objects with static storage is disallowed, unless the object is stat...
Definition: StaticallyConstructedObjectsCheck.h:24
clang::tidy::fuchsia::VirtualInheritanceCheck
Defining classes with virtual inheritance is disallowed.
Definition: VirtualInheritanceCheck.h:22
clang::tidy::ClangTidyModule
A clang-tidy module groups a number of ClangTidyChecks and gives them a prefixed name.
Definition: ClangTidyModule.h:80
clang::tidy::google::build::UnnamedNamespaceInHeaderCheck
Finds anonymous namespaces in headers.
Definition: UnnamedNamespaceInHeaderCheck.h:32
clang::tidy::fuchsia::FuchsiaModule::addCheckFactories
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override
Implement this function in order to register all CheckFactories belonging to this module...
Definition: FuchsiaTidyModule.cpp:31
MultipleInheritanceCheck.h
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ApplyReplacements.h:27
clang::tidy::fuchsia::X
static ClangTidyModuleRegistry::Add< FuchsiaModule > X("fuchsia-module", "Adds Fuchsia platform checks.")
clang::tidy::fuchsia::OverloadedOperatorCheck
Overloading operators is disallowed by the Fuchsia coding standard.
Definition: OverloadedOperatorCheck.h:22
clang::tidy::fuchsia::DefaultArgumentsDeclarationsCheck
Default parameters are not allowed in declared functions.
Definition: DefaultArgumentsDeclarationsCheck.h:22
clang::tidy::fuchsia::FuchsiaModule
This module is for Fuchsia-specific checks.
Definition: FuchsiaTidyModule.cpp:29
clang::tidy::fuchsia::MultipleInheritanceCheck
Mulitple implementation inheritance is discouraged.
Definition: MultipleInheritanceCheck.h:22
StaticallyConstructedObjectsCheck.h
clang::tidy::FuchsiaModuleAnchorSource
volatile int FuchsiaModuleAnchorSource
Definition: FuchsiaTidyModule.cpp:59