[PATCH] D71607: [clang-tidy] Add unsigned subtraction warning, with suggestion to convert to unsigned literals.

Eugene Zelenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 10 15:02:41 PST 2020


Eugene.Zelenko added inline comments.


================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:106
+
+  Finds cases where a signed value is subtracted from an unsigned value,
+  a likely cause of unexpected underflow.
----------------
Please synchronize with first statement in documentation.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/bugprone-unsigned-subtraction.rst:5-6
+==========================
+
+This check finds expressions where a signed value is subtracted from
+an unsigned value.
----------------
This check should be removed.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/bugprone-unsigned-subtraction.rst:15
+
+This warning suggest a fixit change that will append a ``u`` to
+constants, thus making the implict cast explicit and signals that
----------------
fix-it. Check, not warning.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/bugprone-unsigned-subtraction.rst:17
+constants, thus making the implict cast explicit and signals that
+the developer intends the subtraction with unsigned arguments.
+In cases where the second argument is not a constant, a
----------------
code was intended?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71607





More information about the cfe-commits mailing list