Skip to content

Commit 5591e8e

Browse files
committed
[-Wunsafe-buffer-usage][NFC] clang-format the PR
1 parent c2411fa commit 5591e8e

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

clang/lib/Analysis/UnsafeBufferUsage.cpp

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -813,8 +813,8 @@ class PtrToPtrAssignmentGadget : public FixableGadget {
813813
public:
814814
PtrToPtrAssignmentGadget(const MatchFinder::MatchResult &Result)
815815
: 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)) {}
818818

819819
static bool classof(const Gadget *G) {
820820
return G->getKind() == Kind::PtrToPtrAssignment;
@@ -861,27 +861,28 @@ class CArrayToPtrAssignmentGadget : public FixableGadget {
861861
private:
862862
static constexpr const char *const PointerAssignLHSTag = "ptrLHS";
863863
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`
866866

867867
public:
868868
CArrayToPtrAssignmentGadget(const MatchFinder::MatchResult &Result)
869869
: 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)) {}
872872

873873
static bool classof(const Gadget *G) {
874874
return G->getKind() == Kind::CArrayToPtrAssignment;
875875
}
876876

877877
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))));
885886

886887
return stmt(isInUnspecifiedUntypedContext(PtrAssignExpr));
887888
}
@@ -1548,7 +1549,8 @@ PtrToPtrAssignmentGadget::getFixits(const FixitStrategy &S) const {
15481549
}
15491550

15501551
/// \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);
15521554

15531555
std::optional<FixItList>
15541556
CArrayToPtrAssignmentGadget::getFixits(const FixitStrategy &S) const {
@@ -1983,7 +1985,8 @@ PointerDereferenceGadget::getFixits(const FixitStrategy &S) const {
19831985
return std::nullopt;
19841986
}
19851987

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) {
19871990
const SourceManager &SM = Ctx.getSourceManager();
19881991
// Inserts the .data() after the DRE
19891992
std::optional<SourceLocation> EndOfOperand =

0 commit comments

Comments
 (0)