clang-tools 6.0.0

UseDefaultMemberInitCheck.h
Go to the documentation of this file.
1 //===--- UseDefaultMemberInitCheck.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_MODERNIZE_USE_DEFAULT_MEMBER_INIT_H
11 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USE_DEFAULT_MEMBER_INIT_H
12
13 #include "../ClangTidy.h"
14
15 namespace clang {
16 namespace tidy {
17 namespace modernize {
18
19 /// Convert a default constructor's member initializers into default member
20 /// initializers. Remove member initializers that are the same as a default
21 /// member initializer.
22 ///
23 /// For the user-facing documentation see:
24 /// http://clang.llvm.org/extra/clang-tidy/checks/modernize-use-default-member-init.html
25 class UseDefaultMemberInitCheck : public ClangTidyCheck {
26 public:
27 UseDefaultMemberInitCheck(StringRef Name, ClangTidyContext *Context);
28 void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
29 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
30 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
31
32 private:
33 void checkDefaultInit(const ast_matchers::MatchFinder::MatchResult &Result,
34 const CXXCtorInitializer *Init);
35 void checkExistingInit(const ast_matchers::MatchFinder::MatchResult &Result,
36 const CXXCtorInitializer *Init);
37
38 const bool UseAssignment;
39 const bool IgnoreMacros;
40 };
41
42 } // namespace modernize
43 } // namespace tidy
44 } // namespace clang
45
46 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USE_DEFAULT_MEMBER_INIT_H
clang::tidy::modernize::UseDefaultMemberInitCheck::check
void check(const ast_matchers::MatchFinder::MatchResult &Result) override
ClangTidyChecks that register ASTMatchers should do the actual work in here.
Definition: UseDefaultMemberInitCheck.cpp:188
clang::tidy::modernize::UseDefaultMemberInitCheck::UseDefaultMemberInitCheck
UseDefaultMemberInitCheck(StringRef Name, ClangTidyContext *Context)
Definition: UseDefaultMemberInitCheck.cpp:139
Name
StringHandle Name
Definition: PreprocessorTracker.cpp:525
clang::tidy::modernize::UseDefaultMemberInitCheck
Convert a default constructor&#39;s member initializers into default member initializers.
Definition: UseDefaultMemberInitCheck.h:25
clang::tidy::ClangTidyCheck
Base class for all clang-tidy checks.
Definition: ClangTidy.h:127
clang::tidy::modernize::UseDefaultMemberInitCheck::registerMatchers
void registerMatchers(ast_matchers::MatchFinder *Finder) override
Override this to register AST matchers with Finder.
Definition: UseDefaultMemberInitCheck.cpp:151
clang::tidy::ClangTidyOptions::OptionMap
std::map< std::string, std::string > OptionMap
Definition: ClangTidyOptions.h:99
clang::tidy::modernize::UseDefaultMemberInitCheck::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: UseDefaultMemberInitCheck.cpp:145
clang
Definition: AndroidTidyModule.cpp:28
clang::tidy::ClangTidyContext
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Definition: ClangTidyDiagnosticConsumer.h:104