[PATCH] D71707: clang-tidy: new bugprone-pointer-cast-widening

Pavel Labath via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 19 08:02:05 PST 2019


labath resigned from this revision.
labath added a comment.

Though this *was* my idea, I don't really feel qualified to review code here.

However, some things to consider:

- disallowing casts to intptr_t seems too restrictive -- I doubt many people are doing that, but I guess this type exists for a reason, and since the type (and it's signedness) is spelled out in the source, it shouldn't be too surprising that sign-extension can happen later
- requiring a literal uintptr_t (or a typedef of it) may be also problematic -- the user could obtain an integer type of the same bit width through some other means (e.g. `#ifdef`). OTOH, without that (and just checking the bit width for instance), one would have to actually compile for a 32-bit target to get this warning. I don't know what's the practice for this in clang-tidy...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71707





More information about the cfe-commits mailing list