[libc-commits] [libc] [libc] Make GpuHeaderFile a subclass (PR #121445)
via libc-commits
libc-commits at lists.llvm.org
Wed Jan 1 17:07:14 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: Roland McGrath (frobtech)
<details>
<summary>Changes</summary>
Replace copy&paste from HeaderFile to GpuHeaderFile with
subclassing. Only the __str__ method differs.
---
Full diff: https://github.com/llvm/llvm-project/pull/121445.diff
1 Files Affected:
- (modified) libc/utils/hdrgen/gpu_headers.py (+2-24)
``````````diff
diff --git a/libc/utils/hdrgen/gpu_headers.py b/libc/utils/hdrgen/gpu_headers.py
index b26b3a88557b4a..8c4ff6e08b1126 100644
--- a/libc/utils/hdrgen/gpu_headers.py
+++ b/libc/utils/hdrgen/gpu_headers.py
@@ -6,31 +6,9 @@
#
# ==-------------------------------------------------------------------------==#
+from header import HeaderFile
-class GpuHeaderFile:
- def __init__(self, name):
- self.name = name
- self.macros = []
- self.types = []
- self.enumerations = []
- self.objects = []
- self.functions = []
-
- def add_macro(self, macro):
- self.macros.append(macro)
-
- def add_type(self, type_):
- self.types.append(type_)
-
- def add_enumeration(self, enumeration):
- self.enumerations.append(enumeration)
-
- def add_object(self, object):
- self.objects.append(object)
-
- def add_function(self, function):
- self.functions.append(function)
-
+class GpuHeaderFile(HeaderFile):
def __str__(self):
content = []
``````````
</details>
https://github.com/llvm/llvm-project/pull/121445
More information about the libc-commits
mailing list