summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRoland Levillain <rpl@google.com>2014-10-07 11:07:07 +0100
committerRoland Levillain <rpl@google.com>2014-10-07 11:07:07 +0100
commita21f81e6dd28184feabc6816a4d2b0588ee5aa74 (patch)
tree8a95a1b81e516172fa1025f6e1beb9854f288987 /tools
parentb5325e24ca58299b2b011e57e784b2584f99d687 (diff)
downloadart-a21f81e6dd28184feabc6816a4d2b0588ee5aa74.zip
art-a21f81e6dd28184feabc6816a4d2b0588ee5aa74.tar.gz
art-a21f81e6dd28184feabc6816a4d2b0588ee5aa74.tar.bz2
Allow std::function<return_type(arg_type)> patterns in cpplint.
Before this change, cpplint would erroneously recognize `return_type(arg_type)' within `std::function<return_type(arg_type)>' as a C-style cast. Change-Id: I41933fbdbb835e2950304de29edd33b16939708d
Diffstat (limited to 'tools')
-rwxr-xr-xtools/cpplint.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/cpplint.py b/tools/cpplint.py
index c2f6514..4f063d9 100755
--- a/tools/cpplint.py
+++ b/tools/cpplint.py
@@ -3227,9 +3227,16 @@ def CheckLanguage(filename, clean_lines, linenum, file_extension, include_state,
# virtually indistinguishable from int(x) casts. Likewise, gMock's
# MockCallback takes a template parameter of the form return_type(arg_type),
# which looks much like the cast we're trying to detect.
+ # BEGIN android-added
+ # The C++ 2011 std::function class template exhibits a similar issue.
+ # END android-added
if (match.group(1) is None and # If new operator, then this isn't a cast
not (Match(r'^\s*MOCK_(CONST_)?METHOD\d+(_T)?\(', line) or
- Match(r'^\s*MockCallback<.*>', line))):
+ # BEGIN android-changed
+ # Match(r'^\s*MockCallback<.*>', line))):
+ Match(r'^\s*MockCallback<.*>', line) or
+ Match(r'^\s*std::function<.*>', line))):
+ # END android-changed
# Try a bit harder to catch gmock lines: the only place where
# something looks like an old-style cast is where we declare the
# return type of the mocked method, and the only time when we