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

Stephan Bergmann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 27 01:34:13 PDT 2020


sberg added a comment.

In D76572#1936935 <https://reviews.llvm.org/D76572#1936935>, @grandinj wrote:

> In D76572#1936861 <https://reviews.llvm.org/D76572#1936861>, @Quuxplusone wrote:
>
> > Nice. Does LibreOffice have anything (either in clang-tidy or in a paper guideline) against `T(x)`-style casts? E.g.
>
>
> No, we don't have very many of those in our codebase, so we have left them alone.
>  Our plugin is designed to convert c-style casts to modern C++ casts.


Heh, I've meanwhile improved LibreOffice's cstylecast check now (after I'd read only the first few initial comments here), to also flag function-style casts that should be const_/reinterpret_cast, and it indeed only found a handful of cases that would better be reinterpret_cast (https://gerrit.libreoffice.org/plugins/gitiles/core/+/1ebeacb20ad0165e399629fcfd7795ad0da3edf8%5E!/ "Extend loplugin:cstylecast to certain function-style casts").  Though in two of those places it conveniently unearthed code that should rather do without any kind of casting (addressed with follow-up https://gerrit.libreoffice.org/plugins/gitiles/core/+/741d30b5e1b0dcdbafb300ed7c7ad46756ffd946%5E!/ "Simplify pointer equality comparison" and https://gerrit.libreoffice.org/plugins/gitiles/core/+/e3196f3dddad6e7825db3b35e8196be35b466fd9%5E!/ "Fix pointer equality comparision").


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