Skip to content

Commit 508929d

Browse files
authored
[libc] Make GpuHeaderFile a subclass (#121445)
Replace copy&paste from HeaderFile to GpuHeaderFile with subclassing. Only the __str__ method differs.
1 parent 62cd050 commit 508929d

File tree

1 file changed

+2
-24
lines changed

1 file changed

+2
-24
lines changed

libc/utils/hdrgen/gpu_headers.py

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,9 @@
66
#
77
# ==-------------------------------------------------------------------------==#
88

9+
from header import HeaderFile
910

10-
class GpuHeaderFile:
11-
def __init__(self, name):
12-
self.name = name
13-
self.macros = []
14-
self.types = []
15-
self.enumerations = []
16-
self.objects = []
17-
self.functions = []
18-
19-
def add_macro(self, macro):
20-
self.macros.append(macro)
21-
22-
def add_type(self, type_):
23-
self.types.append(type_)
24-
25-
def add_enumeration(self, enumeration):
26-
self.enumerations.append(enumeration)
27-
28-
def add_object(self, object):
29-
self.objects.append(object)
30-
31-
def add_function(self, function):
32-
self.functions.append(function)
33-
11+
class GpuHeaderFile(HeaderFile):
3412
def __str__(self):
3513
content = []
3614

0 commit comments

Comments
 (0)