• Vaclav Brozek's avatar
    Extend presubmit _CheckUniquePtr to multiline · 95face65
    Vaclav Brozek authored
    The presubmit check _CheckUniquePtr guards against calling
    std::unique_ptr constructor directly, instead directing code authors to
    use std::make_unique.
    
    This check currently fails to match multiline expressions. While it
    catches
    bar = std::unique_ptr<T>(foo);
    it does not catch
    bar =
        std::unique_ptr<T>(foo);
    nor does it catch
    bar = std::unique_ptr<T>(
        foo);
    
    This CL fixes it by extending the match pattern to catch all lines with
    the substring "std::unique_ptr<T>(". (But not those with
    "std::unique_ptr<T>()", which should be handled by the "nullptr-check".)
    
    Bug: 827961
    Change-Id: I376b5e9811418205e294e97de0b6b7bcbf6891d2
    Reviewed-on: https://chromium-review.googlesource.com/989735
    Commit-Queue: Vaclav Brozek <vabr@chromium.org>
    Reviewed-by: default avatarJochen Eisinger <jochen@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#548045}
    95face65
PRESUBMIT_test.py 60.8 KB