[PATCH] D129531: [clang][C++20] P0960R3 and P1975R0: Allow initializing aggregates from a parenthesized list of values

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 14 12:18:07 PST 2022


shafik added inline comments.


================
Comment at: clang/include/clang/AST/ExprCXX.h:4760
+      : Expr(CXXParenListInitExprClass, T,
+             T->isLValueReferenceType()   ? VK_LValue
+             : T->isRValueReferenceType() ? VK_XValue
----------------
It looks like we use this idiom in several places, it may be worth it to sink this as a member function of `QualType`


================
Comment at: clang/lib/CodeGen/CGExprAgg.cpp:1609
+        dyn_cast<CXXRecordDecl>(E->getType()->castAs<RecordType>()->getDecl());
+    for (FieldDecl *FD : RD->fields()) {
+      if (FD->isUnnamedBitfield())
----------------
This is second time I see you looking for the initialized field for a union while `InitListExpr` has `getInitializedFieldInUnion()`. Would it be too painful to also do that for `CXXParenListInitExpr ` to avoid the code duplication?


================
Comment at: clang/lib/Sema/SemaInit.cpp:5411
+      ResultType = S.Context.getConstantArrayType(
+          AT->getElementType(), llvm::APInt(32, ArrayLength), nullptr,
+          ArrayType::Normal, 0);
----------------
nit


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129531/new/

https://reviews.llvm.org/D129531



More information about the cfe-commits mailing list