Skip to content

Commit

Permalink
Fix IndexError in zbloat tool (#6802)
Browse files Browse the repository at this point in the history
  • Loading branch information
bejado committed May 11, 2023
1 parent 70bb08a commit 2ae4ee8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tools/zbloat/evmar_bloat.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,17 @@ def parse_cpp_name(name, cppfilt):

def parse_one(val):
"""Returns (leftmost-part, remaining)."""

# TODO(bendoherty)
# The algorithm below parses templated symbols and assumes all angle brackets
# are matched. However, this won't necessarily be the case if '<' or '>'
# are used as less-than or greater-than operators.
# (for example: std::enable_if<(X < Y), void>::type)
# To avoid this, we give up trying to parse if the symbol has unmatched
# brackets.
if val.count('<') != val.count('>'):
return (val, '')

if (val.startswith('operator') and
not (val[8].isalnum() or val[8] == '_')):
# Operator overload function, terminate.
Expand Down

0 comments on commit 2ae4ee8

Please sign in to comment.