@@ -813,8 +813,8 @@ class PtrToPtrAssignmentGadget : public FixableGadget {
813
813
public:
814
814
PtrToPtrAssignmentGadget (const MatchFinder::MatchResult &Result)
815
815
: FixableGadget(Kind::PtrToPtrAssignment),
816
- PtrLHS (Result.Nodes.getNodeAs<DeclRefExpr>(PointerAssignLHSTag)),
817
- PtrRHS(Result.Nodes.getNodeAs<DeclRefExpr>(PointerAssignRHSTag)) {}
816
+ PtrLHS (Result.Nodes.getNodeAs<DeclRefExpr>(PointerAssignLHSTag)),
817
+ PtrRHS(Result.Nodes.getNodeAs<DeclRefExpr>(PointerAssignRHSTag)) {}
818
818
819
819
static bool classof (const Gadget *G) {
820
820
return G->getKind () == Kind::PtrToPtrAssignment;
@@ -861,27 +861,28 @@ class CArrayToPtrAssignmentGadget : public FixableGadget {
861
861
private:
862
862
static constexpr const char *const PointerAssignLHSTag = " ptrLHS" ;
863
863
static constexpr const char *const PointerAssignRHSTag = " ptrRHS" ;
864
- const DeclRefExpr * PtrLHS; // the LHS pointer expression in `PA`
865
- const DeclRefExpr * PtrRHS; // the RHS pointer expression in `PA`
864
+ const DeclRefExpr *PtrLHS; // the LHS pointer expression in `PA`
865
+ const DeclRefExpr *PtrRHS; // the RHS pointer expression in `PA`
866
866
867
867
public:
868
868
CArrayToPtrAssignmentGadget (const MatchFinder::MatchResult &Result)
869
869
: FixableGadget(Kind::CArrayToPtrAssignment),
870
- PtrLHS (Result.Nodes.getNodeAs<DeclRefExpr>(PointerAssignLHSTag)),
871
- PtrRHS(Result.Nodes.getNodeAs<DeclRefExpr>(PointerAssignRHSTag)) {}
870
+ PtrLHS (Result.Nodes.getNodeAs<DeclRefExpr>(PointerAssignLHSTag)),
871
+ PtrRHS(Result.Nodes.getNodeAs<DeclRefExpr>(PointerAssignRHSTag)) {}
872
872
873
873
static bool classof (const Gadget *G) {
874
874
return G->getKind () == Kind::CArrayToPtrAssignment;
875
875
}
876
876
877
877
static Matcher matcher () {
878
- auto PtrAssignExpr = binaryOperator (allOf (hasOperatorName (" =" ),
879
- hasRHS (ignoringParenImpCasts (declRefExpr (hasType (hasCanonicalType (constantArrayType ())),
880
- toSupportedVariable ()).
881
- bind (PointerAssignRHSTag))),
882
- hasLHS (declRefExpr (hasPointerType (),
883
- toSupportedVariable ()).
884
- bind (PointerAssignLHSTag))));
878
+ auto PtrAssignExpr = binaryOperator (
879
+ allOf (hasOperatorName (" =" ),
880
+ hasRHS (ignoringParenImpCasts (
881
+ declRefExpr (hasType (hasCanonicalType (constantArrayType ())),
882
+ toSupportedVariable ())
883
+ .bind (PointerAssignRHSTag))),
884
+ hasLHS (declRefExpr (hasPointerType (), toSupportedVariable ())
885
+ .bind (PointerAssignLHSTag))));
885
886
886
887
return stmt (isInUnspecifiedUntypedContext (PtrAssignExpr));
887
888
}
@@ -1548,7 +1549,8 @@ PtrToPtrAssignmentGadget::getFixits(const FixitStrategy &S) const {
1548
1549
}
1549
1550
1550
1551
// / \returns fixit that adds .data() call after \DRE.
1551
- static inline std::optional<FixItList> createDataFixit (const ASTContext& Ctx, const DeclRefExpr * DRE);
1552
+ static inline std::optional<FixItList> createDataFixit (const ASTContext &Ctx,
1553
+ const DeclRefExpr *DRE);
1552
1554
1553
1555
std::optional<FixItList>
1554
1556
CArrayToPtrAssignmentGadget::getFixits (const FixitStrategy &S) const {
@@ -1983,7 +1985,8 @@ PointerDereferenceGadget::getFixits(const FixitStrategy &S) const {
1983
1985
return std::nullopt;
1984
1986
}
1985
1987
1986
- static inline std::optional<FixItList> createDataFixit (const ASTContext& Ctx, const DeclRefExpr * DRE) {
1988
+ static inline std::optional<FixItList> createDataFixit (const ASTContext &Ctx,
1989
+ const DeclRefExpr *DRE) {
1987
1990
const SourceManager &SM = Ctx.getSourceManager ();
1988
1991
// Inserts the .data() after the DRE
1989
1992
std::optional<SourceLocation> EndOfOperand =
0 commit comments