Skip to content

Commit dcc2b0c

Browse files
committed
[-Wunsafe-buffer-usage] Fix AST matcher of UUCAddAssignGadget
We are not interested in nonpointers being added to.
1 parent bb6a485 commit dcc2b0c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

clang/lib/Analysis/UnsafeBufferUsage.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1081,11 +1081,16 @@ class UUCAddAssignGadget : public FixableGadget {
10811081
}
10821082

10831083
static Matcher matcher() {
1084+
// clang-format off
10841085
return stmt(isInUnspecifiedUntypedContext(expr(ignoringImpCasts(
10851086
binaryOperator(hasOperatorName("+="),
1086-
hasLHS(declRefExpr(toSupportedVariable())),
1087+
hasLHS(
1088+
declRefExpr(
1089+
hasPointerType(),
1090+
toSupportedVariable())),
10871091
hasRHS(expr().bind(OffsetTag)))
10881092
.bind(UUCAddAssignTag)))));
1093+
// clang-format on
10891094
}
10901095

10911096
virtual std::optional<FixItList> getFixits(const Strategy &S) const override;

0 commit comments

Comments
 (0)