[libcxx-commits] [libcxx] [libc++][modules] Adds std.compat module. (PR #71438)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Nov 21 09:57:53 PST 2023
================
@@ -0,0 +1,307 @@
+# ===----------------------------------------------------------------------===##
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+# ===----------------------------------------------------------------------===##
+
+from libcxx.header_information import module_headers
+from libcxx.header_information import header_restrictions
+
+### SkipDeclarations
+
+# Ignore several declarations found in the includes.
+#
+# Part of these items are bugs other are not yet implemented features.
+SkipDeclarations = dict()
+
+# See comment in the header.
+SkipDeclarations["cuchar"] = ["std::mbstate_t", "std::size_t"]
+
+# Not in the synopsis.
+SkipDeclarations["cwchar"] = ["std::FILE"]
+
+# The operators are added for private types like __iom_t10.
+SkipDeclarations["iomanip"] = ["std::operator<<", "std::operator>>"]
+
+SkipDeclarations["iosfwd"] = ["std::ios_base", "std::vector"]
+
+# This header also provides declarations in the namespace that might be
+# an error.
+SkipDeclarations["filesystem"] = [
+ "std::filesystem::operator==",
+ "std::filesystem::operator!=",
+]
+
+# This is a specialization for a private type
+SkipDeclarations["iterator"] = ["std::pointer_traits"]
+
+# TODO MODULES
+# This definition is declared in string and defined in istream
+# This declaration should be part of string
+SkipDeclarations["istream"] = ["std::getline"]
+
+# P1614 (at many places) and LWG3519 too.
+SkipDeclarations["random"] = [
+ "std::operator!=",
+ # LWG3519 makes these hidden friends.
+ # Note the older versions had the requirement of these operations but not in
+ # the synopsis.
+ "std::operator<<",
+ "std::operator>>",
+ "std::operator==",
+]
+
+# Declared in the forward header since std::string uses std::allocator
+SkipDeclarations["string"] = ["std::allocator"]
+# TODO MODULES remove zombie names
+# https://libcxx.llvm.org/Status/Cxx20.html#note-p0619
+SkipDeclarations["memory"] = [
+ "std::return_temporary_buffer",
+ "std::get_temporary_buffer",
+]
+
+# TODO MODULES this should be part of ios instead
+SkipDeclarations["streambuf"] = ["std::basic_ios"]
+
+# include/__type_traits/is_swappable.h
+SkipDeclarations["type_traits"] = [
+ "std::swap",
+ # TODO MODULES gotten through __functional/unwrap_ref.h
+ "std::reference_wrapper",
+]
+
+### ExtraDeclarations
+
+# Add declarations in headers.
+#
+# Some headers have their defines in a different header, which may have
+# additional declarations.
+ExtraDeclarations = dict()
+# This declaration is in the ostream header.
+ExtraDeclarations["system_error"] = ["std::operator<<"]
+
+### ExtraHeader
+
+# Adds extra headers file to scan
+#
+# Some C++ headers in libc++ are stored in multiple physical files. There is a
+# pattern to find these files. However there are some exceptions these are
+# listed here.
+ExtraHeader = dict()
+# locale has a file and not a subdirectory
+ExtraHeader["locale"] = "v1/__locale$"
+ExtraHeader["thread"] = "v1/__threading_support$"
+ExtraHeader["ranges"] = "v1/__fwd/subrange.h$"
+
+# The extra header is needed since two headers are required to provide the
+# same definition.
+ExtraHeader["functional"] = "v1/__compare/compare_three_way.h$"
+
+
+# newline needs to be escaped for the module partition output.
+nl = "\\\\n"
+
+
+class module_test_generator:
----------------
ldionne wrote:
`@dataclass`? Would simplify your constructor I think.
https://github.com/llvm/llvm-project/pull/71438
More information about the libcxx-commits
mailing list