Fix false positive alarms on missed <algortihm> or <utility> header.

The case of a non-STL realization of the one of the functions under test that
is called via class name/namespace resolution syntax (e.g. type type::min)
was not handled by the RE.
This commit is contained in:
Grigory Serebryakov 2017-01-10 18:43:23 +03:00 committed by Grigory Serebryakov
parent b282a74fea
commit b57fed5dda

6
cpplint/cpplint.py vendored
View File

@ -5320,10 +5320,10 @@ _RE_PATTERN_STRING = re.compile(r'\bstring\b')
_re_pattern_headers_maybe_templates = []
for _header, _templates in _HEADERS_MAYBE_TEMPLATES:
for _template in _templates:
# Match max<type>(..., ...), max(..., ...), but not foo->max, foo.max or
# type::max().
# Match max<type>(..., ...), max(..., ...), ::max(..., ...) but not
# foo->max, foo.max or type::max().
_re_pattern_headers_maybe_templates.append(
(re.compile(r'[^>.]\b' + _template + r'(<.*?>)?\([^\)]'),
(re.compile(r'[^>.](?<!\w::)\b' + _template + r'(<.*?>)?\([^\)]'),
_template,
_header))