diff --git a/clang/docs/Modules.rst b/clang/docs/Modules.rst --- a/clang/docs/Modules.rst +++ b/clang/docs/Modules.rst @@ -573,6 +573,12 @@ cplusplus17 C++17 support is available. +cplusplus20 + C++20 support is available. + +cplusplus23 + C++23 support is available. + c99 C99 support is available. diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -94,6 +94,7 @@ - Clang now implements `[temp.deduct]p9`. Substitution failures inside lambdas from unevaluated contexts will be surfaced as errors. They were previously handled as SFINAE. +- Clang now supports `requires cplusplus20` for module maps. C++23 Feature Support ^^^^^^^^^^^^^^^^^^^^^ @@ -108,6 +109,7 @@ longer have to be constexpr compatible but rather support a less restricted requirements for constexpr functions. Which include allowing non-literal types as return values and parameters, allow calling of non-constexpr functions and constructors. +- Clang now supports `requires cplusplus23` for module maps. C++2c Feature Support ^^^^^^^^^^^^^^^^^^^^^ diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp --- a/clang/lib/Basic/Module.cpp +++ b/clang/lib/Basic/Module.cpp @@ -107,6 +107,9 @@ .Case("cplusplus11", LangOpts.CPlusPlus11) .Case("cplusplus14", LangOpts.CPlusPlus14) .Case("cplusplus17", LangOpts.CPlusPlus17) + .Case("cplusplus20", LangOpts.CPlusPlus20) + .Case("cplusplus23", LangOpts.CPlusPlus23) + .Case("cplusplus26", LangOpts.CPlusPlus26) .Case("c99", LangOpts.C99) .Case("c11", LangOpts.C11) .Case("c17", LangOpts.C17) diff --git a/clang/test/Modules/Inputs/DependsOnModule.framework/module.map b/clang/test/Modules/Inputs/DependsOnModule.framework/module.map --- a/clang/test/Modules/Inputs/DependsOnModule.framework/module.map +++ b/clang/test/Modules/Inputs/DependsOnModule.framework/module.map @@ -46,6 +46,15 @@ explicit module CXX17 { requires cplusplus17 } + explicit module CXX20 { + requires cplusplus20 + } + explicit module CXX23 { + requires cplusplus23 + } + explicit module CXX26 { + requires cplusplus26 + } explicit module C99 { requires c99 } diff --git a/clang/test/Modules/requires.m b/clang/test/Modules/requires.m --- a/clang/test/Modules/requires.m +++ b/clang/test/Modules/requires.m @@ -22,11 +22,17 @@ @import DependsOnModule.CXX14; // expected-note {{module imported here}} // expected-error@DependsOnModule.framework/module.map:46 {{module 'DependsOnModule.CXX17' requires feature 'cplusplus17'}} @import DependsOnModule.CXX17; // expected-note {{module imported here}} +// expected-error@DependsOnModule.framework/module.map:49 {{module 'DependsOnModule.CXX20' requires feature 'cplusplus20'}} +@import DependsOnModule.CXX20; // expected-note {{module imported here}} +// expected-error@DependsOnModule.framework/module.map:52 {{module 'DependsOnModule.CXX23' requires feature 'cplusplus23'}} +@import DependsOnModule.CXX23; // expected-note {{module imported here}} +// expected-error@DependsOnModule.framework/module.map:55 {{module 'DependsOnModule.CXX26' requires feature 'cplusplus26'}} +@import DependsOnModule.CXX26; // expected-note {{module imported here}} #else -// expected-error@DependsOnModule.framework/module.map:49 {{module 'DependsOnModule.C99' requires feature 'c99'}} +// expected-error@DependsOnModule.framework/module.map:58 {{module 'DependsOnModule.C99' requires feature 'c99'}} @import DependsOnModule.C99; // expected-note {{module imported here}} -// expected-error@DependsOnModule.framework/module.map:52 {{module 'DependsOnModule.C11' requires feature 'c11'}} +// expected-error@DependsOnModule.framework/module.map:61 {{module 'DependsOnModule.C11' requires feature 'c11'}} @import DependsOnModule.C11; // expected-note {{module imported here}} -// expected-error@DependsOnModule.framework/module.map:55 {{module 'DependsOnModule.C17' requires feature 'c17'}} +// expected-error@DependsOnModule.framework/module.map:64 {{module 'DependsOnModule.C17' requires feature 'c17'}} @import DependsOnModule.C17; // expected-note {{module imported here}} #endif