[PATCH] D64838: [Attr] Support _attribute__ ((fallthrough))

Nathan Huckleberry via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 18 15:59:01 PDT 2019


Nathan-Huckleberry added a comment.

  void foo() {
    __attribute__((address_space(0))) *x;
    *y;
  }

If the attributes are parsed then the rest of the statement is identical to:

  {
    *x; //this one has attributes now
    *y;
  {

The first line should be a valid declaration and the second like should be a dereference of an uninitialized variable. If the attributes token is discarded before parsing the rest of the line the only way to differentiate these is by looking at the attributes added to them.

An alternative may be parse the attributes list and immediately try to parse as a declaration then if that parsing fails attempt to parse as something else. Although this approach also has the scary implication of things that are supposed to be declarations getting reparsed as something entirely different.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64838





More information about the cfe-commits mailing list