Fix missing header finder regexp for a more general case

This commit is contained in:
Grigory Serebryakov 2017-01-24 10:43:52 +03:00
parent b57fed5dda
commit 9c15bc7f0c

17
cpplint/cpplint.py vendored
View File

@ -5323,7 +5323,22 @@ for _header, _templates in _HEADERS_MAYBE_TEMPLATES:
# Match max<type>(..., ...), max(..., ...), ::max(..., ...) but not
# foo->max, foo.max or type::max().
_re_pattern_headers_maybe_templates.append(
(re.compile(r'[^>.](?<!\w::)\b' + _template + r'(<.*?>)?\([^\)]'),
(re.compile(r"""
(
\bstd:: | # starts with std::
[(+\-=?%^&*/\[] | # used in arithmetic expression or ternary conditional operator
[^:]: | # the second part of ternary conditional operator
^ # or just the start of the line
) [\s]* # possibly we have spaces
""" + _template +
r"""
(
[\s]* # possibly, spaces
<.*?> # the arguments for the template
)? # we can omit the template part
[\s]* #spaces
\( [^\)] # after function we should have opening brace
""", re.X),
_template,
_header))