Add PRESUBMIT check to catch new usages of Pass().

std::move() should be used instead of Pass().

BUG=557422

Review URL: https://codereview.chromium.org/1538783002

Cr-Commit-Position: refs/heads/master@{#366051}
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 9a7f4c34..4755771e 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -1651,7 +1651,7 @@
   results.extend(_CheckForInvalidOSMacros(input_api, output_api))
   results.extend(_CheckForInvalidIfDefinedMacros(input_api, output_api))
   # TODO(danakj): Remove this when base/move.h is removed.
-  results.extend(_CheckForUsingSideEffectsOfPass(input_api, output_api))
+  results.extend(_CheckForUsingPass(input_api, output_api))
   results.extend(_CheckAddedDepsHaveTargetApprovals(input_api, output_api))
   results.extend(
       input_api.canned_checks.CheckChangeHasNoTabs(
@@ -1815,17 +1815,17 @@
       bad_macros)]
 
 
-def _CheckForUsingSideEffectsOfPass(input_api, output_api):
+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():
-        # Disallow Foo(*my_scoped_thing.Pass()); See crbug.com/418297.
-        if input_api.re.search(r'\*[a-zA-Z0-9_]+\.Pass\(\)', line):
+        # 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 *foo.Pass() to delete the contents of scoped_ptr. ' +
-             'See crbug.com/418297.') % (f.LocalPath(), lnum)))
+              ('%s:%d uses Pass(); please use std::move() instead. ' +
+               'See crbug.com/557422.') % (f.LocalPath(), lnum)))
   return errors