Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Unified Diff: PRESUBMIT.py

Issue 2047633002: Revert of Remove base/move.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | base/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698