[all-commits] [llvm/llvm-project] b78d53: parse: process GNU and standard attributes on top-...

Saleem Abdulrasool via All-commits all-commits at lists.llvm.org
Mon Nov 21 14:35:36 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b78d5380da1184a4df0e3c31146bf50c3dadd5e0
      https://github.com/llvm/llvm-project/commit/b78d5380da1184a4df0e3c31146bf50c3dadd5e0
  Author: Saleem Abdulrasool <compnerd at compnerd.org>
  Date:   2022-11-21 (Mon, 21 Nov 2022)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Parse/Parser.h
    M clang/lib/Parse/ParseDeclCXX.cpp
    M clang/lib/Parse/ParseHLSL.cpp
    M clang/lib/Parse/ParseObjc.cpp
    M clang/lib/Parse/ParseOpenMP.cpp
    M clang/lib/Parse/Parser.cpp
    M clang/test/Parser/attr-order.cpp
    M clang/test/Parser/cxx-attributes.cpp
    M clang/test/SemaCXX/attr-unavailable.cpp
    M clang/unittests/Tooling/SourceCodeTest.cpp

  Log Message:
  -----------
  parse: process GNU and standard attributes on top-level decls

We would previously reject valid input where GNU attributes preceded the
standard attributes on top-level declarations. A previous attribute
handling change had begun rejecting this whilst GCC does honour this
layout. In practice, this breaks use of `extern "C"` attributed
functions which use both standard and GNU attributes as experienced by
the Swift runtime.

Objective-C deserves an honourable mention for requiring some additional
special casing. Because attributes on declarations and definitions
differ in semantics, we need to replicate some of the logic for
detecting attributes to declarations to which they appertain cannot be
attributed. This should match the existing case for the application of
GNU attributes to interfaces, protocols, and implementations.

Take the opportunity to split out the tooling tests into two cases: ones
which process macros and ones which do not.

Special thanks to Aaron Ballman for the many hints and extensive rubber
ducking that was involved in identifying the various places where we
accidentally dropped attributes.

Differential Revision: https://reviews.llvm.org/D137979
Fixes: #58229
Reviewed By: aaron.ballman, arphaman




More information about the All-commits mailing list