freedreno/registers: Don't re-parse files

Track the files we've parsed, and skip ones we have already seen, if
(for example) we see the same paths imported from imported files.

Additionally having the list of files we have parsed will be useful to
generate a headergen-like top-of-file license comment.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27124>
This commit is contained in:
Rob Clark 2024-01-17 11:24:17 -08:00 committed by Marge Bot
parent d1567249e9
commit 8eca68d2de

View file

@ -335,6 +335,7 @@ class Parser(object):
self.enums = {}
self.variants = set()
self.file = []
self.xml_files = []
def error(self, message):
parser, filename = self.stack[-1]
@ -460,6 +461,10 @@ class Parser(object):
print("lxml not found, skipping validation", file=sys.stderr)
def do_parse(self, filename):
filepath = os.path.abspath(filename)
if filepath in self.xml_files:
return
self.xml_files.append(filepath)
file = open(filename, "rb")
parser = xml.parsers.expat.ParserCreate()
self.stack.append((parser, filename))