Skip to content

Commit

Permalink
Cli fiix
Browse files Browse the repository at this point in the history
  • Loading branch information
olabetskyi committed Jun 18, 2024
1 parent 10a3ce3 commit 5eb1731
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions addons/cppcheckdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,8 @@ def iterconfigurations(self):
# Iterating <typedef-info>
iter_typedef_info = False

iter_directive = False

# Use iterable objects to traverse XML tree for dump files incrementally.
# Iterative approach is required to avoid large memory consumption.
# Calling .clear() is necessary to let the element be garbage collected.
Expand Down Expand Up @@ -1312,8 +1314,12 @@ def iterconfigurations(self):
cfg.standards.set_posix(node)

# Parse directives list
elif node.tag == 'directive' and event == 'start':
cfg.directives.append(Directive(node))
elif node.tag == 'directive':
if event == 'start':
cfg.directives.append(Directive(node))
iter_directive = True
elif event == 'end':
iter_directive = False
# Parse macro usage
elif node.tag == 'macro' and event == 'start':
cfg.macro_usage.append(MacroUsage(node))
Expand All @@ -1325,7 +1331,7 @@ def iterconfigurations(self):
# Parse tokens
elif node.tag == 'tokenlist' and event == 'start':
continue
elif node.tag == 'token' and event == 'start':
elif node.tag == 'token' and event == 'start' and not iter_directive:
cfg.tokenlist.append(Token(node))

# Parse scopes
Expand Down

0 comments on commit 5eb1731

Please sign in to comment.