9#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_MAKE_SMART_PTR_H
10#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_MAKE_SMART_PTR_H
12#include "../ClangTidyCheck.h"
13#include "../utils/IncludeInserter.h"
14#include "clang/ASTMatchers/ASTMatchFinder.h"
15#include "clang/ASTMatchers/ASTMatchersInternal.h"
16#include "llvm/ADT/StringRef.h"
25 StringRef MakeSmartPtrFunctionName);
28 Preprocessor *ModuleExpanderPP)
override;
29 void check(
const ast_matchers::MatchFinder::MatchResult &Result)
final;
48 const StringRef MakeSmartPtrFunctionHeader;
49 const StringRef MakeSmartPtrFunctionName;
50 const bool IgnoreMacros;
51 const bool IgnoreDefaultInitialization;
53 void checkConstruct(SourceManager &SM, ASTContext *Ctx,
54 const CXXConstructExpr *Construct,
const QualType *
Type,
55 const CXXNewExpr *New);
56 void checkReset(SourceManager &SM, ASTContext *Ctx,
57 const CXXMemberCallExpr *Reset,
const CXXNewExpr *New);
60 bool replaceNew(DiagnosticBuilder &Diag,
const CXXNewExpr *New,
61 SourceManager &SM, ASTContext *Ctx);
62 void insertHeader(DiagnosticBuilder &Diag, FileID FD);
llvm::SmallString< 256U > Name
Base class for all clang-tidy checks.
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.
Base class for MakeSharedCheck and MakeUniqueCheck.
virtual SmartPtrTypeMatcher getSmartPointerTypeMatcher() const =0
Returns matcher that match with different smart pointer types.
static const char PointerType[]
void check(const ast_matchers::MatchFinder::MatchResult &Result) final
ClangTidyChecks that register ASTMatchers should do the actual work in here.
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override
Returns whether the C++ version is compatible with current check.
void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP, Preprocessor *ModuleExpanderPP) override
Override this to register PPCallbacks in the preprocessor.
void storeOptions(ClangTidyOptions::OptionMap &Opts) override
Should store all options supported by this check with their current values or default values for opti...
void registerMatchers(ast_matchers::MatchFinder *Finder) final
Override this to register AST matchers with Finder.
ast_matchers::internal::BindableMatcher< QualType > SmartPtrTypeMatcher
Produces fixes to insert specified includes to source files, if not yet present.
llvm::StringMap< ClangTidyValue > OptionMap