tools/binary_size/libsupersize/function_signature.py
def _FindParameterListParen(name):
  """Finds index of the "(" that denotes the start of a parameter list."""
  # This loops from left-to-right, but the only reason (I think) that this
  # is necessary (rather than reusing _FindLastCharOutsideOfBrackets), is
  # to capture the outer-most function in the case where classes are nested.
  start_idx = 0
  template_balance_count = 0
  paren_balance_count = 0
  while True:
    idx = name.find('(', start_idx)
    if idx == -1:
      return -1
    template_balance_count += (
        name.count('<', start_idx, idx) - name.count('>', start_idx, idx))
    # Special: operators with angle brackets.
    operator_idx = name.find('operator<', start_idx, idx)
    if operator_idx != -1:
      if name[operator_idx + 9] == '<':
        template_balance_count -= 2
      else:
        template_balance_count -= 1
    else:
      operator_idx = name.find('operator>', start_idx, idx)
      if operator_idx != -1:
        if name[operator_idx + 9] == '>':
          template_balance_count += 2
        else:
          template_balance_count += 1

    paren_balance_count += (
        name.count('(', start_idx, idx) - name.count(')', start_idx, idx))
    if template_balance_count == 0 and paren_balance_count == 0:
      # Special case: skip "(anonymous namespace)".
      if -1 != name.find('(anonymous namespace)', idx, idx + 21):
        start_idx = idx + 21
        continue
      # Special case: skip "decltype (...)"
      # Special case: skip "{lambda(PaintOp*)#63}"
      if name[idx - 1] != ' ' and name[idx - 7:idx] != '{lambda':
        return idx
    start_idx = idx + 1
    paren_balance_count += 1
Finds index of the "(" that denotes the start of a parameter list.
Finds index of the "(" that denotes the start of a parameter list.
Finds index of the " ( " that denotes the start of a parameter list .
def _FindParameterListParen(name):
  start_idx = 0
  template_balance_count = 0
  paren_balance_count = 0
  while True:
    idx = name.find('(', start_idx)
    if idx == -1:
      return -1
    template_balance_count += (
        name.count('<', start_idx, idx) - name.count('>', start_idx, idx))
    operator_idx = name.find('operator<', start_idx, idx)
    if operator_idx != -1:
      if name[operator_idx + 9] == '<':
        template_balance_count -= 2
      else:
        template_balance_count -= 1
    else:
      operator_idx = name.find('operator>', start_idx, idx)
      if operator_idx != -1:
        if name[operator_idx + 9] == '>':
          template_balance_count += 2
        else:
          template_balance_count += 1
    paren_balance_count += (
        name.count('(', start_idx, idx) - name.count(')', start_idx, idx))
    if template_balance_count == 0 and paren_balance_count == 0:
      if -1 != name.find('(anonymous namespace)', idx, idx + 21):
        start_idx = idx + 21
        continue
      if name[idx - 1] != ' ' and name[idx - 7:idx] != '{lambda':
        return idx
    start_idx = idx + 1
    paren_balance_count += 1
def _FindParameterListParen ( name ) : start_idx = 0 template_balance_count = 0 paren_balance_count = 0 while True : idx = name . find ( '(' , start_idx ) if idx == - 1 : return - 1 template_balance_count += ( name . count ( '<' , start_idx , idx ) - name . count ( '>' , start_idx , idx ) ) operator_idx = name . find ( 'operator<' , start_idx , idx ) if operator_idx != - 1 : if name [ operator_idx + 9 ] == '<' : template_balance_count -= 2 else : template_balance_count -= 1 else : operator_idx = name . find ( 'operator>' , start_idx , idx ) if operator_idx != - 1 : if name [ operator_idx + 9 ] == '>' : template_balance_count += 2 else : template_balance_count += 1 paren_balance_count += ( name . count ( '(' , start_idx , idx ) - name . count ( ')' , start_idx , idx ) ) if template_balance_count == 0 and paren_balance_count == 0 : if - 1 != name . find ( '(anonymous namespace)' , idx , idx + 21 ) : start_idx = idx + 21 continue if name [ idx - 1 ] != ' ' and name [ idx - 7 : idx ] != '{lambda' : return idx start_idx = idx + 1 paren_balance_count += 1
Finds index of the "(" that denotes the start of a parameter list.
Finds index of the " ( " that denotes the start of a parameter list .
"""Finds index of the "(" that denotes the start of a parameter list.""" # This loops from left-to-right, but the only reason (I think) that this # is necessary (rather than reusing _FindLastCharOutsideOfBrackets), is # to capture the outer-most function in the case where classes are nested. # Special: operators with angle brackets. # Special case: skip "(anonymous namespace)". # Special case: skip "decltype (...)" # Special case: skip "{lambda(PaintOp*)#63}"
name