Skip to content

Commit

Permalink
[libc] Make GpuHeaderFile a subclass (#121445)
Browse files Browse the repository at this point in the history
Replace copy&paste from HeaderFile to GpuHeaderFile with
subclassing.  Only the __str__ method differs.
  • Loading branch information
frobtech authored Jan 2, 2025
1 parent 62cd050 commit 508929d
Showing 1 changed file with 2 additions and 24 deletions.
26 changes: 2 additions & 24 deletions libc/utils/hdrgen/gpu_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []

Expand Down

0 comments on commit 508929d

Please sign in to comment.