clang-tools 8.0.0

TemporaryObjectsCheck.h
Go to the documentation of this file.
1 //===--- TemporaryObjectsCheck.h - clang-tidy------------------*- C++ -*-===//
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 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ZIRCON_TEMPORARYOBJECTSCHECK_H
11 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ZIRCON_TEMPORARYOBJECTSCHECK_H
12
13 #include "../ClangTidy.h"
14 #include "../utils/OptionsUtils.h"
15
16 namespace clang {
17 namespace tidy {
18 namespace zircon {
19
20 /// Construction of specific temporary objects in the Zircon kernel is
21 /// discouraged.
22 ///
23 /// For the user-facing documentation see:
24 /// http://clang.llvm.org/extra/clang-tidy/checks/zircon-temporary-objects.html
25 class TemporaryObjectsCheck : public ClangTidyCheck {
26 public:
27 TemporaryObjectsCheck(StringRef Name, ClangTidyContext *Context)
28 : ClangTidyCheck(Name, Context),
29 Names(utils::options::parseStringList(Options.get("Names", ""))) {}
30 void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
31 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
32 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
33
34 private:
35 std::vector<std::string> Names;
36 };
37
38 } // namespace zircon
39 } // namespace tidy
40 } // namespace clang
41
42 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ZIRCON_TEMPORARYOBJECTSCHECK_H
clang::tidy::ClangTidyCheck
Base class for all clang-tidy checks.
Definition: ClangTidy.h:127
clang::tidy::utils::options::parseStringList
std::vector< std::string > parseStringList(StringRef Option)
Parse a semicolon separated list of strings.
Definition: OptionsUtils.cpp:19
clang::tidy::ClangTidyCheck::Options
OptionsView Options
Definition: ClangTidy.h:183
clang::tidy::zircon::TemporaryObjectsCheck::registerMatchers
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
Definition: TemporaryObjectsCheck.cpp:30
Name
static constexpr llvm::StringLiteral Name
Definition: UppercaseLiteralSuffixCheck.cpp:28
clang::tidy::ClangTidyOptions::OptionMap
std::map< std::string, std::string > OptionMap
Definition: ClangTidyOptions.h:98
Result
llvm::Optional< llvm::Expected< tooling::AtomicChanges > > Result
Definition: ClangdServer.cpp:60
clang::tidy::zircon::TemporaryObjectsCheck::check
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
Definition: TemporaryObjectsCheck.cpp:47
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ChangeNamespace.cpp:18
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition: ClangTidyDiagnosticConsumer.h:100
clang::tidy::zircon::TemporaryObjectsCheck::storeOptions
void storeOptions(ClangTidyOptions::OptionMap &Opts) override
Should store all options supported by this check with their current values or default values for opti...
Definition: TemporaryObjectsCheck.cpp:54
clang::tidy::zircon::TemporaryObjectsCheck::TemporaryObjectsCheck
TemporaryObjectsCheck(StringRef Name, ClangTidyContext *Context)
Definition: TemporaryObjectsCheck.h:27
clang::tidy::zircon::TemporaryObjectsCheck
Construction of specific temporary objects in the Zircon kernel is discouraged.
Definition: TemporaryObjectsCheck.h:25