[cfe-commits] [Patch] Skip attributes

Richard Smith richard at metafoo.co.uk
Fri Dec 7 16:09:32 PST 2012


On Fri, Dec 7, 2012 at 3:08 PM, Michael Han <fragmentshaders at gmail.com> wrote:
> Hi,
>
> There are a couple of places in parser where we parse attributes, then
> discard them immediately because these attributes are not allowed to appear
> on certain locations. This patch kills the unnecessary parsing by simply
> skipping these attributes.
>
> The existing attribute tests should cover all cases related to this change,
> with one tweaked test case to cover different combination of C++11 attribute
> syntax ([[ and alignas).

Please use BalancedDelimiterTracker instead of the manual
ConsumeBracket / ExpectAndConsume dance. Also, please add some test
cases for your error recovery (missing ')', missing ']', tokens
between ']' characters).

Since the presence of attributes in these cases is a hard error, we
could afford to pass Disambiguate = true to isCXX11AttributeSpecifier.
Are there any cases in which that would allow us to recover better?



More information about the cfe-commits mailing list