Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cpplint.py
Original file line number Diff line number Diff line change
Expand Up @@ -5962,7 +5962,7 @@ def ExpectingFunctionArgs(clean_lines, linenum):
# Match max<type>(..., ...), 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'std\b\::' + _template + r'(<.*?>)?\([^\)]'),
_template,
_header))
# Match set<type>, but not foo->set<type>, foo.set<type>
Expand Down
13 changes: 9 additions & 4 deletions cpplint_unittest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ def testIncludeWhatYouUse(self):
' [build/include_what_you_use] [4]')
self.TestIncludeWhatYouUse(
"""#include "base/foobar.h"
bool foobar = min<int>(0,1);
bool foobar = std::min<int>(0,1);
""",
'Add #include <algorithm> for min [build/include_what_you_use] [4]')
self.TestIncludeWhatYouUse(
Expand All @@ -1044,18 +1044,23 @@ def testIncludeWhatYouUse(self):
'') # Avoid false positives on strings in other namespaces.
self.TestIncludeWhatYouUse(
"""#include "base/foobar.h"
bool foobar = swap(0,1);
bool foobar = std::swap(0,1);
""",
'Add #include <utility> for swap [build/include_what_you_use] [4]')
self.TestIncludeWhatYouUse(
"""#include "base/foobar.h"
bool foobar = transform(a.begin(), a.end(), b.start(), Foo);
bool foobar = std::transform(a.begin(), a.end(), b.start(), Foo);
""",
'Add #include <algorithm> for transform '
'[build/include_what_you_use] [4]')
self.TestIncludeWhatYouUse(
"""#include "base/foobar.h"
bool foobar = min_element(a.begin(), a.end());
boost::range::transform(input, std::back_inserter(output), square);
""",
'') # Avoid false positives on transform in other namespaces.
self.TestIncludeWhatYouUse(
"""#include "base/foobar.h"
bool foobar = std::min_element(a.begin(), a.end());
""",
'Add #include <algorithm> for min_element '
'[build/include_what_you_use] [4]')
Expand Down