[all-commits] [llvm/llvm-project] ead169: Allow parameter pack expansions and initializer li...

Steffen Larsen via All-commits all-commits at lists.llvm.org
Tue Feb 8 10:38:48 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ead1690d31f815c00fdd2bc23db4766191bbeabc
      https://github.com/llvm/llvm-project/commit/ead1690d31f815c00fdd2bc23db4766191bbeabc
  Author: Steffen Larsen <steffen.larsen at intel.com>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/Attr.td
    M clang/include/clang/Basic/DiagnosticParseKinds.td
    M clang/include/clang/Parse/Parser.h
    M clang/include/clang/Sema/ParsedAttr.h
    M clang/include/clang/Sema/Sema.h
    M clang/lib/Parse/ParseDecl.cpp
    M clang/lib/Parse/ParseExpr.cpp
    M clang/lib/Sema/ParsedAttr.cpp
    M clang/lib/Sema/SemaAttr.cpp
    M clang/lib/Sema/SemaDeclAttr.cpp
    M clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
    M clang/test/Parser/cxx0x-attributes.cpp
    M clang/test/Sema/annotate.c
    M clang/test/SemaCXX/attr-annotate.cpp
    M clang/test/SemaTemplate/attributes.cpp
    M clang/utils/TableGen/ClangAttrEmitter.cpp

  Log Message:
  -----------
  Allow parameter pack expansions and initializer lists in annotate attribute

These changes make the Clang parser recognize expression parameter pack
expansion and initializer lists in attribute arguments. Because
expression parameter pack expansion requires additional handling while
creating and instantiating templates, the support for them must be
explicitly supported through the AcceptsExprPack flag.

Handling expression pack expansions may require a delay to when the
arguments of an attribute are correctly populated. To this end,
attributes that are set to accept these - through setting the
AcceptsExprPack flag - will automatically have an additional variadic
expression argument member named DelayedArgs. This member is not
exposed the same way other arguments are but is set through the new
CreateWithDelayedArgs creator function generated for applicable
attributes.

To illustrate how to implement support for expression pack expansion
support, clang::annotate is made to support pack expansions. This is
done by making handleAnnotationAttr delay setting the actual attribute
arguments until after template instantiation if it was unable to
populate the arguments due to dependencies in the parsed expressions.




More information about the All-commits mailing list