clang-tools 8.0.0

ZirconTidyModule.cpp
Go to the documentation of this file.
1 //===--- ZirconTidyModule.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"
13 #include "TemporaryObjectsCheck.h"
14
15 using namespace clang::ast_matchers;
16
17 namespace clang {
18 namespace tidy {
19 namespace zircon {
20
21 /// This module is for Zircon-specific checks.
22 class ZirconModule : public ClangTidyModule {
23 public:
24 void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
25 CheckFactories.registerCheck<TemporaryObjectsCheck>(
26 "zircon-temporary-objects");
27 }
28 };
29
30 // Register the ZirconTidyModule using this statically initialized variable.
31 static ClangTidyModuleRegistry::Add<ZirconModule>
32 X("zircon-module", "Adds Zircon kernel checks.");
33 } // namespace zircon
34
35 // This anchor is used to force the linker to link in the generated object file
36 // and thus register the ZirconModule.
37 volatile int ZirconModuleAnchorSource = 0;
38
39 } // namespace tidy
40 } // namespace clang
clang::ast_matchers
Definition: AbseilMatcher.h:15
clang::tidy::ClangTidyCheckFactories::registerCheck
void registerCheck(StringRef CheckName)
Registers the CheckType with the name Name.
Definition: ClangTidyModule.h:59
clang::tidy::zircon::ZirconModule::addCheckFactories
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override
Implement this function in order to register all CheckFactories belonging to this module...
Definition: ZirconTidyModule.cpp:24
clang::tidy::ClangTidyCheckFactories
A collection of ClangTidyCheckFactory instances.
Definition: ClangTidyModule.h:27
clang::tidy::zircon::ZirconModule
This module is for Zircon-specific checks.
Definition: ZirconTidyModule.cpp:22
clang::tidy::ClangTidyModule
A clang-tidy module groups a number of ClangTidyChecks and gives them a prefixed name.
Definition: ClangTidyModule.h:84
clang::tidy::ZirconModuleAnchorSource
volatile int ZirconModuleAnchorSource
Definition: ZirconTidyModule.cpp:37
TemporaryObjectsCheck.h
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ChangeNamespace.cpp:18
clang::tidy::zircon::X
static ClangTidyModuleRegistry::Add< ZirconModule > X("zircon-module", "Adds Zircon kernel checks.")
clang::tidy::zircon::TemporaryObjectsCheck
Construction of specific temporary objects in the Zircon kernel is discouraged.
Definition: TemporaryObjectsCheck.h:25