[PATCH] Formatter: Correctly format stars in `sizeof(int**)` and similar places.

Nico Weber thakis at chromium.org
Tue Feb 12 08:15:42 PST 2013


On Tue, Feb 12, 2013 at 12:23 AM, Daniel Jasper <djasper at google.com> wrote:
>
>   The patch looks good, the surrounding doesn't ;-). We (I) seriously need to clean up the spaceRequired..() methods. Doesn't really make sense to test for star and amp directly as we already know what type of token we are dealing with. But I will do this in a follow-up patch.
>
>
> ================
> Comment at: lib/Format/TokenAnnotator.cpp:939
> @@ -934,3 +938,3 @@
>             (Left.isNot(tok::star) && Left.isNot(tok::amp) &&
> -            !Style.PointerBindsToType);
> +            Left.isNot(tok::l_paren) && !Style.PointerBindsToType);
>    if (Left.is(tok::amp) || Left.is(tok::star))
> ----------------
> How is this connected to the rest of the change?

This is for function pointer types: In "int(*)()", the "*" is now
marked as TT_PointerOrReference (which I think is good), but there
should be no space in front of pointer/reference markers if they
directly follow a "(".




More information about the cfe-commits mailing list