[libcxx-commits] [libcxx] [libc++] Implements the new FTM header test generator. (PR #134542)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue May 6 09:20:05 PDT 2025


================
@@ -2296,24 +2424,160 @@ def version_header(self) -> str:
             )
         )
 
+    def header_ftm(self, header: str) -> Dict[Std, List[Dict[Ftm, FtmHeaderTest]]]:
+        """Generates the FTM information for a `header`."""
+
+        result = dict()
+        for std in self.std_dialects:
+            result[get_std_number(std)] = list()
+
+        for ftm, values in self.standard_ftms.items():
+            if not header in self.ftm_metadata[ftm].headers:
+                continue
+
+            last_value = None
+            last_entry = None
+
+            for std in self.std_dialects:
+                if not std in values.keys():
+                    result[get_std_number(std)].append(dict({ftm: None}))
+                    continue
+
+                result[get_std_number(std)].append(
+                    dict(
+                        {
+                            ftm: FtmHeaderTest(
+                                values[std],
+                                self.is_implemented(ftm, std),
+                                self.ftm_metadata[ftm].test_suite_guard,
+                            )
+                        }
+                    )
+                )
+
+        return result
+
+
+    def generate_header_test_ftm(self, std: Std, ftm: Ftm, value: FtmHeaderTest) -> str:
+        """Adds a single `ftm` test for C++ `std` based on the status information in `value`.
+
+        When std == None this test is generating the TEST_STD_VER < MIN. Where
+        MIN is the minimum version that has a FTM defined. (In the real data
+        this is 14, since FTM have been introduced in C++14.)
+        """
+
+        if std == None or value == None:
+            return ftm_unavailable_in_dialect.format(
----------------
ldionne wrote:

Let's try to move the definition of these templates closer to their use. Otherwise we have to jump around quite a bit to understand the function.

https://github.com/llvm/llvm-project/pull/134542


More information about the libcxx-commits mailing list