[libc-commits] [libc] [libc] Make hdrgen support macro_header YAML field. (PR #123265)
Caslyn Tonelli via libc-commits
libc-commits at lists.llvm.org
Thu Feb 13 13:12:43 PST 2025
================
@@ -32,11 +34,24 @@ def add_object(self, object):
def add_function(self, function):
self.functions.append(function)
+ def includes(self):
+ return sorted(
+ {
+ PurePath("llvm-libc-macros") / macro.header
+ for macro in self.macros
+ if macro.header is not None
+ }
+ )
+
def public_api(self):
- content = [""]
+ header_dir = PurePath(self.name).parent
+ content = [
+ f'#include "{file.relative_to(header_dir)}"' for file in self.includes()
+ ] + [""]
for macro in self.macros:
- content.append(f"{macro}\n")
+ if str(macro):
----------------
Caslyn wrote:
Is this `str(macro)` needed in case macro is `None`? (If so, I wonder if it'd be clearer to have an `is not None` check or some sort).
https://github.com/llvm/llvm-project/pull/123265
More information about the libc-commits
mailing list