[PATCH] D71707: clang-tidy: new bugprone-pointer-cast-widening
Jan Kratochvil via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 19 09:23:15 PST 2019
jankratochvil added a subscriber: labath.
jankratochvil added a comment.
In D71707#1791280 <https://reviews.llvm.org/D71707#1791280>, @labath wrote:
> - 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
I was trying to find what is `intptr_t` good for and I haven't found any valid reason. It seems to me nobody knows that either. Which is why I find correct to report it. This checker has many false positives (or "not really a bug") anyway.
> - 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...
Yes, I wanted first to check the widths but then I realized user would need a 32-bit host for that which is too difficult to (1) get nowadays and (2) primarily to build there LLVM.
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