[PATCHv2] implement -Wold-style-cast
Ondřej Hošek
ondra.hosek at gmail.com
Fri Nov 22 07:54:51 PST 2013
I've been trying to implement the relevant fix-it, but apart from not
being able to find the end of the expression being cast (to insert the
closing paren), the pathological case
On Fri, Nov 22, 2013 at 2:13 AM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
> (for example, static cast of a const cast)
might pose even more of a challenge, because I have to find and print
the "halfway" type:
int i = 42;
const int *cpi = &i;
float *fi = (float *)cpi;
// -> reinterpret_cast<float *>(const_cast<int *>(cpi));
This already spells trouble with regard to code formatting, and it
gets worse if I have a multi-level pointer type where some of the
levels are const and some aren't.
(Also, I have to move the warning from Parser to Sema because only
then do I have the type information to generate a fix-it, so I don't
know at all how well it will work with templates.)
Cheers,
~~ Ondra
More information about the cfe-commits
mailing list