[PATCH] D151952: [clang] adds `__type_pack_index` so we can get a type's parameter pack index

Christopher Di Bella via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 1 17:27:19 PDT 2023


cjdb created this revision.
cjdb added reviewers: aaron.ballman, erichkeane, shafik, dblaikie.
Herald added subscribers: arphaman, martong.
Herald added a project: All.
cjdb requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Similarly to `__type_pack_element`, C++ doesn't offer a way to extract a
the index of the first occurrence of a type in a parameter pack. This
means that we need to build up context for something that the compiler
already has, and then compute the value in a much less efficient manner
than the  compiler.

Clang can compute this information without needing to use extra
resources.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151952

Files:
  clang/docs/LanguageExtensions.rst
  clang/include/clang/AST/ExprCXX.h
  clang/include/clang/AST/Stmt.h
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Basic/TokenKinds.def
  clang/lib/AST/ASTImporter.cpp
  clang/lib/AST/ExprCXX.cpp
  clang/lib/Parse/ParseDeclCXX.cpp
  clang/lib/Parse/ParseExpr.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/test/SemaCXX/type_pack_index.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151952.527677.patch
Type: text/x-patch
Size: 13806 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230602/aee72656/attachment-0001.bin>


More information about the cfe-commits mailing list