[clang] adb68c9 - [clang][modules] Add a c23 module feature

Ian Anderson via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 29 11:27:41 PDT 2023


Author: Ian Anderson
Date: 2023-08-29T11:11:14-07:00
New Revision: adb68c979d846a55bef2ea8208a69565e8c1a833

URL: https://github.com/llvm/llvm-project/commit/adb68c979d846a55bef2ea8208a69565e8c1a833
DIFF: https://github.com/llvm/llvm-project/commit/adb68c979d846a55bef2ea8208a69565e8c1a833.diff

LOG: [clang][modules] Add a c23 module feature

Add a c23 module feature for `requires`.

Reviewed By: ChuanqiXu, v.g.vassilev, aaron.ballman

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/docs/Modules.rst b/clang/docs/Modules.rst
index a54850f5457bd4..06294e3c58a4f8 100644
--- a/clang/docs/Modules.rst
+++ b/clang/docs/Modules.rst
@@ -588,6 +588,9 @@ c11
 c17
   C17 support is available.
 
+c23
+  C23 support is available.
+
 freestanding
   A freestanding environment is available.
 

diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 9cd95005d7e059..6f97acc09bc934 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -107,6 +107,7 @@ C23 Feature Support
   and the ``__STDC_VERSION__`` macro now expands to ``202311L`` instead of its
   previous placeholder value. Clang continues to accept ``-std=c2x`` and
   ``-std=gnu2x`` as aliases for C23 and GNU C23, respectively.
+- Clang now supports `requires c23` for module maps.
 
 Non-comprehensive list of changes in this release
 -------------------------------------------------

diff  --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp
index 8ec68237a0fc08..4ffdb6a5f717cf 100644
--- a/clang/lib/Basic/Module.cpp
+++ b/clang/lib/Basic/Module.cpp
@@ -113,6 +113,7 @@ static bool hasFeature(StringRef Feature, const LangOptions &LangOpts,
                         .Case("c99", LangOpts.C99)
                         .Case("c11", LangOpts.C11)
                         .Case("c17", LangOpts.C17)
+                        .Case("c23", LangOpts.C23)
                         .Case("freestanding", LangOpts.Freestanding)
                         .Case("gnuinlineasm", LangOpts.GNUAsm)
                         .Case("objc", LangOpts.ObjC)

diff  --git a/clang/test/Modules/Inputs/DependsOnModule.framework/module.map b/clang/test/Modules/Inputs/DependsOnModule.framework/module.map
index 9cede40c45c336..c4813b679f0efd 100644
--- a/clang/test/Modules/Inputs/DependsOnModule.framework/module.map
+++ b/clang/test/Modules/Inputs/DependsOnModule.framework/module.map
@@ -64,4 +64,7 @@ framework module DependsOnModule {
   explicit module C17 {
     requires c17
   }
+  explicit module C23 {
+    requires c23
+  }
 }

diff  --git a/clang/test/Modules/requires.m b/clang/test/Modules/requires.m
index b370fa31ee0d95..77f00a0e47c182 100644
--- a/clang/test/Modules/requires.m
+++ b/clang/test/Modules/requires.m
@@ -35,4 +35,6 @@
 @import DependsOnModule.C11; // expected-note {{module imported here}}
 // expected-error at DependsOnModule.framework/module.map:64 {{module 'DependsOnModule.C17' requires feature 'c17'}}
 @import DependsOnModule.C17; // expected-note {{module imported here}}
+// expected-error at DependsOnModule.framework/module.map:67 {{module 'DependsOnModule.C23' requires feature 'c23'}}
+ at import DependsOnModule.C23; // expected-note {{module imported here}}
 #endif


        


More information about the cfe-commits mailing list