diff options
author | Roy Jacobson <roi.jacobson1@gmail.com> | 2022-08-26 00:51:06 +0300 |
---|---|---|
committer | Roy Jacobson <roi.jacobson1@gmail.com> | 2022-08-26 00:52:52 +0300 |
commit | b1c960fc6dc2891c8d2ca09c184572ca0857ba15 (patch) | |
tree | 92f3c551605b0cd6f51cbb2135cefe6b57723dca /clang/lib/Frontend/InitPreprocessor.cpp | |
parent | 613336da8ce16bd2e998e77e02eaf5866ad7e311 (diff) | |
download | llvm-b1c960fc6dc2891c8d2ca09c184572ca0857ba15.zip llvm-b1c960fc6dc2891c8d2ca09c184572ca0857ba15.tar.gz llvm-b1c960fc6dc2891c8d2ca09c184572ca0857ba15.tar.bz2 |
[Clang] Implement P0848 (Conditionally Trivial Special Member Functions)
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. `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.
Reviewed By: #clang-language-wg, cor3ntin, aaron.ballman
Differential Revision: https://reviews.llvm.org/D128619
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
-rw-r--r-- | clang/lib/Frontend/InitPreprocessor.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 20bfbf1..162cc26 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -673,7 +673,11 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts, // C++20 features. if (LangOpts.CPlusPlus20) { - //Builder.defineMacro("__cpp_aggregate_paren_init", "201902L"); + // Builder.defineMacro("__cpp_aggregate_paren_init", "201902L"); + + // P0848 is implemented, but we're still waiting for other concepts + // issues to be addressed before bumping __cpp_concepts up to 202002L. + // Refer to the discussion of this at https://reviews.llvm.org/D128619. Builder.defineMacro("__cpp_concepts", "201907L"); Builder.defineMacro("__cpp_conditional_explicit", "201806L"); //Builder.defineMacro("__cpp_consteval", "201811L"); |