[libc-commits] [libc] [libc] Add some integration features into newhdrgen (PR #114272)

Michael Jones via libc-commits libc-commits at lists.llvm.org
Tue Dec 10 11:07:27 PST 2024


================
@@ -252,30 +273,62 @@ def main():
     )
     args = parser.parse_args()
 
+    def write_to_file(path, contents):
+        if (
+            not args.write_if_changed
+            or not path.exists()
+            or path.read_text() != contents
+        ):
+            path.write_text(contents)
+
+    yaml_file = args.yaml_file
+    if args.h_def_file and not yaml_file:
+        libc_include_dir = args.libc_dir / "include"
+        libc_yaml_dir = args.libc_dir / "newhdrgen" / "yaml"
+        yaml_file = libc_yaml_dir / args.h_def_file.with_suffix("").with_suffix(
+            ".yaml"
+        ).relative_to(libc_include_dir)
+
+    if args.output_dir:
+        output_file_path = args.output_dir
+        if output_file_path.is_dir():
+            if not args.yaml_file:
+                libc_yaml_dir = args.libc_dir / "newhdrgen" / "yaml"
----------------
michaelrj-google wrote:

also needs to be updated.

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


More information about the libc-commits mailing list