blob: b8e11a6ceee9aed88b1b4c896f8b103958976e26 [file] [log] [blame]
Malcolm Parsons5c24a112016-10-20 16:08:03 +00001//===--- RedundantMemberInitCheck.h - clang-tidy----------------*- C++ -*-===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// 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
Malcolm Parsons5c24a112016-10-20 16:08:03 +00006//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_REDUNDANT_MEMBER_INIT_H
10#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_REDUNDANT_MEMBER_INIT_H
11
Alexander Kornienko478fc5c2019-03-25 12:38:26 +000012#include "../ClangTidyCheck.h"
Malcolm Parsons5c24a112016-10-20 16:08:03 +000013
14namespace clang {
15namespace tidy {
16namespace readability {
17
18/// Finds member initializations that are unnecessary because the same default
19/// constructor would be called if they were not present.
20///
21/// For the user-facing documentation see:
22/// http://clang.llvm.org/extra/clang-tidy/checks/readability-redundant-member-init.html
23class RedundantMemberInitCheck : public ClangTidyCheck {
24public:
25 RedundantMemberInitCheck(StringRef Name, ClangTidyContext *Context)
Mitchell Balan98065362019-11-19 10:57:16 -050026 : ClangTidyCheck(Name, Context),
27 IgnoreBaseInCopyConstructors(
28 Options.get("IgnoreBaseInCopyConstructors", 0)) {}
29 void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
Malcolm Parsons5c24a112016-10-20 16:08:03 +000030 void registerMatchers(ast_matchers::MatchFinder *Finder) override;
31 void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
Mitchell Balan98065362019-11-19 10:57:16 -050032
33private:
34 bool IgnoreBaseInCopyConstructors;
Malcolm Parsons5c24a112016-10-20 16:08:03 +000035};
36
37} // namespace readability
38} // namespace tidy
39} // namespace clang
40
41#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_READABILITY_REDUNDANT_MEMBER_INIT_H