This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG762af11d4c5d: [-Wunsafe-buffer-usage] Add a Fixable for
pointer pre-increment (authored by ziqingluo-90).
Changed prior to commit:
https://reviews
ziqingluo-90 marked an inline comment as done.
ziqingluo-90 added inline comments.
Comment at:
clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-addressof-arraysubscript.cpp:19
bool a = (bool) &p[5];
- // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:19-[[@LINE-1]]:24}:"(p.data() + 5
NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.
LGTM!
Comment at:
clang/test/SemaCXX/warn-unsafe-buffer-usage-fixits-addressof-arraysubscript.cpp:19
bool a = (bool) &p[5];
- // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:19-[[@LINE
ziqingluo-90 updated this revision to Diff 503928.
ziqingluo-90 added a comment.
Rebased and addressed comments.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144304/new/
https://reviews.llvm.org/D144304
Files:
clang/include/clang/Analysis/Analyses/UnsafeBufferUsageGadgets.def
clan
ziqingluo-90 added inline comments.
Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:663
+return stmt(isInUnspecifiedPointerContext(expr(
+
ignoringImpCasts(unaryOperator(isPreInc()).bind(UPCPreIncrementTag);
+ }
NoQ wrote:
> You're not check
NoQ added inline comments.
Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:149-152
+// Matches a `UnaryOperator` whose operator is pre-increment:
+AST_MATCHER(UnaryOperator, isPreInc) {
+ return Node.getOpcode() == UnaryOperator::Opcode::UO_PreInc;
+}
Oh in