[all-commits] [llvm/llvm-project] 9f2c7e: Parse different attribute syntaxes in arbitrary order

Aaron Ballman via All-commits all-commits at lists.llvm.org
Wed Jan 27 12:34:53 PST 2021


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 9f2c7effd7f386e95aff3358500bc30974d35b0d
      https://github.com/llvm/llvm-project/commit/9f2c7effd7f386e95aff3358500bc30974d35b0d
  Author: Aaron Ballman <aaron at aaronballman.com>
  Date:   2021-01-27 (Wed, 27 Jan 2021)

  Changed paths:
    M clang/include/clang/Parse/Parser.h
    M clang/lib/Parse/ParseDecl.cpp
    M clang/lib/Parse/ParseDeclCXX.cpp
    M clang/lib/Parse/ParseExprCXX.cpp
    M clang/lib/Parse/ParseObjc.cpp
    A clang/test/Parser/attr-order.cpp
    M clang/test/SemaOpenCL/address-spaces.cl

  Log Message:
  -----------
  Parse different attribute syntaxes in arbitrary order

In Clang today, we parse the different attribute syntaxes
(__attribute__, __declspec, and [[]]) in a fairly rigid order. This
leads to confusion for users when they guess the order incorrectly,
and leads to bug reports like PR24559 or necessitates changes like
D94788.

This patch adds a helper function to allow us to more easily parse
attributes in arbitrary order, and then updates all of the places
where we would parse two or more different syntaxes in a rigid order to
use the helper method. The patch does not attempt to handle Microsoft
attributes ([]) because those are ambiguous with other code constructs
and we don't have any attributes that use the syntax.




More information about the All-commits mailing list