[all-commits] [llvm/llvm-project] 869826: [Clang] Fix consteval propagation for aggregates a...

cor3ntin via All-commits all-commits at lists.llvm.org
Mon Jul 24 09:15:53 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8698262a4365bf22b5b0c96e77bfecd3dcf084a7
      https://github.com/llvm/llvm-project/commit/8698262a4365bf22b5b0c96e77bfecd3dcf084a7
  Author: Corentin Jabot <corentinjabot at gmail.com>
  Date:   2023-07-24 (Mon, 24 Jul 2023)

  Changed paths:
    M clang/include/clang/AST/RecursiveASTVisitor.h
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/include/clang/Sema/Sema.h
    M clang/lib/CodeGen/CGExpr.cpp
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Sema/SemaDeclCXX.cpp
    M clang/lib/Sema/SemaExpr.cpp
    A clang/test/CodeGenCXX/cxx2c-consteval-propagate.cpp
    M clang/test/SemaCXX/cxx2a-consteval-default-params.cpp
    M clang/test/SemaCXX/cxx2b-consteval-propagate.cpp

  Log Message:
  -----------
  [Clang] Fix consteval propagation for aggregates and defaulted constructors

This patch does a few things:

* Fix aggregate initialization.
  When an aggregate has an initializer that is immediate-escalating,
  the context in which it is used automatically becomes an immediate function.
  The wording does that by rpretending an aggregate initialization is itself
  an invocation which is not really how clang works, so my previous attempt
  was... wrong.

* Fix initialization of defaulted constructors with immediate escalating
  default member initializers.
  The wording was silent about that case and I did not handled it fully
  https://cplusplus.github.io/CWG/issues/2760.html

* Fix diagnostics
  In some cases clang would produce additional and unhelpful
  diagnostics by listing the invalid references to consteval
  function that appear in immediate escalating functions

Fixes https://github.com/llvm/llvm-project/issues/63742

Reviewed By: aaron.ballman, #clang-language-wg, Fznamznon

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




More information about the All-commits mailing list