[libc-commits] [libc] 508929d - [libc] Make GpuHeaderFile a subclass (#121445)

via libc-commits libc-commits at lists.llvm.org
Wed Jan 1 18:16:36 PST 2025


Author: Roland McGrath
Date: 2025-01-01T18:16:32-08:00
New Revision: 508929d42a8735b05815b5332a4733ed8d0bf1eb

URL: https://github.com/llvm/llvm-project/commit/508929d42a8735b05815b5332a4733ed8d0bf1eb
DIFF: https://github.com/llvm/llvm-project/commit/508929d42a8735b05815b5332a4733ed8d0bf1eb.diff

LOG: [libc] Make GpuHeaderFile a subclass (#121445)

Replace copy&paste from HeaderFile to GpuHeaderFile with
subclassing.  Only the __str__ method differs.

Added: 
    

Modified: 
    libc/utils/hdrgen/gpu_headers.py

Removed: 
    


################################################################################
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 = []
 


        


More information about the libc-commits mailing list