[all-commits] [llvm/llvm-project] 81a970: [Attr] Apply GNU-style attributes to expression st...

Valeriy Savchenko via All-commits all-commits at lists.llvm.org
Thu Feb 11 05:45:51 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 81a9707723845a5b880245da24633c519493205c
      https://github.com/llvm/llvm-project/commit/81a9707723845a5b880245da24633c519493205c
  Author: Valeriy Savchenko <vsavchenko at apple.com>
  Date:   2021-02-11 (Thu, 11 Feb 2021)

  Changed paths:
    M clang/include/clang/Basic/Features.def
    M clang/lib/Parse/ParseStmt.cpp
    A clang/test/Parser/stmt-attributes.c
    A clang/test/Parser/stmt-attributes.cpp
    A clang/test/Parser/stmt-attributes.m

  Log Message:
  -----------
  [Attr] Apply GNU-style attributes to expression statements

Before this commit, expression statements could not be annotated
with statement attributes.  Whenever parser found attribute, it
unconditionally assumed that it was followed by a declaration.
This not only doesn't allow expression attributes to have attributes,
but also produces spurious error diagnostics.

In order to maintain all previously compiled code, we still assume
that GNU attributes are followed by declarations unless ALL of those
are statement attributes.  And even in this case we are not forcing
the parser to think that it should parse a statement, but rather
let it proceed as if no attributes were found.

Differential Revision: https://reviews.llvm.org/D93630




More information about the All-commits mailing list