[cfe-commits] [Patch] Fix parser diagnostic on class specifiers following c++11 attributes

Michael Han fragmentshaders at gmail.com
Mon Nov 26 15:03:42 PST 2012


Thanks for all the reviews! Committed as r168626 with recommended fixes.

Cheers
Michael

On Mon, Nov 26, 2012 at 10:43 AM, Richard Smith <richard at metafoo.co.uk>wrote:

> Just some tiny things, then:
>
> +    // Skip C++11 attribute specifiers.
> +    do {
> +      if (Tok.is(tok::l_square) && NextToken().is(tok::l_square)) {
> +        ConsumeBracket();
> +        ConsumeBracket();
> +        if (!SkipUntil(tok::r_square, false))
> +          break;
>
> This inner ConsumeBracket() / SkipUntil(...) pair is redundant. The
> following SkipUntil call will do that for you.
>
> +        if (!SkipUntil(tok::r_square, false))
>
> You don't need the ', false' here. If we see a semicolon before the
> expected ']', we should bail out.
>
> +          break;
> +      } else if ((Tok.is(tok::kw_alignas) || Tok.is(tok::kw__Alignas)) &&
> +                 NextToken().is(tok::l_paren)) {
> +        ConsumeToken();
> +        ConsumeParen();
> +        if (!SkipUntil(tok::r_paren))
> +          break;
> +      } else {
> +        break;
> +      }
> +    } while (true);
>
> do { ... } while (true); is a bit of a funny way of writing this;
> 'while (true) { ... }' is more common in Clang sources.
>
> @@ -1275,6 +1324,12 @@
>    } else
>      TUK = Sema::TUK_Reference;
>
> +  // Forbid misplaced attributes. In cases of the reference, we pass
> attributes
> +  // to caller to handle.
>
> *"In the case of a reference, [...]"
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121126/96d538ba/attachment.html>


More information about the cfe-commits mailing list