clang-tools 20.0.0git
|
Enumerations | |
enum class | QualifierPolicy { Left , Right } |
This enum defines where the qualifier shall be preferably added. More... | |
enum class | QualifierTarget { Pointee , Value } |
This enum defines which entity is the target for adding the qualifier. More... | |
Functions | |
FixItHint | changeVarDeclToReference (const VarDecl &Var, ASTContext &Context) |
Creates fix to make VarDecl a reference by adding & . | |
static bool | isValueType (const Type *T) |
static bool | isValueType (QualType QT) |
static bool | isMemberOrFunctionPointer (QualType QT) |
static bool | locDangerous (SourceLocation S) |
static std::optional< SourceLocation > | skipLParensBackwards (SourceLocation Start, const ASTContext &Context) |
static std::optional< FixItHint > | fixIfNotDangerous (SourceLocation Loc, StringRef Text) |
static std::string | buildQualifier (DeclSpec::TQ Qualifier, bool WhitespaceBefore=false) |
static std::optional< FixItHint > | changeValue (const VarDecl &Var, DeclSpec::TQ Qualifier, QualifierTarget QualTarget, QualifierPolicy QualPolicy, const ASTContext &Context) |
static std::optional< FixItHint > | changePointerItself (const VarDecl &Var, DeclSpec::TQ Qualifier, const ASTContext &Context) |
static std::optional< FixItHint > | changePointer (const VarDecl &Var, DeclSpec::TQ Qualifier, const Type *Pointee, QualifierTarget QualTarget, QualifierPolicy QualPolicy, const ASTContext &Context) |
static std::optional< FixItHint > | changeReferencee (const VarDecl &Var, DeclSpec::TQ Qualifier, QualType Pointee, QualifierTarget QualTarget, QualifierPolicy QualPolicy, const ASTContext &Context) |
std::optional< FixItHint > | addQualifierToVarDecl (const VarDecl &Var, const ASTContext &Context, DeclSpec::TQ Qualifier, QualifierTarget QualTarget=QualifierTarget::Pointee, QualifierPolicy QualPolicy=QualifierPolicy::Left) |
Creates fix to qualify VarDecl with the specified Qualifier . | |
bool | areParensNeededForStatement (const Stmt &Node) |
static bool | needParensAfterUnaryOperator (const Expr &ExprNode) |
std::string | formatDereference (const Expr &ExprNode, const ASTContext &Context) |
|
strong |
This enum defines where the qualifier shall be preferably added.
Enumerator | |
---|---|
Left | |
Right |
Definition at line 23 of file FixItHintUtils.h.
|
strong |
This enum defines which entity is the target for adding the qualifier.
This makes only a difference for pointer-types. Other types behave identical for either value of ConstTarget
.
Definition at line 31 of file FixItHintUtils.h.
std::optional< FixItHint > clang::tidy::utils::fixit::addQualifierToVarDecl | ( | const VarDecl & | Var, |
const ASTContext & | Context, | ||
DeclSpec::TQ | Qualifier, | ||
QualifierTarget | QualTarget = QualifierTarget::Pointee , |
||
QualifierPolicy | QualPolicy = QualifierPolicy::Left |
||
) |
Creates fix to qualify VarDecl
with the specified Qualifier
.
Requires that Var
is isolated in written code like in int foo = 42;
.
Definition at line 184 of file FixItHintUtils.cpp.
References changePointer(), changePointerItself(), changeReferencee(), changeValue(), isMemberOrFunctionPointer(), isValueType(), Left, Pointee, Right, Type, and Value.
Referenced by clang::tidy::performance::UnnecessaryValueParamCheck::handleConstRefFix().
bool clang::tidy::utils::fixit::areParensNeededForStatement | ( | const Stmt & | Node | ) |
Definition at line 227 of file FixItHintUtils.cpp.
References Node.
Referenced by clang::tidy::readability::RedundantCastingCheck::check().
|
static |
Definition at line 74 of file FixItHintUtils.cpp.
Referenced by changePointer(), changePointerItself(), changeReferencee(), and changeValue().
|
static |
Definition at line 115 of file FixItHintUtils.cpp.
References buildQualifier(), changePointerItself(), clang::tidy::utils::lexer::findPreviousTokenKind(), fixIfNotDangerous(), isValueType(), Left, locDangerous(), Pointee, Right, skipLParensBackwards(), and Value.
Referenced by addQualifierToVarDecl().
|
static |
Definition at line 101 of file FixItHintUtils.cpp.
References buildQualifier(), fixIfNotDangerous(), locDangerous(), and skipLParensBackwards().
Referenced by addQualifierToVarDecl(), and changePointer().
|
static |
Definition at line 166 of file FixItHintUtils.cpp.
References buildQualifier(), clang::tidy::utils::lexer::findPreviousAnyTokenKind(), fixIfNotDangerous(), isValueType(), Left, Pointee, and skipLParensBackwards().
Referenced by addQualifierToVarDecl().
|
static |
Definition at line 81 of file FixItHintUtils.cpp.
References buildQualifier(), fixIfNotDangerous(), Left, Right, and skipLParensBackwards().
Referenced by addQualifierToVarDecl().
FixItHint clang::tidy::utils::fixit::changeVarDeclToReference | ( | const VarDecl & | Var, |
ASTContext & | Context | ||
) |
Creates fix to make VarDecl
a reference by adding &
.
Definition at line 19 of file FixItHintUtils.cpp.
References clang::tidy::utils::lexer::getPreviousToken().
Referenced by clang::tidy::performance::UnnecessaryValueParamCheck::handleConstRefFix().
|
static |
Definition at line 65 of file FixItHintUtils.cpp.
References Loc, locDangerous(), and Text.
Referenced by changePointer(), changePointerItself(), changeReferencee(), and changeValue().
std::string clang::tidy::utils::fixit::formatDereference | ( | const Expr & | ExprNode, |
const ASTContext & | Context | ||
) |
Definition at line 279 of file FixItHintUtils.cpp.
References needParensAfterUnaryOperator(), and Text.
Referenced by clang::tidy::readability::RedundantStringCStrCheck::check(), and clang::tidy::utils::withoutCStrReplacement().
|
static |
Definition at line 35 of file FixItHintUtils.cpp.
Referenced by addQualifierToVarDecl().
|
static |
Definition at line 30 of file FixItHintUtils.cpp.
Referenced by addQualifierToVarDecl(), changePointer(), changeReferencee(), and isValueType().
|
static |
Definition at line 34 of file FixItHintUtils.cpp.
References isValueType().
|
static |
Definition at line 40 of file FixItHintUtils.cpp.
Referenced by changePointer(), changePointerItself(), fixIfNotDangerous(), and skipLParensBackwards().
|
static |
Definition at line 264 of file FixItHintUtils.cpp.
Referenced by formatDereference().
|
static |
Definition at line 45 of file FixItHintUtils.cpp.
References clang::tidy::utils::lexer::findPreviousTokenStart(), clang::tidy::utils::lexer::getPreviousToken(), and locDangerous().
Referenced by changePointer(), changePointerItself(), changeReferencee(), and changeValue().