[all-commits] [llvm/llvm-project] 95a4c0: [clang] Reland parenthesized aggregate init patches

Alan Zhao via All-commits all-commits at lists.llvm.org
Thu Jan 12 09:58:34 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 95a4c0c83554c025ef709a6805e67233d0dedba0
      https://github.com/llvm/llvm-project/commit/95a4c0c83554c025ef709a6805e67233d0dedba0
  Author: Alan Zhao <ayzhao at google.com>
  Date:   2023-01-12 (Thu, 12 Jan 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang-c/Index.h
    M clang/include/clang/AST/ASTNodeTraverser.h
    M clang/include/clang/AST/ComputeDependence.h
    M clang/include/clang/AST/Decl.h
    M clang/include/clang/AST/ExprCXX.h
    M clang/include/clang/AST/RecursiveASTVisitor.h
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/include/clang/Basic/StmtNodes.td
    M clang/include/clang/Sema/Initialization.h
    M clang/include/clang/Serialization/ASTBitCodes.h
    M clang/lib/AST/ComputeDependence.cpp
    M clang/lib/AST/Expr.cpp
    M clang/lib/AST/ExprCXX.cpp
    M clang/lib/AST/ExprClassification.cpp
    M clang/lib/AST/ExprConstant.cpp
    M clang/lib/AST/ItaniumMangle.cpp
    M clang/lib/AST/JSONNodeDumper.cpp
    M clang/lib/AST/StmtPrinter.cpp
    M clang/lib/AST/StmtProfile.cpp
    M clang/lib/AST/TextNodeDumper.cpp
    M clang/lib/CodeGen/CGExprAgg.cpp
    M clang/lib/Frontend/InitPreprocessor.cpp
    M clang/lib/Sema/SemaCast.cpp
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Sema/SemaExceptionSpec.cpp
    M clang/lib/Sema/SemaInit.cpp
    M clang/lib/Sema/TreeTransform.h
    M clang/lib/Serialization/ASTReaderStmt.cpp
    M clang/lib/Serialization/ASTWriter.cpp
    M clang/lib/Serialization/ASTWriterStmt.cpp
    M clang/lib/StaticAnalyzer/Core/ExprEngine.cpp
    M clang/test/CXX/temp/temp.decls/temp.variadic/p4.cpp
    A clang/test/CodeGen/paren-list-agg-init.cpp
    M clang/test/Lexer/cxx-features.cpp
    A clang/test/PCH/cxx_paren_init.cpp
    A clang/test/PCH/cxx_paren_init.h
    M clang/test/SemaCXX/cxx2a-explicit-bool.cpp
    A clang/test/SemaCXX/paren-list-agg-init.cpp
    M clang/test/SemaCXX/recovery-expr-type.cpp
    M clang/tools/libclang/CIndex.cpp
    M clang/tools/libclang/CXCursor.cpp
    M clang/www/cxx_status.html

  Log Message:
  -----------
  [clang] Reland parenthesized aggregate init patches

This commit relands the patches for implementing P0960R3 and P1975R0,
which describe initializing aggregates via a parenthesized list.

The relanded commits are:

* 40c52159d3ee - P0960R3 and P1975R0: Allow initializing aggregates from
  a parenthesized list of values
* c77a91bb7ba7 - Remove overly restrictive aggregate paren init logic
* 32d7aae04fdb - Fix a clang crash on invalid code in C++20 mode

This patch also fixes a crash in the original implementation.
Previously, if the input tried to call an implicitly deleted copy or
move constructor of a union, we would then try to initialize the union
by initializing it's first element with a reference to a union. This
behavior is incorrect (we should fail to initialize) and if the type of
the first element has a constructor with a single template typename
parameter, then Clang will explode. This patch fixes that issue by
checking that constructor overload resolution did not result in a
deleted function before attempting parenthesized aggregate
initialization.

Additionally, this patch also includes D140159, which contains some
minor fixes made in response to code review comments in the original
implementation that were made after that patch was submitted.

Co-authored-by: Sheng <ox59616e at gmail.com>

Fixes #54040, Fixes #59675

Reviewed By: ilya-biryukov

Differential Revision: https://reviews.llvm.org/D141546




More information about the All-commits mailing list