[PATCH] D76572: Replace `T(x)` with `reinterpret_cast<T>(x)` everywhere it means reinterpret_cast. No functional change

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 22 13:55:31 PDT 2020


lebedev.ri added a comment.

Passing-by remark:

> I wrote a Clang warning [not pictured] to diagnose any use of `T(x)` which was not equivalent to `static_cast<T>(x)`.

I'm not sure whether or not this will pass the bar for a clang diagnostic,
but that does sound like a good clang-tidy readability check.

I also have a bit of pet peeve with `T(x)` (i.e. including those that should be `static_cast<>`),
so if you do go with clang-tidy direction, it may be good to generalize it to handle all `T(x)`,
but diagnose only those cast types that are specified in the config.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76572





More information about the cfe-commits mailing list