Add a presubmit check for absl/memory/memory.h inclusion for WrapUnique

This fixes a build error on C++17 mode due to missing #include, plus
adds a presubmit check to prevent further breakage.

Bug: chromium:752720
Change-Id: I5c7d1dca0079dfe7a042650402e6f7ae28a797ba
Reviewed-on: https://webrtc-review.googlesource.com/c/124940
Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26898}
This commit is contained in:
tzik 2019-02-28 22:09:59 +09:00 committed by Commit Bot
parent cf7c58458e
commit 6b7bf6ab0c
3 changed files with 8 additions and 3 deletions

View file

@ -955,15 +955,16 @@ def CheckAbslMemoryInclude(input_api, output_api, source_file_filter):
if pattern.search(contents):
continue
for _, line in f.ChangedContents():
if 'absl::make_unique' in line:
if 'absl::make_unique' in line or 'absl::WrapUnique' in line:
files.append(f)
break
if len(files):
return [output_api.PresubmitError(
'Please include "absl/memory/memory.h" header for'
' absl::make_unique.\nThis header may or may not be included'
' transitively depends on the C++ standard version.',
' absl::make_unique or absl::WrapUnique.\nThis header may or'
' may not be included transitively depending on the C++ standard'
' version.',
files)]
return []

View file

@ -10,6 +10,8 @@
#include "logging/rtc_event_log/events/rtc_event_generic_packet_received.h"
#include "absl/memory/memory.h"
namespace webrtc {
RtcEventGenericPacketReceived::RtcEventGenericPacketReceived(

View file

@ -10,6 +10,8 @@
#include "logging/rtc_event_log/events/rtc_event_generic_packet_sent.h"
#include "absl/memory/memory.h"
namespace webrtc {
RtcEventGenericPacketSent::RtcEventGenericPacketSent(int64_t packet_number,