[libc-commits] [libc] [libc] Add some integration features into newhdrgen (PR #114272)
Roland McGrath via libc-commits
libc-commits at lists.llvm.org
Wed Oct 30 14:15:04 PDT 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(
----------------
frobtech wrote:
`.with_suffix("")` strips `.def` and then `.with_suffix(".yaml")` replaces the remaining `.h` with `.yaml`.
https://github.com/llvm/llvm-project/pull/114272
More information about the libc-commits
mailing list