[libcxx-commits] [libcxx] b9915ad - [libc++] Properly detect whether C++20 modules are supported by the compiler (#94275)

via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 4 11:20:56 PDT 2024


Author: Louis Dionne
Date: 2024-06-04T14:20:52-04:00
New Revision: b9915ad40c31ee95e6e64c44249c9fd5767f0e34

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

LOG: [libc++] Properly detect whether C++20 modules are supported by the compiler (#94275)

It is possible for a compiler to support the warning without being able
to compile `export module foo;`, so use that in addition to the warning
to check whether C++20 modules are supported.

Added: 
    

Modified: 
    libcxx/utils/libcxx/test/features.py

Removed: 
    


################################################################################
diff  --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py
index 093cd39ea64c6..7a9631a56e4bb 100644
--- a/libcxx/utils/libcxx/test/features.py
+++ b/libcxx/utils/libcxx/test/features.py
@@ -317,7 +317,14 @@ def _mingwSupportsModules(cfg):
         or ("_WIN32" in compilerMacros(cfg) and not _mingwSupportsModules(cfg))
         or platform.system().lower().startswith("aix")
         # Avoid building on platforms that don't support modules properly.
-        or not hasCompileFlag(cfg, "-Wno-reserved-module-identifier"),
+        or not hasCompileFlag(cfg, "-Wno-reserved-module-identifier")
+        or not sourceBuilds(
+            cfg,
+            """
+            export module test;
+            int main(int, char**) { return 0; }
+          """,
+        ),
     ),
     # The time zone validation tests compare the output of zdump against the
     # output generated by <chrono>'s time zone support.


        


More information about the libcxx-commits mailing list