#include "PreferMemberInitializerCheck.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Lex/Lexer.h"
#include "llvm/ADT/DenseMap.h"
usingnamespaceclang::ast_matchers;
namespace clang::tidy::cppcoreguidelines {
static bool isControlStatement(const Stmt *S) { … }
static bool isNoReturnCallStatement(const Stmt *S) { … }
namespace {
AST_MATCHER_P(FieldDecl, indexNotLessThan, unsigned, Index) { … }
enum class AssignedLevel { … };
}
static bool canAdvanceAssignment(AssignedLevel Level) { … }
static void updateAssignmentLevel(
const FieldDecl *Field, const Expr *Init, const CXXConstructorDecl *Ctor,
llvm::DenseMap<const FieldDecl *, AssignedLevel> &AssignedFields) { … }
struct AssignmentPair { … };
static std::optional<AssignmentPair>
isAssignmentToMemberOf(const CXXRecordDecl *Rec, const Stmt *S,
const CXXConstructorDecl *Ctor) { … }
PreferMemberInitializerCheck::PreferMemberInitializerCheck(
StringRef Name, ClangTidyContext *Context)
: … { … }
void PreferMemberInitializerCheck::registerMatchers(MatchFinder *Finder) { … }
void PreferMemberInitializerCheck::check(
const MatchFinder::MatchResult &Result) { … }
}