0

presubmit: Add hint for std::unique_ptr usage error

The hint points to base::WrapUnique, for when it's not possible to use
std::make_unique<T>() as suggested in existing hint.

Bug: None
Test: Trying to submit a CL with the given issue would show the new
error message.
Change-Id: Ifabfc5ebd2e46e3fe5ff0e6cc1adafd063b2dae6

Change-Id: I49045962b178b97584ad952f8e0117c17df5b849
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3296674
Auto-Submit: Yao Li <yaohuali@google.com>
Commit-Queue: Yao Li <yaohuali@google.com>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#944702}
This commit is contained in:
Yao Li
2021-11-23 22:30:56 +00:00
committed by Chromium LUCI CQ
parent a82f772230
commit 7f5a705dc5

@ -2507,8 +2507,9 @@ def CheckUniquePtrOnUpload(input_api, output_api):
problems_nullptr))
if problems_constructor:
errors.append(output_api.PresubmitError(
'The following files use explicit std::unique_ptr constructor.'
'Use std::make_unique<T>() instead.',
'The following files use explicit std::unique_ptr constructor. '
'Use std::make_unique<T>() instead, or use base::WrapUnique if '
'std::make_unique is not an option.',
problems_constructor))
return errors