mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 09:28:07 +02:00
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:
parent
d1567249e9
commit
8eca68d2de
1 changed files with 5 additions and 0 deletions
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue