[PATCH] D144064: [-Wunsafe-buffer-usage] Match unsafe pointers being casted to bool or participating in pointer subtractions

Malavika Samak via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 8 13:58:40 PST 2023


malavikasamak added inline comments.


================
Comment at: clang/lib/Analysis/UnsafeBufferUsage.cpp:156
+  // 2. the operand of a cast-to-(Integer or Boolean) operation; or
+  // 3. the operand of a pointer subtraction operation; or
+  // 4. the operand of a pointer comparison operation; or
----------------
malavikasamak wrote:
> I don't understand why we are special handling only pointer subtraction here. Won't pointer addition be also considered UPC? If so, can we just add it to this patch.
Never mind. It looks like pointer addition is not even legal and subtraction is a special case. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144064/new/

https://reviews.llvm.org/D144064



More information about the cfe-commits mailing list