baloghadamsoftware marked 5 inline comments as done. baloghadamsoftware added inline comments.
================ Comment at: clang-tools-extra/clang-tidy/bugprone/MisplacedPointerArithmeticInAllocCheck.cpp:81-82 + diag(PtrArith->getBeginLoc(), + "pointer arithmetic is applied to the result of %0() instead of its " + "argument") + << Func->getName() << Hint; ---------------- whisperity wrote: > If I put the `+ b` on `X` as in `malloc(X + b)` instead of `malloc(X) + b`, > then it's not //pointer// arithmetic anymore, but (hopefully unsigned) > arithmetic. Should the warning message really start with "pointer arithmetic"? > > Maybe you could consider the check saying > > arithmetic operation applied to pointer result of ...() instead of > size-like argument > > optionally, I'd clarify it further by putting at the end: > > resulting in ignoring a prefix of the buffer. > > considering you specifically match on the std(-like) allocations. (At least > for now.) "resulting in ignoring a prefix of the buffer" <- this is only true for addition. What should we write for subtraction? CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71001/new/ https://reviews.llvm.org/D71001 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits