[PATCH] D150773: [clang][modules] Add features for recent C++ versions

Jonas Hahnfeld via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 17 05:49:18 PDT 2023


Hahnfeld created this revision.
Hahnfeld added reviewers: ChuanqiXu, Bigcheese, v.g.vassilev, aaron.ballman.
Herald added a project: All.
Hahnfeld requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Add `cplusplus20`, `cplusplus23`, and `cplusplus26` (but don't document the latter, following the current policy).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150773

Files:
  clang/docs/Modules.rst
  clang/lib/Basic/Module.cpp
  clang/test/Modules/Inputs/DependsOnModule.framework/module.map
  clang/test/Modules/requires.m


Index: clang/test/Modules/requires.m
===================================================================
--- clang/test/Modules/requires.m
+++ clang/test/Modules/requires.m
@@ -22,11 +22,17 @@
 @import DependsOnModule.CXX14; // expected-note {{module imported here}}
 // expected-error at DependsOnModule.framework/module.map:46 {{module 'DependsOnModule.CXX17' requires feature 'cplusplus17'}}
 @import DependsOnModule.CXX17; // expected-note {{module imported here}}
+// expected-error at DependsOnModule.framework/module.map:49 {{module 'DependsOnModule.CXX20' requires feature 'cplusplus20'}}
+ at import DependsOnModule.CXX20; // expected-note {{module imported here}}
+// expected-error at DependsOnModule.framework/module.map:52 {{module 'DependsOnModule.CXX23' requires feature 'cplusplus23'}}
+ at import DependsOnModule.CXX23; // expected-note {{module imported here}}
+// expected-error at DependsOnModule.framework/module.map:55 {{module 'DependsOnModule.CXX26' requires feature 'cplusplus26'}}
+ at import DependsOnModule.CXX26; // expected-note {{module imported here}}
 #else
-// expected-error at DependsOnModule.framework/module.map:49 {{module 'DependsOnModule.C99' requires feature 'c99'}}
+// expected-error at DependsOnModule.framework/module.map:58 {{module 'DependsOnModule.C99' requires feature 'c99'}}
 @import DependsOnModule.C99; // expected-note {{module imported here}}
-// expected-error at DependsOnModule.framework/module.map:52 {{module 'DependsOnModule.C11' requires feature 'c11'}}
+// expected-error at DependsOnModule.framework/module.map:61 {{module 'DependsOnModule.C11' requires feature 'c11'}}
 @import DependsOnModule.C11; // expected-note {{module imported here}}
-// expected-error at DependsOnModule.framework/module.map:55 {{module 'DependsOnModule.C17' requires feature 'c17'}}
+// expected-error at DependsOnModule.framework/module.map:64 {{module 'DependsOnModule.C17' requires feature 'c17'}}
 @import DependsOnModule.C17; // expected-note {{module imported here}}
 #endif
Index: clang/test/Modules/Inputs/DependsOnModule.framework/module.map
===================================================================
--- clang/test/Modules/Inputs/DependsOnModule.framework/module.map
+++ 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
   }
Index: clang/lib/Basic/Module.cpp
===================================================================
--- clang/lib/Basic/Module.cpp
+++ 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)
Index: clang/docs/Modules.rst
===================================================================
--- clang/docs/Modules.rst
+++ 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.
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150773.523015.patch
Type: text/x-patch
Size: 3650 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230517/e0c02410/attachment.bin>


More information about the cfe-commits mailing list