[PATCH] D75844: [clang] Set begin loc on GNU attribute parsed attrs

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 5 06:34:24 PDT 2020


tbaeder added a comment.

I'm looking at this again and I am not sure how it is meant to work. For example in `Parser::parseClassSpecifier` in `ParseDeclCXX.cpp`.
Here `attrs` is a local variable of type `ParsedAttributesWithRange`, already before my patch. `attrs` is then passed to

1. `MaybeParseGNUAttributes`
2. `MaybeParseMicrosoftDeclSpecs`
3. `ParseMicrosoftInheritanceClassAttributes`
4. `MaybeParseCXX11Attributes`

and later `parseClassSpecifier` calls `ProhibitAttributes(attrs)` a few times. `ProhibitAttributes` in turn will not do anything if the given attrs have an invalid (i.e. unset) range.
So, how could they ever have a valid range set? All the four functions above only take a  `ParsedAttributes`, no range.

This is one of the cases that now (that `MaybeParseGNUAttributes` sets the range of the given `attrs` if it really parses attributes) generates errors in various test cases.
For example in `clang/test/AST/ast-print-record-decl.c`: File /home/tbaeder/llvm-project/clang/test/AST/ast-print-record-decl.c Line 209: an attribute list cannot appear here

Am I missing something?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75844/new/

https://reviews.llvm.org/D75844





More information about the cfe-commits mailing list