[PATCH] D128619: [Clang] Implement P0848 (Conditionally Trivial Special Member Functions)

Roy Jacobson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 14 15:53:11 PDT 2022


royjacobson created this revision.
Herald added a project: All.
royjacobson updated this revision to Diff 444173.
royjacobson added a comment.
royjacobson updated this revision to Diff 444419.
royjacobson retitled this revision from "[WIP][Clang] Implement P0848 (Conditionally Trivial Special Member Functions)" to "[Clang] Implement P0848 (Conditionally Trivial Special Member Functions)".
royjacobson edited the summary of this revision.
royjacobson added reviewers: clang-language-wg, erichkeane, cor3ntin, BRevzin, CaseyCarter, aaron.ballman.
royjacobson published this revision for review.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The implementation is more or less complete, but I still need to add an AST test for canPassInRegisters.


royjacobson added a comment.

Implementation ready for CR.



================
Comment at: clang/www/cxx_status.html:930
         <td><a href="https://wg21.link/p0848r3">P0848R3</a></td>
-        <td rowspan="1" class="none" align="center">No</td>
+        <td rowspan="1" class="none" align="center">Clang 15</td>
       </tr>
----------------
Should be `class="unreleased"`, I believe


================
Comment at: clang/www/cxx_status.html:930
         <td><a href="https://wg21.link/p0848r3">P0848R3</a></td>
-        <td rowspan="1" class="none" align="center">No</td>
+        <td rowspan="1" class="none" align="center">Clang 15</td>
       </tr>
----------------
h-vetinari wrote:
> Should be `class="unreleased"`, I believe
Thanks, nice catch!


This patch implements P0848 in Clang.

During the instantiation of a C++ class, in `Sema::ActOnFields`, we evaluate constraints for all the SMFs and compare the constraints to compute the eligibility. We defer the computation of the type's [copy-]trivial bits from addedMember to the eligibility computation, like we did for destructors in D126194 <https://reviews.llvm.org/D126194>. `canPassInRegisters` is modified as well to better respect the ineligibility of functions.

Note: Because of the non-implementation of DR1734 and DR1496, I treat deleted member functions as 'eligible' for the purpose of [copy-]triviallity. This is unfortunate, but I couldn't think of a way to make this make sense otherwise.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D128619

Files:
  clang/docs/ReleaseNotes.rst
  clang/lib/AST/DeclCXX.cpp
  clang/lib/Frontend/InitPreprocessor.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
  clang/test/AST/conditionally-trivial-smfs.cpp
  clang/test/Lexer/cxx-features.cpp
  clang/test/SemaCXX/constrained-special-member-functions.cpp
  clang/www/cxx_status.html

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128619.444419.patch
Type: text/x-patch
Size: 32214 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220714/4495c196/attachment-0001.bin>


More information about the cfe-commits mailing list