Index: PRESUBMIT.py |
diff --git a/PRESUBMIT.py b/PRESUBMIT.py |
index cd297043b1fa33567e53f29628975736a9b5e8da..7501dde1f040012c7eefe08898c42ea831e40824 100644 |
--- a/PRESUBMIT.py |
+++ b/PRESUBMIT.py |
@@ -1851,6 +1851,8 @@ |
results.extend(_CheckForInvalidOSMacros(input_api, output_api)) |
results.extend(_CheckForInvalidIfDefinedMacros(input_api, output_api)) |
results.extend(_CheckFlakyTestUsage(input_api, output_api)) |
+ # TODO(danakj): Remove this when base/move.h is removed. |
+ results.extend(_CheckForUsingPass(input_api, output_api)) |
results.extend(_CheckAddedDepsHaveTargetApprovals(input_api, output_api)) |
results.extend( |
input_api.canned_checks.CheckChangeHasNoTabs( |
@@ -2017,6 +2019,20 @@ |
bad_macros)] |
+def _CheckForUsingPass(input_api, output_api): |
+ """Check all affected files for using side effects of Pass.""" |
+ errors = [] |
+ for f in input_api.AffectedFiles(): |
+ if f.LocalPath().endswith(('.h', '.c', '.cc', '.m', '.mm')): |
+ for lnum, line in f.ChangedContents(): |
+ # Warn on any use of foo.Pass(). |
+ if input_api.re.search(r'[a-zA-Z0-9_]+\.Pass\(\)', line): |
+ errors.append(output_api.PresubmitError( |
+ ('%s:%d uses Pass(); please use std::move() instead. ' + |
+ 'See crbug.com/557422.') % (f.LocalPath(), lnum))) |
+ return errors |
+ |
+ |
def _CheckForIPCRules(input_api, output_api): |
"""Check for same IPC rules described in |
http://www.chromium.org/Home/chromium-security/education/security-tips-for-ipc |