diff --git a/client/crash_report_database_win.cc b/client/crash_report_database_win.cc index fff340a..d7968bd 100644 --- a/client/crash_report_database_win.cc +++ b/client/crash_report_database_win.cc @@ -18,6 +18,8 @@ #include #include +#include + #include "base/logging.h" #include "base/numerics/safe_math.h" #include "base/strings/string16.h" @@ -25,7 +27,6 @@ #include "base/strings/utf_string_conversions.h" #include "client/settings.h" #include "util/misc/initialization_state_dcheck.h" -#include "util/stdlib/move.h" namespace crashpad { @@ -822,7 +823,7 @@ scoped_ptr InitializeInternal( scoped_ptr database_win( new CrashReportDatabaseWin(path)); return database_win->Initialize(may_create) - ? crashpad::move(database_win) + ? std::move(database_win) : scoped_ptr(); } diff --git a/client/crashpad_client_mac.cc b/client/crashpad_client_mac.cc index 4a3673f..cce11d1 100644 --- a/client/crashpad_client_mac.cc +++ b/client/crashpad_client_mac.cc @@ -20,6 +20,8 @@ #include #include +#include + #include "base/logging.h" #include "base/mac/mach_logging.h" #include "base/posix/eintr_wrapper.h" @@ -32,7 +34,6 @@ #include "util/mach/notify_server.h" #include "util/misc/clock.h" #include "util/misc/implicit_cast.h" -#include "util/stdlib/move.h" #include "util/posix/close_multiple.h" namespace crashpad { @@ -159,7 +160,7 @@ class HandlerStarter final : public NotifyServer::DefaultInterface { url, annotations, arguments, - crashpad::move(receive_right), + std::move(receive_right), handler_restarter.get(), false)) { return base::mac::ScopedMachSendRight(); @@ -539,7 +540,7 @@ bool CrashpadClient::StartHandler( return false; } - SetHandlerMachPort(crashpad::move(exception_port)); + SetHandlerMachPort(std::move(exception_port)); return true; } @@ -549,14 +550,14 @@ bool CrashpadClient::SetHandlerMachService(const std::string& service_name) { return false; } - SetHandlerMachPort(crashpad::move(exception_port)); + SetHandlerMachPort(std::move(exception_port)); return true; } void CrashpadClient::SetHandlerMachPort( base::mac::ScopedMachSendRight exception_port) { DCHECK(exception_port.is_valid()); - exception_port_ = crashpad::move(exception_port); + exception_port_ = std::move(exception_port); } bool CrashpadClient::UseHandler() { diff --git a/client/settings.cc b/client/settings.cc index e7ff2a9..b991a38 100644 --- a/client/settings.cc +++ b/client/settings.cc @@ -18,7 +18,6 @@ #include "base/logging.h" #include "base/posix/eintr_wrapper.h" -#include "util/stdlib/move.h" #include "util/numeric/in_range_cast.h" namespace crashpad { diff --git a/compat/compat.gyp b/compat/compat.gyp index 96cd3b9..f1cd493 100644 --- a/compat/compat.gyp +++ b/compat/compat.gyp @@ -28,6 +28,8 @@ 'mac/mach-o/getsect.h', 'mac/mach-o/loader.h', 'mac/sys/resource.h', + 'non_cxx11_lib/type_traits', + 'non_cxx11_lib/utility', 'non_mac/mach/mach.h', 'non_win/dbghelp.h', 'non_win/minwinbase.h', @@ -50,10 +52,12 @@ ], 'include_dirs': [ 'mac', + 'non_cxx11_lib', ], 'direct_dependent_settings': { 'include_dirs': [ 'mac', + 'non_cxx11_lib', ], }, }], diff --git a/compat/non_cxx11_lib/type_traits b/compat/non_cxx11_lib/type_traits new file mode 100644 index 0000000..9f11fd4 --- /dev/null +++ b/compat/non_cxx11_lib/type_traits @@ -0,0 +1,37 @@ +// Copyright 2015 The Crashpad Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef CRASHPAD_COMPAT_NON_CXX11_LIB_TYPE_TRAITS_ +#define CRASHPAD_COMPAT_NON_CXX11_LIB_TYPE_TRAITS_ + +#include "util/stdlib/cxx.h" + +#if CXX_LIBRARY_VERSION >= 2011 + +#include_next + +#else + +namespace std { + +template +struct remove_reference { using type = T; }; +template +struct remove_reference { using type = T; }; + +} // namespace std + +#endif // CXX_LIBRARY_VERSION + +#endif // CRASHPAD_COMPAT_NON_CXX11_LIB_TYPE_TRAITS_ diff --git a/compat/non_cxx11_lib/utility b/compat/non_cxx11_lib/utility new file mode 100644 index 0000000..8aa3de1 --- /dev/null +++ b/compat/non_cxx11_lib/utility @@ -0,0 +1,46 @@ +// Copyright 2015 The Crashpad Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef CRASHPAD_COMPAT_NON_CXX11_LIB_UTILITY_ +#define CRASHPAD_COMPAT_NON_CXX11_LIB_UTILITY_ + +#include_next + +#include "util/stdlib/cxx.h" + +#if CXX_LIBRARY_VERSION < 2011 + +#include + +namespace std { + +template +T&& forward(typename remove_reference::type& t) noexcept { + return static_cast(t); +} +template +T&& forward(typename remove_reference::type&& t) noexcept { + return static_cast(t); +} + +template +typename remove_reference::type&& move(T&& t) noexcept { + return static_cast::type&&>(t); +} + +} // namespace std + +#endif // CXX_LIBRARY_VERSION + +#endif // CRASHPAD_COMPAT_NON_CXX11_LIB_UTILITY_ diff --git a/handler/crash_report_upload_thread.cc b/handler/crash_report_upload_thread.cc index c5fdfaa..7d29aa1 100644 --- a/handler/crash_report_upload_thread.cc +++ b/handler/crash_report_upload_thread.cc @@ -28,7 +28,6 @@ #include "snapshot/minidump/process_snapshot_minidump.h" #include "snapshot/module_snapshot.h" #include "util/file/file_reader.h" -#include "util/stdlib/move.h" #include "util/misc/uuid.h" #include "util/net/http_body.h" #include "util/net/http_multipart_builder.h" diff --git a/handler/handler_main.cc b/handler/handler_main.cc index 4dfd19b..7ad13f6 100644 --- a/handler/handler_main.cc +++ b/handler/handler_main.cc @@ -19,6 +19,7 @@ #include #include +#include #include "base/auto_reset.h" #include "base/files/file_path.h" @@ -33,7 +34,6 @@ #include "tools/tool_support.h" #include "handler/crash_report_upload_thread.h" #include "util/file/file_io.h" -#include "util/stdlib/move.h" #include "util/stdlib/map_insert.h" #include "util/stdlib/string_number_conversion.h" #include "util/string/split_string.h" @@ -315,7 +315,7 @@ int HandlerMain(int argc, char* argv[]) { } ExceptionHandlerServer exception_handler_server( - crashpad::move(receive_right), !options.mach_service.empty()); + std::move(receive_right), !options.mach_service.empty()); base::AutoReset reset_g_exception_handler_server( &g_exception_handler_server, &exception_handler_server); diff --git a/handler/mac/exception_handler_server.cc b/handler/mac/exception_handler_server.cc index 050cc6f..38a016e 100644 --- a/handler/mac/exception_handler_server.cc +++ b/handler/mac/exception_handler_server.cc @@ -14,6 +14,8 @@ #include "handler/mac/exception_handler_server.h" +#include + #include "base/logging.h" #include "base/mac/mach_logging.h" #include "util/mach/composite_mach_message_server.h" @@ -21,7 +23,6 @@ #include "util/mach/mach_message.h" #include "util/mach/mach_message_server.h" #include "util/mach/notify_server.h" -#include "util/stdlib/move.h" namespace crashpad { @@ -184,7 +185,7 @@ class ExceptionHandlerServerRun : public UniversalMachExcServer::Interface, ExceptionHandlerServer::ExceptionHandlerServer( base::mac::ScopedMachReceiveRight receive_port, bool launchd) - : receive_port_(crashpad::move(receive_port)), + : receive_port_(std::move(receive_port)), notify_port_(NewMachPort(MACH_PORT_RIGHT_RECEIVE)), launchd_(launchd) { CHECK(receive_port_.is_valid()); diff --git a/minidump/minidump_crashpad_info_writer.cc b/minidump/minidump_crashpad_info_writer.cc index ea50152..2f2cd55 100644 --- a/minidump/minidump_crashpad_info_writer.cc +++ b/minidump/minidump_crashpad_info_writer.cc @@ -14,12 +14,13 @@ #include "minidump/minidump_crashpad_info_writer.h" +#include + #include "base/logging.h" #include "minidump/minidump_module_crashpad_info_writer.h" #include "minidump/minidump_simple_string_dictionary_writer.h" #include "snapshot/process_snapshot.h" #include "util/file/file_writer.h" -#include "util/stdlib/move.h" namespace crashpad { @@ -52,14 +53,14 @@ void MinidumpCrashpadInfoWriter::InitializeFromSnapshot( simple_annotations->InitializeFromMap( process_snapshot->AnnotationsSimpleMap()); if (simple_annotations->IsUseful()) { - SetSimpleAnnotations(crashpad::move(simple_annotations)); + SetSimpleAnnotations(std::move(simple_annotations)); } auto modules = make_scoped_ptr(new MinidumpModuleCrashpadInfoListWriter()); modules->InitializeFromSnapshot(process_snapshot->Modules()); if (modules->IsUseful()) { - SetModuleList(crashpad::move(modules)); + SetModuleList(std::move(modules)); } } @@ -79,14 +80,14 @@ void MinidumpCrashpadInfoWriter::SetSimpleAnnotations( scoped_ptr simple_annotations) { DCHECK_EQ(state(), kStateMutable); - simple_annotations_ = crashpad::move(simple_annotations); + simple_annotations_ = std::move(simple_annotations); } void MinidumpCrashpadInfoWriter::SetModuleList( scoped_ptr module_list) { DCHECK_EQ(state(), kStateMutable); - module_list_ = crashpad::move(module_list); + module_list_ = std::move(module_list); } bool MinidumpCrashpadInfoWriter::Freeze() { diff --git a/minidump/minidump_crashpad_info_writer_test.cc b/minidump/minidump_crashpad_info_writer_test.cc index bbfbdfc..d5ff65c 100644 --- a/minidump/minidump_crashpad_info_writer_test.cc +++ b/minidump/minidump_crashpad_info_writer_test.cc @@ -19,6 +19,7 @@ #include #include +#include #include "gtest/gtest.h" #include "minidump/minidump_extensions.h" @@ -31,7 +32,6 @@ #include "snapshot/test/test_module_snapshot.h" #include "snapshot/test/test_process_snapshot.h" #include "util/file/string_file.h" -#include "util/stdlib/move.h" namespace crashpad { namespace test { @@ -68,7 +68,7 @@ TEST(MinidumpCrashpadInfoWriter, Empty) { auto crashpad_info_writer = make_scoped_ptr(new MinidumpCrashpadInfoWriter()); EXPECT_FALSE(crashpad_info_writer->IsUseful()); - minidump_file_writer.AddStream(crashpad::move(crashpad_info_writer)); + minidump_file_writer.AddStream(std::move(crashpad_info_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -103,7 +103,7 @@ TEST(MinidumpCrashpadInfoWriter, ReportAndClientID) { EXPECT_TRUE(crashpad_info_writer->IsUseful()); - minidump_file_writer.AddStream(crashpad::move(crashpad_info_writer)); + minidump_file_writer.AddStream(std::move(crashpad_info_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -138,13 +138,13 @@ TEST(MinidumpCrashpadInfoWriter, SimpleAnnotations) { make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter()); simple_string_dictionary_entry_writer->SetKeyValue(kKey, kValue); simple_string_dictionary_writer->AddEntry( - crashpad::move(simple_string_dictionary_entry_writer)); + std::move(simple_string_dictionary_entry_writer)); crashpad_info_writer->SetSimpleAnnotations( - crashpad::move(simple_string_dictionary_writer)); + std::move(simple_string_dictionary_writer)); EXPECT_TRUE(crashpad_info_writer->IsUseful()); - minidump_file_writer.AddStream(crashpad::move(crashpad_info_writer)); + minidump_file_writer.AddStream(std::move(crashpad_info_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -178,12 +178,13 @@ TEST(MinidumpCrashpadInfoWriter, CrashpadModuleList) { auto module_list_writer = make_scoped_ptr(new MinidumpModuleCrashpadInfoListWriter()); auto module_writer = make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter()); - module_list_writer->AddModule(crashpad::move(module_writer), kMinidumpModuleListIndex); - crashpad_info_writer->SetModuleList(crashpad::move(module_list_writer)); + module_list_writer->AddModule(std::move(module_writer), + kMinidumpModuleListIndex); + crashpad_info_writer->SetModuleList(std::move(module_list_writer)); EXPECT_TRUE(crashpad_info_writer->IsUseful()); - minidump_file_writer.AddStream(crashpad::move(crashpad_info_writer)); + minidump_file_writer.AddStream(std::move(crashpad_info_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -233,7 +234,7 @@ TEST(MinidumpCrashpadInfoWriter, InitializeFromSnapshot) { auto process_snapshot = make_scoped_ptr(new TestProcessSnapshot()); auto module_snapshot = make_scoped_ptr(new TestModuleSnapshot()); - process_snapshot->AddModule(crashpad::move(module_snapshot)); + process_snapshot->AddModule(std::move(module_snapshot)); auto info_writer = make_scoped_ptr(new MinidumpCrashpadInfoWriter()); info_writer->InitializeFromSnapshot(process_snapshot.get()); @@ -252,14 +253,14 @@ TEST(MinidumpCrashpadInfoWriter, InitializeFromSnapshot) { module_snapshot.reset(new TestModuleSnapshot()); std::vector annotations_list(1, std::string(kEntry)); module_snapshot->SetAnnotationsVector(annotations_list); - process_snapshot->AddModule(crashpad::move(module_snapshot)); + process_snapshot->AddModule(std::move(module_snapshot)); info_writer.reset(new MinidumpCrashpadInfoWriter()); info_writer->InitializeFromSnapshot(process_snapshot.get()); EXPECT_TRUE(info_writer->IsUseful()); MinidumpFileWriter minidump_file_writer; - minidump_file_writer.AddStream(crashpad::move(info_writer)); + minidump_file_writer.AddStream(std::move(info_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); diff --git a/minidump/minidump_exception_writer.cc b/minidump/minidump_exception_writer.cc index f11b86f..cd471b9 100644 --- a/minidump/minidump_exception_writer.cc +++ b/minidump/minidump_exception_writer.cc @@ -16,12 +16,13 @@ #include +#include + #include "base/logging.h" #include "base/numerics/safe_conversions.h" #include "minidump/minidump_context_writer.h" #include "snapshot/exception_snapshot.h" #include "util/file/file_writer.h" -#include "util/stdlib/move.h" namespace crashpad { @@ -49,14 +50,14 @@ void MinidumpExceptionWriter::InitializeFromSnapshot( scoped_ptr context = MinidumpContextWriter::CreateFromSnapshot(exception_snapshot->Context()); - SetContext(crashpad::move(context)); + SetContext(std::move(context)); } void MinidumpExceptionWriter::SetContext( scoped_ptr context) { DCHECK_EQ(state(), kStateMutable); - context_ = crashpad::move(context); + context_ = std::move(context); } void MinidumpExceptionWriter::SetExceptionInformation( diff --git a/minidump/minidump_exception_writer_test.cc b/minidump/minidump_exception_writer_test.cc index 4c6e267..bc3bfec 100644 --- a/minidump/minidump_exception_writer_test.cc +++ b/minidump/minidump_exception_writer_test.cc @@ -20,6 +20,7 @@ #include #include +#include #include #include "gtest/gtest.h" @@ -35,7 +36,6 @@ #include "snapshot/test/test_exception_snapshot.h" #include "test/gtest_death_check.h" #include "util/file/string_file.h" -#include "util/stdlib/move.h" namespace crashpad { namespace test { @@ -105,9 +105,9 @@ TEST(MinidumpExceptionWriter, Minimal) { auto context_x86_writer = make_scoped_ptr(new MinidumpContextX86Writer()); InitializeMinidumpContextX86(context_x86_writer->context(), kSeed); - exception_writer->SetContext(crashpad::move(context_x86_writer)); + exception_writer->SetContext(std::move(context_x86_writer)); - minidump_file_writer.AddStream(crashpad::move(exception_writer)); + minidump_file_writer.AddStream(std::move(exception_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -145,7 +145,7 @@ TEST(MinidumpExceptionWriter, Standard) { auto context_x86_writer = make_scoped_ptr(new MinidumpContextX86Writer()); InitializeMinidumpContextX86(context_x86_writer->context(), kSeed); - exception_writer->SetContext(crashpad::move(context_x86_writer)); + exception_writer->SetContext(std::move(context_x86_writer)); exception_writer->SetThreadID(kThreadID); exception_writer->SetExceptionCode(kExceptionCode); @@ -166,7 +166,7 @@ TEST(MinidumpExceptionWriter, Standard) { exception_information.push_back(kExceptionInformation2); exception_writer->SetExceptionInformation(exception_information); - minidump_file_writer.AddStream(crashpad::move(exception_writer)); + minidump_file_writer.AddStream(std::move(exception_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -239,7 +239,7 @@ TEST(MinidumpExceptionWriter, InitializeFromSnapshot) { exception_writer->InitializeFromSnapshot(&exception_snapshot, thread_id_map); MinidumpFileWriter minidump_file_writer; - minidump_file_writer.AddStream(crashpad::move(exception_writer)); + minidump_file_writer.AddStream(std::move(exception_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -261,7 +261,7 @@ TEST(MinidumpExceptionWriterDeathTest, NoContext) { MinidumpFileWriter minidump_file_writer; auto exception_writer = make_scoped_ptr(new MinidumpExceptionWriter()); - minidump_file_writer.AddStream(crashpad::move(exception_writer)); + minidump_file_writer.AddStream(std::move(exception_writer)); StringFile string_file; ASSERT_DEATH_CHECK(minidump_file_writer.WriteEverything(&string_file), diff --git a/minidump/minidump_file_writer.cc b/minidump/minidump_file_writer.cc index be2b1cd..b9a9eea 100644 --- a/minidump/minidump_file_writer.cc +++ b/minidump/minidump_file_writer.cc @@ -14,6 +14,8 @@ #include "minidump/minidump_file_writer.h" +#include + #include "base/logging.h" #include "minidump/minidump_crashpad_info_writer.h" #include "minidump/minidump_exception_writer.h" @@ -28,7 +30,6 @@ #include "minidump/minidump_writer_util.h" #include "snapshot/process_snapshot.h" #include "util/file/file_writer.h" -#include "util/stdlib/move.h" #include "util/numeric/safe_assignment.h" namespace crashpad { @@ -68,11 +69,11 @@ void MinidumpFileWriter::InitializeFromSnapshot( const SystemSnapshot* system_snapshot = process_snapshot->System(); auto system_info = make_scoped_ptr(new MinidumpSystemInfoWriter()); system_info->InitializeFromSnapshot(system_snapshot); - AddStream(crashpad::move(system_info)); + AddStream(std::move(system_info)); auto misc_info = make_scoped_ptr(new MinidumpMiscInfoWriter()); misc_info->InitializeFromSnapshot(process_snapshot); - AddStream(crashpad::move(misc_info)); + AddStream(std::move(misc_info)); auto memory_list = make_scoped_ptr(new MinidumpMemoryListWriter()); auto thread_list = make_scoped_ptr(new MinidumpThreadListWriter()); @@ -80,18 +81,18 @@ void MinidumpFileWriter::InitializeFromSnapshot( MinidumpThreadIDMap thread_id_map; thread_list->InitializeFromSnapshot(process_snapshot->Threads(), &thread_id_map); - AddStream(crashpad::move(thread_list)); + AddStream(std::move(thread_list)); const ExceptionSnapshot* exception_snapshot = process_snapshot->Exception(); if (exception_snapshot) { auto exception = make_scoped_ptr(new MinidumpExceptionWriter()); exception->InitializeFromSnapshot(exception_snapshot, thread_id_map); - AddStream(crashpad::move(exception)); + AddStream(std::move(exception)); } auto module_list = make_scoped_ptr(new MinidumpModuleListWriter()); module_list->InitializeFromSnapshot(process_snapshot->Modules()); - AddStream(crashpad::move(module_list)); + AddStream(std::move(module_list)); auto crashpad_info = make_scoped_ptr(new MinidumpCrashpadInfoWriter()); crashpad_info->InitializeFromSnapshot(process_snapshot); @@ -99,7 +100,7 @@ void MinidumpFileWriter::InitializeFromSnapshot( // Since the MinidumpCrashpadInfo stream is an extension, it’s safe to not add // it to the minidump file if it wouldn’t carry any useful information. if (crashpad_info->IsUseful()) { - AddStream(crashpad::move(crashpad_info)); + AddStream(std::move(crashpad_info)); } std::vector memory_map_snapshot = @@ -107,19 +108,19 @@ void MinidumpFileWriter::InitializeFromSnapshot( if (!memory_map_snapshot.empty()) { auto memory_info_list = make_scoped_ptr(new MinidumpMemoryInfoListWriter()); memory_info_list->InitializeFromSnapshot(memory_map_snapshot); - AddStream(crashpad::move(memory_info_list)); + AddStream(std::move(memory_info_list)); } std::vector handles_snapshot = process_snapshot->Handles(); if (!handles_snapshot.empty()) { auto handle_data_writer = make_scoped_ptr(new MinidumpHandleDataWriter()); handle_data_writer->InitializeFromSnapshot(handles_snapshot); - AddStream(crashpad::move(handle_data_writer)); + AddStream(std::move(handle_data_writer)); } memory_list->AddFromSnapshot(process_snapshot->ExtraMemory()); - AddStream(crashpad::move(memory_list)); + AddStream(std::move(memory_list)); } void MinidumpFileWriter::SetTimestamp(time_t timestamp) { diff --git a/minidump/minidump_file_writer_test.cc b/minidump/minidump_file_writer_test.cc index 2295a99..314c758 100644 --- a/minidump/minidump_file_writer_test.cc +++ b/minidump/minidump_file_writer_test.cc @@ -18,6 +18,7 @@ #include #include +#include #include "base/basictypes.h" #include "base/compiler_specific.h" @@ -35,7 +36,6 @@ #include "snapshot/test/test_thread_snapshot.h" #include "test/gtest_death_check.h" #include "util/file/string_file.h" -#include "util/stdlib/move.h" namespace crashpad { namespace test { @@ -97,7 +97,7 @@ TEST(MinidumpFileWriter, OneStream) { const uint8_t kStreamValue = 0x5a; auto stream = make_scoped_ptr(new TestStream(kStreamType, kStreamSize, kStreamValue)); - minidump_file.AddStream(crashpad::move(stream)); + minidump_file.AddStream(std::move(stream)); StringFile string_file; ASSERT_TRUE(minidump_file.WriteEverything(&string_file)); @@ -136,7 +136,7 @@ TEST(MinidumpFileWriter, ThreeStreams) { const uint8_t kStream0Value = 0x5a; auto stream0 = make_scoped_ptr( new TestStream(kStream0Type, kStream0Size, kStream0Value)); - minidump_file.AddStream(crashpad::move(stream0)); + minidump_file.AddStream(std::move(stream0)); // Make the second stream’s type be a smaller quantity than the first stream’s // to test that the streams show up in the order that they were added, not in @@ -146,14 +146,14 @@ TEST(MinidumpFileWriter, ThreeStreams) { const uint8_t kStream1Value = 0xa5; auto stream1 = make_scoped_ptr( new TestStream(kStream1Type, kStream1Size, kStream1Value)); - minidump_file.AddStream(crashpad::move(stream1)); + minidump_file.AddStream(std::move(stream1)); const size_t kStream2Size = 1; const MinidumpStreamType kStream2Type = static_cast(0x7e); const uint8_t kStream2Value = 0x36; auto stream2 = make_scoped_ptr( new TestStream(kStream2Type, kStream2Size, kStream2Value)); - minidump_file.AddStream(crashpad::move(stream2)); + minidump_file.AddStream(std::move(stream2)); StringFile string_file; ASSERT_TRUE(minidump_file.WriteEverything(&string_file)); @@ -220,7 +220,7 @@ TEST(MinidumpFileWriter, ZeroLengthStream) { const size_t kStreamSize = 0; const MinidumpStreamType kStreamType = static_cast(0x4d); auto stream = make_scoped_ptr(new TestStream(kStreamType, kStreamSize, 0)); - minidump_file.AddStream(crashpad::move(stream)); + minidump_file.AddStream(std::move(stream)); StringFile string_file; ASSERT_TRUE(minidump_file.WriteEverything(&string_file)); @@ -252,7 +252,7 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_Basic) { auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot()); system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64); system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX); - process_snapshot.SetSystem(crashpad::move(system_snapshot)); + process_snapshot.SetSystem(std::move(system_snapshot)); auto peb_snapshot = make_scoped_ptr(new TestMemorySnapshot()); const uint64_t kPebAddress = 0x07f90000; @@ -260,7 +260,7 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_Basic) { const size_t kPebSize = 0x280; peb_snapshot->SetSize(kPebSize); peb_snapshot->SetValue('p'); - process_snapshot.AddExtraMemory(crashpad::move(peb_snapshot)); + process_snapshot.AddExtraMemory(std::move(peb_snapshot)); MinidumpFileWriter minidump_file_writer; minidump_file_writer.InitializeFromSnapshot(&process_snapshot); @@ -316,22 +316,22 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_Exception) { auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot()); system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64); system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX); - process_snapshot.SetSystem(crashpad::move(system_snapshot)); + process_snapshot.SetSystem(std::move(system_snapshot)); auto thread_snapshot = make_scoped_ptr(new TestThreadSnapshot()); InitializeCPUContextX86_64(thread_snapshot->MutableContext(), 5); - process_snapshot.AddThread(crashpad::move(thread_snapshot)); + process_snapshot.AddThread(std::move(thread_snapshot)); auto exception_snapshot = make_scoped_ptr(new TestExceptionSnapshot()); InitializeCPUContextX86_64(exception_snapshot->MutableContext(), 11); - process_snapshot.SetException(crashpad::move(exception_snapshot)); + process_snapshot.SetException(std::move(exception_snapshot)); // The module does not have anything that needs to be represented in a // MinidumpModuleCrashpadInfo structure, so no such structure is expected to // be present, which will in turn suppress the addition of a // MinidumpCrashpadInfo stream. auto module_snapshot = make_scoped_ptr(new TestModuleSnapshot()); - process_snapshot.AddModule(crashpad::move(module_snapshot)); + process_snapshot.AddModule(std::move(module_snapshot)); MinidumpFileWriter minidump_file_writer; minidump_file_writer.InitializeFromSnapshot(&process_snapshot); @@ -380,22 +380,22 @@ TEST(MinidumpFileWriter, InitializeFromSnapshot_CrashpadInfo) { auto system_snapshot = make_scoped_ptr(new TestSystemSnapshot()); system_snapshot->SetCPUArchitecture(kCPUArchitectureX86_64); system_snapshot->SetOperatingSystem(SystemSnapshot::kOperatingSystemMacOSX); - process_snapshot.SetSystem(crashpad::move(system_snapshot)); + process_snapshot.SetSystem(std::move(system_snapshot)); auto thread_snapshot = make_scoped_ptr(new TestThreadSnapshot()); InitializeCPUContextX86_64(thread_snapshot->MutableContext(), 5); - process_snapshot.AddThread(crashpad::move(thread_snapshot)); + process_snapshot.AddThread(std::move(thread_snapshot)); auto exception_snapshot = make_scoped_ptr(new TestExceptionSnapshot()); InitializeCPUContextX86_64(exception_snapshot->MutableContext(), 11); - process_snapshot.SetException(crashpad::move(exception_snapshot)); + process_snapshot.SetException(std::move(exception_snapshot)); // The module needs an annotation for the MinidumpCrashpadInfo stream to be // considered useful and be included. auto module_snapshot = make_scoped_ptr(new TestModuleSnapshot()); std::vector annotations_list(1, std::string("annotation")); module_snapshot->SetAnnotationsVector(annotations_list); - process_snapshot.AddModule(crashpad::move(module_snapshot)); + process_snapshot.AddModule(std::move(module_snapshot)); MinidumpFileWriter minidump_file_writer; minidump_file_writer.InitializeFromSnapshot(&process_snapshot); @@ -446,7 +446,7 @@ TEST(MinidumpFileWriterDeathTest, SameStreamType) { const uint8_t kStream0Value = 0x5a; auto stream0 = make_scoped_ptr( new TestStream(kStream0Type, kStream0Size, kStream0Value)); - minidump_file.AddStream(crashpad::move(stream0)); + minidump_file.AddStream(std::move(stream0)); // It is an error to add a second stream of the same type. const size_t kStream1Size = 3; @@ -454,7 +454,7 @@ TEST(MinidumpFileWriterDeathTest, SameStreamType) { const uint8_t kStream1Value = 0xa5; auto stream1 = make_scoped_ptr( new TestStream(kStream1Type, kStream1Size, kStream1Value)); - ASSERT_DEATH_CHECK(minidump_file.AddStream(crashpad::move(stream1)), + ASSERT_DEATH_CHECK(minidump_file.AddStream(std::move(stream1)), "already present"); } diff --git a/minidump/minidump_handle_writer_test.cc b/minidump/minidump_handle_writer_test.cc index 049a095..2a5445d 100644 --- a/minidump/minidump_handle_writer_test.cc +++ b/minidump/minidump_handle_writer_test.cc @@ -15,6 +15,7 @@ #include "minidump/minidump_handle_writer.h" #include +#include #include "base/strings/utf_string_conversions.h" #include "gtest/gtest.h" @@ -23,7 +24,6 @@ #include "minidump/test/minidump_string_writer_test_util.h" #include "minidump/test/minidump_writable_test_util.h" #include "util/file/string_file.h" -#include "util/stdlib/move.h" namespace crashpad { namespace test { @@ -58,7 +58,7 @@ void GetHandleDataStream( TEST(MinidumpHandleDataWriter, Empty) { MinidumpFileWriter minidump_file_writer; auto handle_data_writer = make_scoped_ptr(new MinidumpHandleDataWriter()); - minidump_file_writer.AddStream(crashpad::move(handle_data_writer)); + minidump_file_writer.AddStream(std::move(handle_data_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -91,7 +91,7 @@ TEST(MinidumpHandleDataWriter, OneHandle) { handle_data_writer->InitializeFromSnapshot(snapshot); - minidump_file_writer.AddStream(crashpad::move(handle_data_writer)); + minidump_file_writer.AddStream(std::move(handle_data_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -149,7 +149,7 @@ TEST(MinidumpHandleDataWriter, RepeatedTypeName) { handle_data_writer->InitializeFromSnapshot(snapshot); - minidump_file_writer.AddStream(crashpad::move(handle_data_writer)); + minidump_file_writer.AddStream(std::move(handle_data_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); diff --git a/minidump/minidump_memory_info_writer_test.cc b/minidump/minidump_memory_info_writer_test.cc index a1073f8..f59cbb8 100644 --- a/minidump/minidump_memory_info_writer_test.cc +++ b/minidump/minidump_memory_info_writer_test.cc @@ -15,6 +15,7 @@ #include "minidump/minidump_memory_info_writer.h" #include +#include #include "gtest/gtest.h" #include "minidump/minidump_file_writer.h" @@ -22,7 +23,6 @@ #include "minidump/test/minidump_writable_test_util.h" #include "snapshot/test/test_memory_map_region_snapshot.h" #include "util/file/string_file.h" -#include "util/stdlib/move.h" namespace crashpad { namespace test { @@ -59,7 +59,7 @@ TEST(MinidumpMemoryInfoWriter, Empty) { MinidumpFileWriter minidump_file_writer; auto memory_info_list_writer = make_scoped_ptr(new MinidumpMemoryInfoListWriter()); - minidump_file_writer.AddStream(crashpad::move(memory_info_list_writer)); + minidump_file_writer.AddStream(std::move(memory_info_list_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -96,7 +96,7 @@ TEST(MinidumpMemoryInfoWriter, OneRegion) { memory_map.push_back(memory_map_region.get()); memory_info_list_writer->InitializeFromSnapshot(memory_map); - minidump_file_writer.AddStream(crashpad::move(memory_info_list_writer)); + minidump_file_writer.AddStream(std::move(memory_info_list_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); diff --git a/minidump/minidump_memory_writer.cc b/minidump/minidump_memory_writer.cc index 1c9b285..3528655 100644 --- a/minidump/minidump_memory_writer.cc +++ b/minidump/minidump_memory_writer.cc @@ -14,11 +14,12 @@ #include "minidump/minidump_memory_writer.h" +#include + #include "base/auto_reset.h" #include "base/logging.h" #include "snapshot/memory_snapshot.h" #include "util/file/file_writer.h" -#include "util/stdlib/move.h" #include "util/numeric/safe_assignment.h" namespace crashpad { @@ -178,7 +179,7 @@ void MinidumpMemoryListWriter::AddFromSnapshot( for (const MemorySnapshot* memory_snapshot : memory_snapshots) { scoped_ptr memory = MinidumpMemoryWriter::CreateFromSnapshot(memory_snapshot); - AddMemory(crashpad::move(memory)); + AddMemory(std::move(memory)); } } diff --git a/minidump/minidump_memory_writer_test.cc b/minidump/minidump_memory_writer_test.cc index 38d3cb2..cefe747 100644 --- a/minidump/minidump_memory_writer_test.cc +++ b/minidump/minidump_memory_writer_test.cc @@ -18,6 +18,8 @@ #include #include +#include + #include "base/basictypes.h" #include "base/format_macros.h" #include "base/strings/stringprintf.h" @@ -30,7 +32,6 @@ #include "minidump/test/minidump_writable_test_util.h" #include "snapshot/test/test_memory_snapshot.h" #include "util/file/string_file.h" -#include "util/stdlib/move.h" #include "util/stdlib/pointer_container.h" namespace crashpad { @@ -81,7 +82,7 @@ TEST(MinidumpMemoryWriter, EmptyMemoryList) { MinidumpFileWriter minidump_file_writer; auto memory_list_writer = make_scoped_ptr(new MinidumpMemoryListWriter()); - minidump_file_writer.AddStream(crashpad::move(memory_list_writer)); + minidump_file_writer.AddStream(std::move(memory_list_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -107,9 +108,9 @@ TEST(MinidumpMemoryWriter, OneMemoryRegion) { auto memory_writer = make_scoped_ptr( new TestMinidumpMemoryWriter(kBaseAddress, kSize, kValue)); - memory_list_writer->AddMemory(crashpad::move(memory_writer)); + memory_list_writer->AddMemory(std::move(memory_writer)); - minidump_file_writer.AddStream(crashpad::move(memory_list_writer)); + minidump_file_writer.AddStream(std::move(memory_list_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -145,12 +146,12 @@ TEST(MinidumpMemoryWriter, TwoMemoryRegions) { auto memory_writer_0 = make_scoped_ptr( new TestMinidumpMemoryWriter(kBaseAddress0, kSize0, kValue0)); - memory_list_writer->AddMemory(crashpad::move(memory_writer_0)); + memory_list_writer->AddMemory(std::move(memory_writer_0)); auto memory_writer_1 = make_scoped_ptr( new TestMinidumpMemoryWriter(kBaseAddress1, kSize1, kValue1)); - memory_list_writer->AddMemory(crashpad::move(memory_writer_1)); + memory_list_writer->AddMemory(std::move(memory_writer_1)); - minidump_file_writer.AddStream(crashpad::move(memory_list_writer)); + minidump_file_writer.AddStream(std::move(memory_list_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -249,7 +250,7 @@ TEST(MinidumpMemoryWriter, ExtraMemory) { auto memory_list_writer = make_scoped_ptr(new MinidumpMemoryListWriter()); memory_list_writer->AddExtraMemory(test_memory_stream->memory()); - minidump_file_writer.AddStream(crashpad::move(test_memory_stream)); + minidump_file_writer.AddStream(std::move(test_memory_stream)); const uint64_t kBaseAddress1 = 0x2000; const size_t kSize1 = 0x0400; @@ -257,9 +258,9 @@ TEST(MinidumpMemoryWriter, ExtraMemory) { auto memory_writer = make_scoped_ptr( new TestMinidumpMemoryWriter(kBaseAddress1, kSize1, kValue1)); - memory_list_writer->AddMemory(crashpad::move(memory_writer)); + memory_list_writer->AddMemory(std::move(memory_writer)); - minidump_file_writer.AddStream(crashpad::move(memory_list_writer)); + minidump_file_writer.AddStream(std::move(memory_list_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -337,7 +338,7 @@ TEST(MinidumpMemoryWriter, AddFromSnapshot) { memory_list_writer->AddFromSnapshot(memory_snapshots); MinidumpFileWriter minidump_file_writer; - minidump_file_writer.AddStream(crashpad::move(memory_list_writer)); + minidump_file_writer.AddStream(std::move(memory_list_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); diff --git a/minidump/minidump_misc_info_writer_test.cc b/minidump/minidump_misc_info_writer_test.cc index 64825ad..de8cde3 100644 --- a/minidump/minidump_misc_info_writer_test.cc +++ b/minidump/minidump_misc_info_writer_test.cc @@ -19,6 +19,7 @@ #include #include +#include #include "base/basictypes.h" #include "base/compiler_specific.h" @@ -32,7 +33,6 @@ #include "snapshot/test/test_process_snapshot.h" #include "snapshot/test/test_system_snapshot.h" #include "util/file/string_file.h" -#include "util/stdlib/move.h" #include "util/stdlib/strlcpy.h" namespace crashpad { @@ -169,7 +169,7 @@ TEST(MinidumpMiscInfoWriter, Empty) { MinidumpFileWriter minidump_file_writer; auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter()); - minidump_file_writer.AddStream(crashpad::move(misc_info_writer)); + minidump_file_writer.AddStream(std::move(misc_info_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -190,7 +190,7 @@ TEST(MinidumpMiscInfoWriter, ProcessId) { misc_info_writer->SetProcessID(kProcessId); - minidump_file_writer.AddStream(crashpad::move(misc_info_writer)); + minidump_file_writer.AddStream(std::move(misc_info_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -216,7 +216,7 @@ TEST(MinidumpMiscInfoWriter, ProcessTimes) { misc_info_writer->SetProcessTimes( kProcessCreateTime, kProcessUserTime, kProcessKernelTime); - minidump_file_writer.AddStream(crashpad::move(misc_info_writer)); + minidump_file_writer.AddStream(std::move(misc_info_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -249,7 +249,7 @@ TEST(MinidumpMiscInfoWriter, ProcessorPowerInfo) { kProcessorMaxIdleState, kProcessorCurrentIdleState); - minidump_file_writer.AddStream(crashpad::move(misc_info_writer)); + minidump_file_writer.AddStream(std::move(misc_info_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -276,7 +276,7 @@ TEST(MinidumpMiscInfoWriter, ProcessIntegrityLevel) { misc_info_writer->SetProcessIntegrityLevel(kProcessIntegrityLevel); - minidump_file_writer.AddStream(crashpad::move(misc_info_writer)); + minidump_file_writer.AddStream(std::move(misc_info_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -299,7 +299,7 @@ TEST(MinidumpMiscInfoWriter, ProcessExecuteFlags) { misc_info_writer->SetProcessExecuteFlags(kProcessExecuteFlags); - minidump_file_writer.AddStream(crashpad::move(misc_info_writer)); + minidump_file_writer.AddStream(std::move(misc_info_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -322,7 +322,7 @@ TEST(MinidumpMiscInfoWriter, ProtectedProcess) { misc_info_writer->SetProtectedProcess(kProtectedProcess); - minidump_file_writer.AddStream(crashpad::move(misc_info_writer)); + minidump_file_writer.AddStream(std::move(misc_info_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -359,7 +359,7 @@ TEST(MinidumpMiscInfoWriter, TimeZone) { kDaylightDate, kDaylightBias); - minidump_file_writer.AddStream(crashpad::move(misc_info_writer)); + minidump_file_writer.AddStream(std::move(misc_info_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -420,7 +420,7 @@ TEST(MinidumpMiscInfoWriter, TimeZoneStringsOverflow) { kSystemTimeZero, kDaylightBias); - minidump_file_writer.AddStream(crashpad::move(misc_info_writer)); + minidump_file_writer.AddStream(std::move(misc_info_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -461,7 +461,7 @@ TEST(MinidumpMiscInfoWriter, BuildStrings) { misc_info_writer->SetBuildString(kBuildString, kDebugBuildString); - minidump_file_writer.AddStream(crashpad::move(misc_info_writer)); + minidump_file_writer.AddStream(std::move(misc_info_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -498,7 +498,7 @@ TEST(MinidumpMiscInfoWriter, BuildStringsOverflow) { misc_info_writer->SetBuildString(build_string, debug_build_string); - minidump_file_writer.AddStream(crashpad::move(misc_info_writer)); + minidump_file_writer.AddStream(std::move(misc_info_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -568,7 +568,7 @@ TEST(MinidumpMiscInfoWriter, Everything) { kDaylightBias); misc_info_writer->SetBuildString(kBuildString, kDebugBuildString); - minidump_file_writer.AddStream(crashpad::move(misc_info_writer)); + minidump_file_writer.AddStream(std::move(misc_info_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -702,13 +702,13 @@ TEST(MinidumpMiscInfoWriter, InitializeFromSnapshot) { system_snapshot->SetOSVersionFull(kOSVersionFull); system_snapshot->SetMachineDescription(kMachineDescription); - process_snapshot.SetSystem(crashpad::move(system_snapshot)); + process_snapshot.SetSystem(std::move(system_snapshot)); auto misc_info_writer = make_scoped_ptr(new MinidumpMiscInfoWriter()); misc_info_writer->InitializeFromSnapshot(&process_snapshot); MinidumpFileWriter minidump_file_writer; - minidump_file_writer.AddStream(crashpad::move(misc_info_writer)); + minidump_file_writer.AddStream(std::move(misc_info_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); diff --git a/minidump/minidump_module_crashpad_info_writer.cc b/minidump/minidump_module_crashpad_info_writer.cc index 5b71ec2..c4a09c3 100644 --- a/minidump/minidump_module_crashpad_info_writer.cc +++ b/minidump/minidump_module_crashpad_info_writer.cc @@ -16,11 +16,12 @@ #include +#include + #include "base/logging.h" #include "minidump/minidump_simple_string_dictionary_writer.h" #include "snapshot/module_snapshot.h" #include "util/file/file_writer.h" -#include "util/stdlib/move.h" #include "util/numeric/safe_assignment.h" namespace crashpad { @@ -45,7 +46,7 @@ void MinidumpModuleCrashpadInfoWriter::InitializeFromSnapshot( auto list_annotations = make_scoped_ptr(new MinidumpUTF8StringListWriter()); list_annotations->InitializeFromVector(module_snapshot->AnnotationsVector()); if (list_annotations->IsUseful()) { - SetListAnnotations(crashpad::move(list_annotations)); + SetListAnnotations(std::move(list_annotations)); } auto simple_annotations = @@ -53,7 +54,7 @@ void MinidumpModuleCrashpadInfoWriter::InitializeFromSnapshot( simple_annotations->InitializeFromMap( module_snapshot->AnnotationsSimpleMap()); if (simple_annotations->IsUseful()) { - SetSimpleAnnotations(crashpad::move(simple_annotations)); + SetSimpleAnnotations(std::move(simple_annotations)); } } @@ -61,14 +62,14 @@ void MinidumpModuleCrashpadInfoWriter::SetListAnnotations( scoped_ptr list_annotations) { DCHECK_EQ(state(), kStateMutable); - list_annotations_ = crashpad::move(list_annotations); + list_annotations_ = std::move(list_annotations); } void MinidumpModuleCrashpadInfoWriter::SetSimpleAnnotations( scoped_ptr simple_annotations) { DCHECK_EQ(state(), kStateMutable); - simple_annotations_ = crashpad::move(simple_annotations); + simple_annotations_ = std::move(simple_annotations); } bool MinidumpModuleCrashpadInfoWriter::IsUseful() const { @@ -145,7 +146,7 @@ void MinidumpModuleCrashpadInfoListWriter::InitializeFromSnapshot( auto module = make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter()); module->InitializeFromSnapshot(module_snapshot); if (module->IsUseful()) { - AddModule(crashpad::move(module), index); + AddModule(std::move(module), index); } } } diff --git a/minidump/minidump_module_crashpad_info_writer_test.cc b/minidump/minidump_module_crashpad_info_writer_test.cc index 79ed266..07f44c1 100644 --- a/minidump/minidump_module_crashpad_info_writer_test.cc +++ b/minidump/minidump_module_crashpad_info_writer_test.cc @@ -17,6 +17,8 @@ #include #include +#include + #include "gtest/gtest.h" #include "minidump/minidump_extensions.h" #include "minidump/minidump_simple_string_dictionary_writer.h" @@ -25,7 +27,6 @@ #include "minidump/test/minidump_writable_test_util.h" #include "snapshot/test/test_module_snapshot.h" #include "util/file/string_file.h" -#include "util/stdlib/move.h" namespace crashpad { namespace test { @@ -78,7 +79,7 @@ TEST(MinidumpModuleCrashpadInfoWriter, EmptyModule) { make_scoped_ptr(new MinidumpModuleCrashpadInfoListWriter()); auto module_writer = make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter()); EXPECT_FALSE(module_writer->IsUseful()); - module_list_writer->AddModule(crashpad::move(module_writer), 0); + module_list_writer->AddModule(std::move(module_writer), 0); EXPECT_TRUE(module_list_writer->IsUseful()); @@ -120,18 +121,18 @@ TEST(MinidumpModuleCrashpadInfoWriter, FullModule) { auto module_writer = make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter()); auto string_list_writer = make_scoped_ptr(new MinidumpUTF8StringListWriter()); string_list_writer->InitializeFromVector(vector); - module_writer->SetListAnnotations(crashpad::move(string_list_writer)); + module_writer->SetListAnnotations(std::move(string_list_writer)); auto simple_string_dictionary_writer = make_scoped_ptr(new MinidumpSimpleStringDictionaryWriter()); auto simple_string_dictionary_entry_writer = make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter()); simple_string_dictionary_entry_writer->SetKeyValue(kKey, kValue); simple_string_dictionary_writer->AddEntry( - crashpad::move(simple_string_dictionary_entry_writer)); + std::move(simple_string_dictionary_entry_writer)); module_writer->SetSimpleAnnotations( - crashpad::move(simple_string_dictionary_writer)); + std::move(simple_string_dictionary_writer)); EXPECT_TRUE(module_writer->IsUseful()); - module_list_writer->AddModule(crashpad::move(module_writer), + module_list_writer->AddModule(std::move(module_writer), kMinidumpModuleListIndex); EXPECT_TRUE(module_list_writer->IsUseful()); @@ -214,17 +215,17 @@ TEST(MinidumpModuleCrashpadInfoWriter, ThreeModules) { make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter()); simple_string_dictionary_entry_writer_0->SetKeyValue(kKey0, kValue0); simple_string_dictionary_writer_0->AddEntry( - crashpad::move(simple_string_dictionary_entry_writer_0)); + std::move(simple_string_dictionary_entry_writer_0)); module_writer_0->SetSimpleAnnotations( - crashpad::move(simple_string_dictionary_writer_0)); + std::move(simple_string_dictionary_writer_0)); EXPECT_TRUE(module_writer_0->IsUseful()); - module_list_writer->AddModule(crashpad::move(module_writer_0), + module_list_writer->AddModule(std::move(module_writer_0), kMinidumpModuleListIndex0); auto module_writer_1 = make_scoped_ptr(new MinidumpModuleCrashpadInfoWriter()); EXPECT_FALSE(module_writer_1->IsUseful()); - module_list_writer->AddModule(crashpad::move(module_writer_1), + module_list_writer->AddModule(std::move(module_writer_1), kMinidumpModuleListIndex1); auto module_writer_2 = @@ -235,16 +236,16 @@ TEST(MinidumpModuleCrashpadInfoWriter, ThreeModules) { make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter()); simple_string_dictionary_entry_writer_2a->SetKeyValue(kKey2A, kValue2A); simple_string_dictionary_writer_2->AddEntry( - crashpad::move(simple_string_dictionary_entry_writer_2a)); + std::move(simple_string_dictionary_entry_writer_2a)); auto simple_string_dictionary_entry_writer_2b = make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter()); simple_string_dictionary_entry_writer_2b->SetKeyValue(kKey2B, kValue2B); simple_string_dictionary_writer_2->AddEntry( - crashpad::move(simple_string_dictionary_entry_writer_2b)); + std::move(simple_string_dictionary_entry_writer_2b)); module_writer_2->SetSimpleAnnotations( - crashpad::move(simple_string_dictionary_writer_2)); + std::move(simple_string_dictionary_writer_2)); EXPECT_TRUE(module_writer_2->IsUseful()); - module_list_writer->AddModule(crashpad::move(module_writer_2), + module_list_writer->AddModule(std::move(module_writer_2), kMinidumpModuleListIndex2); EXPECT_TRUE(module_list_writer->IsUseful()); diff --git a/minidump/minidump_module_writer.cc b/minidump/minidump_module_writer.cc index 8cbf855..c3a0e83 100644 --- a/minidump/minidump_module_writer.cc +++ b/minidump/minidump_module_writer.cc @@ -17,6 +17,7 @@ #include #include +#include #include "base/logging.h" #include "base/numerics/safe_conversions.h" @@ -25,7 +26,6 @@ #include "snapshot/module_snapshot.h" #include "util/file/file_writer.h" #include "util/misc/implicit_cast.h" -#include "util/stdlib/move.h" #include "util/numeric/in_range_cast.h" #include "util/numeric/safe_assignment.h" @@ -245,7 +245,7 @@ void MinidumpModuleWriter::InitializeFromSnapshot( auto codeview_record = make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB70Writer()); codeview_record->InitializeFromSnapshot(module_snapshot); - SetCodeViewRecord(crashpad::move(codeview_record)); + SetCodeViewRecord(std::move(codeview_record)); } const MINIDUMP_MODULE* MinidumpModuleWriter::MinidumpModule() const { @@ -267,14 +267,14 @@ void MinidumpModuleWriter::SetCodeViewRecord( scoped_ptr codeview_record) { DCHECK_EQ(state(), kStateMutable); - codeview_record_ = crashpad::move(codeview_record); + codeview_record_ = std::move(codeview_record); } void MinidumpModuleWriter::SetMiscDebugRecord( scoped_ptr misc_debug_record) { DCHECK_EQ(state(), kStateMutable); - misc_debug_record_ = crashpad::move(misc_debug_record); + misc_debug_record_ = std::move(misc_debug_record); } void MinidumpModuleWriter::SetTimestamp(time_t timestamp) { @@ -386,7 +386,7 @@ void MinidumpModuleListWriter::InitializeFromSnapshot( for (const ModuleSnapshot* module_snapshot : module_snapshots) { auto module = make_scoped_ptr(new MinidumpModuleWriter()); module->InitializeFromSnapshot(module_snapshot); - AddModule(crashpad::move(module)); + AddModule(std::move(module)); } } diff --git a/minidump/minidump_module_writer_test.cc b/minidump/minidump_module_writer_test.cc index 9919b0c..8d6272d 100644 --- a/minidump/minidump_module_writer_test.cc +++ b/minidump/minidump_module_writer_test.cc @@ -20,6 +20,8 @@ #include #include +#include + #include "base/format_macros.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" @@ -33,7 +35,6 @@ #include "test/gtest_death_check.h" #include "util/file/string_file.h" #include "util/misc/implicit_cast.h" -#include "util/stdlib/move.h" #include "util/misc/uuid.h" #include "util/stdlib/pointer_container.h" @@ -69,7 +70,7 @@ TEST(MinidumpModuleWriter, EmptyModuleList) { MinidumpFileWriter minidump_file_writer; auto module_list_writer = make_scoped_ptr(new MinidumpModuleListWriter()); - minidump_file_writer.AddStream(crashpad::move(module_list_writer)); + minidump_file_writer.AddStream(std::move(module_list_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -277,8 +278,8 @@ TEST(MinidumpModuleWriter, EmptyModule) { auto module_writer = make_scoped_ptr(new MinidumpModuleWriter()); module_writer->SetName(kModuleName); - module_list_writer->AddModule(crashpad::move(module_writer)); - minidump_file_writer.AddStream(crashpad::move(module_list_writer)); + module_list_writer->AddModule(std::move(module_writer)); + minidump_file_writer.AddStream(std::move(module_list_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -360,16 +361,16 @@ TEST(MinidumpModuleWriter, OneModule) { make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB70Writer()); codeview_pdb70_writer->SetPDBName(kPDBName); codeview_pdb70_writer->SetUUIDAndAge(pdb_uuid, kPDBAge); - module_writer->SetCodeViewRecord(crashpad::move(codeview_pdb70_writer)); + module_writer->SetCodeViewRecord(std::move(codeview_pdb70_writer)); auto misc_debug_writer = make_scoped_ptr(new MinidumpModuleMiscDebugRecordWriter()); misc_debug_writer->SetDataType(kDebugType); misc_debug_writer->SetData(kDebugName, kDebugUTF16); - module_writer->SetMiscDebugRecord(crashpad::move(misc_debug_writer)); + module_writer->SetMiscDebugRecord(std::move(misc_debug_writer)); - module_list_writer->AddModule(crashpad::move(module_writer)); - minidump_file_writer.AddStream(crashpad::move(module_list_writer)); + module_list_writer->AddModule(std::move(module_writer)); + minidump_file_writer.AddStream(std::move(module_list_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -435,16 +436,16 @@ TEST(MinidumpModuleWriter, OneModule_CodeViewUsesPDB20_MiscUsesUTF16) { make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB20Writer()); codeview_pdb20_writer->SetPDBName(kPDBName); codeview_pdb20_writer->SetTimestampAndAge(kPDBTimestamp, kPDBAge); - module_writer->SetCodeViewRecord(crashpad::move(codeview_pdb20_writer)); + module_writer->SetCodeViewRecord(std::move(codeview_pdb20_writer)); auto misc_debug_writer = make_scoped_ptr(new MinidumpModuleMiscDebugRecordWriter()); misc_debug_writer->SetDataType(kDebugType); misc_debug_writer->SetData(kDebugName, kDebugUTF16); - module_writer->SetMiscDebugRecord(crashpad::move(misc_debug_writer)); + module_writer->SetMiscDebugRecord(std::move(misc_debug_writer)); - module_list_writer->AddModule(crashpad::move(module_writer)); - minidump_file_writer.AddStream(crashpad::move(module_list_writer)); + module_list_writer->AddModule(std::move(module_writer)); + minidump_file_writer.AddStream(std::move(module_list_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -512,16 +513,16 @@ TEST(MinidumpModuleWriter, ThreeModules) { make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB70Writer()); codeview_pdb70_writer_0->SetPDBName(kPDBName0); codeview_pdb70_writer_0->SetUUIDAndAge(pdb_uuid_0, kPDBAge0); - module_writer_0->SetCodeViewRecord(crashpad::move(codeview_pdb70_writer_0)); + module_writer_0->SetCodeViewRecord(std::move(codeview_pdb70_writer_0)); - module_list_writer->AddModule(crashpad::move(module_writer_0)); + module_list_writer->AddModule(std::move(module_writer_0)); auto module_writer_1 = make_scoped_ptr(new MinidumpModuleWriter()); module_writer_1->SetName(kModuleName1); module_writer_1->SetImageBaseAddress(kModuleBase1); module_writer_1->SetImageSize(kModuleSize1); - module_list_writer->AddModule(crashpad::move(module_writer_1)); + module_list_writer->AddModule(std::move(module_writer_1)); auto module_writer_2 = make_scoped_ptr(new MinidumpModuleWriter()); module_writer_2->SetName(kModuleName2); @@ -532,11 +533,11 @@ TEST(MinidumpModuleWriter, ThreeModules) { make_scoped_ptr(new MinidumpModuleCodeViewRecordPDB20Writer()); codeview_pdb70_writer_2->SetPDBName(kPDBName2); codeview_pdb70_writer_2->SetTimestampAndAge(kPDBTimestamp2, kPDBAge2); - module_writer_2->SetCodeViewRecord(crashpad::move(codeview_pdb70_writer_2)); + module_writer_2->SetCodeViewRecord(std::move(codeview_pdb70_writer_2)); - module_list_writer->AddModule(crashpad::move(module_writer_2)); + module_list_writer->AddModule(std::move(module_writer_2)); - minidump_file_writer.AddStream(crashpad::move(module_list_writer)); + minidump_file_writer.AddStream(std::move(module_list_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -729,7 +730,7 @@ TEST(MinidumpModuleWriter, InitializeFromSnapshot) { module_list_writer->InitializeFromSnapshot(module_snapshots); MinidumpFileWriter minidump_file_writer; - minidump_file_writer.AddStream(crashpad::move(module_list_writer)); + minidump_file_writer.AddStream(std::move(module_list_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -760,8 +761,8 @@ TEST(MinidumpModuleWriterDeathTest, NoModuleName) { MinidumpFileWriter minidump_file_writer; auto module_list_writer = make_scoped_ptr(new MinidumpModuleListWriter()); auto module_writer = make_scoped_ptr(new MinidumpModuleWriter()); - module_list_writer->AddModule(crashpad::move(module_writer)); - minidump_file_writer.AddStream(crashpad::move(module_list_writer)); + module_list_writer->AddModule(std::move(module_writer)); + minidump_file_writer.AddStream(std::move(module_list_writer)); StringFile string_file; ASSERT_DEATH_CHECK(minidump_file_writer.WriteEverything(&string_file), diff --git a/minidump/minidump_rva_list_writer_test.cc b/minidump/minidump_rva_list_writer_test.cc index 19a908c..fa18dc5 100644 --- a/minidump/minidump_rva_list_writer_test.cc +++ b/minidump/minidump_rva_list_writer_test.cc @@ -14,13 +14,14 @@ #include "minidump/minidump_rva_list_writer.h" +#include + #include "base/format_macros.h" #include "base/strings/stringprintf.h" #include "gtest/gtest.h" #include "minidump/test/minidump_rva_list_test_util.h" #include "minidump/test/minidump_writable_test_util.h" #include "util/file/string_file.h" -#include "util/stdlib/move.h" namespace crashpad { namespace test { @@ -33,7 +34,7 @@ class TestMinidumpRVAListWriter final : public internal::MinidumpRVAListWriter { void AddChild(uint32_t value) { auto child = make_scoped_ptr(new TestUInt32MinidumpWritable(value)); - MinidumpRVAListWriter::AddChild(crashpad::move(child)); + MinidumpRVAListWriter::AddChild(std::move(child)); } private: diff --git a/minidump/minidump_simple_string_dictionary_writer.cc b/minidump/minidump_simple_string_dictionary_writer.cc index 50c1f72..b3283e5 100644 --- a/minidump/minidump_simple_string_dictionary_writer.cc +++ b/minidump/minidump_simple_string_dictionary_writer.cc @@ -14,10 +14,11 @@ #include "minidump/minidump_simple_string_dictionary_writer.h" +#include + #include "base/logging.h" #include "base/stl_util.h" #include "util/file/file_writer.h" -#include "util/stdlib/move.h" #include "util/numeric/safe_assignment.h" namespace crashpad { @@ -110,7 +111,7 @@ void MinidumpSimpleStringDictionaryWriter::InitializeFromMap( auto entry = make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter()); entry->SetKeyValue(iterator.first, iterator.second); - AddEntry(crashpad::move(entry)); + AddEntry(std::move(entry)); } } diff --git a/minidump/minidump_simple_string_dictionary_writer_test.cc b/minidump/minidump_simple_string_dictionary_writer_test.cc index a8c8d02..1e401d4 100644 --- a/minidump/minidump_simple_string_dictionary_writer_test.cc +++ b/minidump/minidump_simple_string_dictionary_writer_test.cc @@ -16,13 +16,13 @@ #include #include +#include #include "gtest/gtest.h" #include "minidump/minidump_extensions.h" #include "minidump/test/minidump_string_writer_test_util.h" #include "minidump/test/minidump_writable_test_util.h" #include "util/file/string_file.h" -#include "util/stdlib/move.h" namespace crashpad { namespace test { @@ -63,7 +63,7 @@ TEST(MinidumpSimpleStringDictionaryWriter, EmptyKeyValue) { MinidumpSimpleStringDictionaryWriter dictionary_writer; auto entry_writer = make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter()); - dictionary_writer.AddEntry(crashpad::move(entry_writer)); + dictionary_writer.AddEntry(std::move(entry_writer)); EXPECT_TRUE(dictionary_writer.IsUseful()); @@ -97,7 +97,7 @@ TEST(MinidumpSimpleStringDictionaryWriter, OneKeyValue) { auto entry_writer = make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter()); entry_writer->SetKeyValue(kKey, kValue); - dictionary_writer.AddEntry(crashpad::move(entry_writer)); + dictionary_writer.AddEntry(std::move(entry_writer)); EXPECT_TRUE(dictionary_writer.IsUseful()); @@ -135,15 +135,15 @@ TEST(MinidumpSimpleStringDictionaryWriter, ThreeKeysValues) { auto entry_writer_0 = make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter()); entry_writer_0->SetKeyValue(kKey0, kValue0); - dictionary_writer.AddEntry(crashpad::move(entry_writer_0)); + dictionary_writer.AddEntry(std::move(entry_writer_0)); auto entry_writer_1 = make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter()); entry_writer_1->SetKeyValue(kKey1, kValue1); - dictionary_writer.AddEntry(crashpad::move(entry_writer_1)); + dictionary_writer.AddEntry(std::move(entry_writer_1)); auto entry_writer_2 = make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter()); entry_writer_2->SetKeyValue(kKey2, kValue2); - dictionary_writer.AddEntry(crashpad::move(entry_writer_2)); + dictionary_writer.AddEntry(std::move(entry_writer_2)); EXPECT_TRUE(dictionary_writer.IsUseful()); @@ -203,11 +203,11 @@ TEST(MinidumpSimpleStringDictionaryWriter, DuplicateKeyValue) { auto entry_writer_0 = make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter()); entry_writer_0->SetKeyValue(kKey, kValue0); - dictionary_writer.AddEntry(crashpad::move(entry_writer_0)); + dictionary_writer.AddEntry(std::move(entry_writer_0)); auto entry_writer_1 = make_scoped_ptr(new MinidumpSimpleStringDictionaryEntryWriter()); entry_writer_1->SetKeyValue(kKey, kValue1); - dictionary_writer.AddEntry(crashpad::move(entry_writer_1)); + dictionary_writer.AddEntry(std::move(entry_writer_1)); EXPECT_TRUE(dictionary_writer.IsUseful()); diff --git a/minidump/minidump_string_writer.cc b/minidump/minidump_string_writer.cc index af210c2..bf40d25 100644 --- a/minidump/minidump_string_writer.cc +++ b/minidump/minidump_string_writer.cc @@ -16,10 +16,11 @@ #include +#include + #include "base/logging.h" #include "minidump/minidump_writer_util.h" #include "util/file/file_writer.h" -#include "util/stdlib/move.h" #include "util/numeric/safe_assignment.h" namespace crashpad { @@ -122,7 +123,7 @@ void MinidumpStringListWriter::AddStringUTF8( const std::string& string_utf8) { auto string_writer = make_scoped_ptr(new MinidumpStringWriterType()); string_writer->SetUTF8(string_utf8); - AddChild(crashpad::move(string_writer)); + AddChild(std::move(string_writer)); } template diff --git a/minidump/minidump_system_info_writer_test.cc b/minidump/minidump_system_info_writer_test.cc index bc1a1b6..88bb0e0 100644 --- a/minidump/minidump_system_info_writer_test.cc +++ b/minidump/minidump_system_info_writer_test.cc @@ -21,6 +21,7 @@ #include #include +#include #include "base/compiler_specific.h" #include "gtest/gtest.h" @@ -31,7 +32,6 @@ #include "snapshot/test/test_system_snapshot.h" #include "test/gtest_death_check.h" #include "util/file/string_file.h" -#include "util/stdlib/move.h" namespace crashpad { namespace test { @@ -84,7 +84,7 @@ TEST(MinidumpSystemInfoWriter, Empty) { system_info_writer->SetCSDVersion(std::string()); - minidump_file_writer.AddStream(crashpad::move(system_info_writer)); + minidump_file_writer.AddStream(std::move(system_info_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -155,7 +155,7 @@ TEST(MinidumpSystemInfoWriter, X86_Win) { system_info_writer->SetCPUX86VersionAndFeatures(kCPUVersion, kCPUFeatures); system_info_writer->SetCPUX86AMDExtendedFeatures(kAMDFeatures); - minidump_file_writer.AddStream(crashpad::move(system_info_writer)); + minidump_file_writer.AddStream(std::move(system_info_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -215,7 +215,7 @@ TEST(MinidumpSystemInfoWriter, AMD64_Mac) { system_info_writer->SetCSDVersion(kCSDVersion); system_info_writer->SetCPUOtherFeatures(kCPUFeatures[0], kCPUFeatures[1]); - minidump_file_writer.AddStream(crashpad::move(system_info_writer)); + minidump_file_writer.AddStream(std::move(system_info_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -257,7 +257,7 @@ TEST(MinidumpSystemInfoWriter, X86_CPUVendorFromRegisters) { kCPUVendor[0], kCPUVendor[1], kCPUVendor[2]); system_info_writer->SetCSDVersion(std::string()); - minidump_file_writer.AddStream(crashpad::move(system_info_writer)); + minidump_file_writer.AddStream(std::move(system_info_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -337,7 +337,7 @@ TEST(MinidumpSystemInfoWriter, InitializeFromSnapshot_X86) { system_info_writer->InitializeFromSnapshot(&system_snapshot); MinidumpFileWriter minidump_file_writer; - minidump_file_writer.AddStream(crashpad::move(system_info_writer)); + minidump_file_writer.AddStream(std::move(system_info_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -432,7 +432,7 @@ TEST(MinidumpSystemInfoWriter, InitializeFromSnapshot_AMD64) { system_info_writer->InitializeFromSnapshot(&system_snapshot); MinidumpFileWriter minidump_file_writer; - minidump_file_writer.AddStream(crashpad::move(system_info_writer)); + minidump_file_writer.AddStream(std::move(system_info_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -470,7 +470,7 @@ TEST(MinidumpSystemInfoWriter, InitializeFromSnapshot_AMD64) { TEST(MinidumpSystemInfoWriterDeathTest, NoCSDVersion) { MinidumpFileWriter minidump_file_writer; auto system_info_writer = make_scoped_ptr(new MinidumpSystemInfoWriter()); - minidump_file_writer.AddStream(crashpad::move(system_info_writer)); + minidump_file_writer.AddStream(std::move(system_info_writer)); StringFile string_file; ASSERT_DEATH_CHECK(minidump_file_writer.WriteEverything(&string_file), diff --git a/minidump/minidump_thread_writer.cc b/minidump/minidump_thread_writer.cc index ab426c3..d41d2dd 100644 --- a/minidump/minidump_thread_writer.cc +++ b/minidump/minidump_thread_writer.cc @@ -16,13 +16,14 @@ #include +#include + #include "base/logging.h" #include "minidump/minidump_context_writer.h" #include "minidump/minidump_memory_writer.h" #include "snapshot/memory_snapshot.h" #include "snapshot/thread_snapshot.h" #include "util/file/file_writer.h" -#include "util/stdlib/move.h" #include "util/numeric/safe_assignment.h" namespace crashpad { @@ -53,12 +54,12 @@ void MinidumpThreadWriter::InitializeFromSnapshot( if (stack_snapshot && stack_snapshot->Size() > 0) { scoped_ptr stack = MinidumpMemoryWriter::CreateFromSnapshot(stack_snapshot); - SetStack(crashpad::move(stack)); + SetStack(std::move(stack)); } scoped_ptr context = MinidumpContextWriter::CreateFromSnapshot(thread_snapshot->Context()); - SetContext(crashpad::move(context)); + SetContext(std::move(context)); } const MINIDUMP_THREAD* MinidumpThreadWriter::MinidumpThread() const { @@ -70,14 +71,14 @@ const MINIDUMP_THREAD* MinidumpThreadWriter::MinidumpThread() const { void MinidumpThreadWriter::SetStack(scoped_ptr stack) { DCHECK_EQ(state(), kStateMutable); - stack_ = crashpad::move(stack); + stack_ = std::move(stack); } void MinidumpThreadWriter::SetContext( scoped_ptr context) { DCHECK_EQ(state(), kStateMutable); - context_ = crashpad::move(context); + context_ = std::move(context); } bool MinidumpThreadWriter::Freeze() { @@ -149,7 +150,7 @@ void MinidumpThreadListWriter::InitializeFromSnapshot( for (const ThreadSnapshot* thread_snapshot : thread_snapshots) { auto thread = make_scoped_ptr(new MinidumpThreadWriter()); thread->InitializeFromSnapshot(thread_snapshot, thread_id_map); - AddThread(crashpad::move(thread)); + AddThread(std::move(thread)); } // Do this in a separate loop to keep the thread stacks earlier in the dump, diff --git a/minidump/minidump_thread_writer_test.cc b/minidump/minidump_thread_writer_test.cc index 4e3fd5c..ab0561a 100644 --- a/minidump/minidump_thread_writer_test.cc +++ b/minidump/minidump_thread_writer_test.cc @@ -19,6 +19,7 @@ #include #include +#include #include "base/compiler_specific.h" #include "base/format_macros.h" @@ -37,7 +38,6 @@ #include "snapshot/test/test_thread_snapshot.h" #include "test/gtest_death_check.h" #include "util/file/string_file.h" -#include "util/stdlib/move.h" namespace crashpad { namespace test { @@ -84,7 +84,7 @@ TEST(MinidumpThreadWriter, EmptyThreadList) { MinidumpFileWriter minidump_file_writer; auto thread_list_writer = make_scoped_ptr(new MinidumpThreadListWriter()); - minidump_file_writer.AddStream(crashpad::move(thread_list_writer)); + minidump_file_writer.AddStream(std::move(thread_list_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -161,10 +161,10 @@ TEST(MinidumpThreadWriter, OneThread_x86_NoStack) { auto context_x86_writer = make_scoped_ptr(new MinidumpContextX86Writer()); InitializeMinidumpContextX86(context_x86_writer->context(), kSeed); - thread_writer->SetContext(crashpad::move(context_x86_writer)); + thread_writer->SetContext(std::move(context_x86_writer)); - thread_list_writer->AddThread(crashpad::move(thread_writer)); - minidump_file_writer.AddStream(crashpad::move(thread_list_writer)); + thread_list_writer->AddThread(std::move(thread_writer)); + minidump_file_writer.AddStream(std::move(thread_list_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -223,15 +223,15 @@ TEST(MinidumpThreadWriter, OneThread_AMD64_Stack) { auto memory_writer = make_scoped_ptr( new TestMinidumpMemoryWriter(kMemoryBase, kMemorySize, kMemoryValue)); - thread_writer->SetStack(crashpad::move(memory_writer)); + thread_writer->SetStack(std::move(memory_writer)); MSVC_SUPPRESS_WARNING(4316); // Object allocated on heap may not be aligned. auto context_amd64_writer = make_scoped_ptr(new MinidumpContextAMD64Writer()); InitializeMinidumpContextAMD64(context_amd64_writer->context(), kSeed); - thread_writer->SetContext(crashpad::move(context_amd64_writer)); + thread_writer->SetContext(std::move(context_amd64_writer)); - thread_list_writer->AddThread(crashpad::move(thread_writer)); - minidump_file_writer.AddStream(crashpad::move(thread_list_writer)); + thread_list_writer->AddThread(std::move(thread_writer)); + minidump_file_writer.AddStream(std::move(thread_list_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -301,13 +301,13 @@ TEST(MinidumpThreadWriter, ThreeThreads_x86_MemoryList) { auto memory_writer_0 = make_scoped_ptr( new TestMinidumpMemoryWriter(kMemoryBase0, kMemorySize0, kMemoryValue0)); - thread_writer_0->SetStack(crashpad::move(memory_writer_0)); + thread_writer_0->SetStack(std::move(memory_writer_0)); auto context_x86_writer_0 = make_scoped_ptr(new MinidumpContextX86Writer()); InitializeMinidumpContextX86(context_x86_writer_0->context(), kSeed0); - thread_writer_0->SetContext(crashpad::move(context_x86_writer_0)); + thread_writer_0->SetContext(std::move(context_x86_writer_0)); - thread_list_writer->AddThread(crashpad::move(thread_writer_0)); + thread_list_writer->AddThread(std::move(thread_writer_0)); const uint32_t kThreadID1 = 2222222; const uint32_t kSuspendCount1 = 222222; @@ -328,13 +328,13 @@ TEST(MinidumpThreadWriter, ThreeThreads_x86_MemoryList) { auto memory_writer_1 = make_scoped_ptr( new TestMinidumpMemoryWriter(kMemoryBase1, kMemorySize1, kMemoryValue1)); - thread_writer_1->SetStack(crashpad::move(memory_writer_1)); + thread_writer_1->SetStack(std::move(memory_writer_1)); auto context_x86_writer_1 = make_scoped_ptr(new MinidumpContextX86Writer()); InitializeMinidumpContextX86(context_x86_writer_1->context(), kSeed1); - thread_writer_1->SetContext(crashpad::move(context_x86_writer_1)); + thread_writer_1->SetContext(std::move(context_x86_writer_1)); - thread_list_writer->AddThread(crashpad::move(thread_writer_1)); + thread_list_writer->AddThread(std::move(thread_writer_1)); const uint32_t kThreadID2 = 3333333; const uint32_t kSuspendCount2 = 333333; @@ -355,16 +355,16 @@ TEST(MinidumpThreadWriter, ThreeThreads_x86_MemoryList) { auto memory_writer_2 = make_scoped_ptr( new TestMinidumpMemoryWriter(kMemoryBase2, kMemorySize2, kMemoryValue2)); - thread_writer_2->SetStack(crashpad::move(memory_writer_2)); + thread_writer_2->SetStack(std::move(memory_writer_2)); auto context_x86_writer_2 = make_scoped_ptr(new MinidumpContextX86Writer()); InitializeMinidumpContextX86(context_x86_writer_2->context(), kSeed2); - thread_writer_2->SetContext(crashpad::move(context_x86_writer_2)); + thread_writer_2->SetContext(std::move(context_x86_writer_2)); - thread_list_writer->AddThread(crashpad::move(thread_writer_2)); + thread_list_writer->AddThread(std::move(thread_writer_2)); - minidump_file_writer.AddStream(crashpad::move(thread_list_writer)); - minidump_file_writer.AddStream(crashpad::move(memory_list_writer)); + minidump_file_writer.AddStream(std::move(thread_list_writer)); + minidump_file_writer.AddStream(std::move(memory_list_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -601,7 +601,7 @@ void RunInitializeFromSnapshotTest(bool thread_id_collision) { expect_threads[index].Stack.StartOfMemoryRange); memory_snapshot->SetSize(expect_threads[index].Stack.Memory.DataSize); memory_snapshot->SetValue(memory_values[index]); - thread_snapshot->SetStack(crashpad::move(memory_snapshot)); + thread_snapshot->SetStack(std::move(memory_snapshot)); } Traits::InitializeCPUContext(thread_snapshot->MutableContext(), @@ -611,7 +611,7 @@ void RunInitializeFromSnapshotTest(bool thread_id_collision) { teb_snapshot->SetAddress(expect_threads[index].Teb); teb_snapshot->SetSize(kTebSize); teb_snapshot->SetValue(static_cast('t' + index)); - thread_snapshot->AddExtraMemory(crashpad::move(teb_snapshot)); + thread_snapshot->AddExtraMemory(std::move(teb_snapshot)); thread_snapshots.push_back(thread_snapshot); } @@ -623,8 +623,8 @@ void RunInitializeFromSnapshotTest(bool thread_id_collision) { thread_list_writer->InitializeFromSnapshot(thread_snapshots, &thread_id_map); MinidumpFileWriter minidump_file_writer; - minidump_file_writer.AddStream(crashpad::move(thread_list_writer)); - minidump_file_writer.AddStream(crashpad::move(memory_list_writer)); + minidump_file_writer.AddStream(std::move(thread_list_writer)); + minidump_file_writer.AddStream(std::move(memory_list_writer)); StringFile string_file; ASSERT_TRUE(minidump_file_writer.WriteEverything(&string_file)); @@ -701,8 +701,8 @@ TEST(MinidumpThreadWriterDeathTest, NoContext) { auto thread_writer = make_scoped_ptr(new MinidumpThreadWriter()); - thread_list_writer->AddThread(crashpad::move(thread_writer)); - minidump_file_writer.AddStream(crashpad::move(thread_list_writer)); + thread_list_writer->AddThread(std::move(thread_writer)); + minidump_file_writer.AddStream(std::move(thread_list_writer)); StringFile string_file; ASSERT_DEATH_CHECK(minidump_file_writer.WriteEverything(&string_file), diff --git a/snapshot/test/test_process_snapshot.h b/snapshot/test/test_process_snapshot.h index 666fa0a..6e81354 100644 --- a/snapshot/test/test_process_snapshot.h +++ b/snapshot/test/test_process_snapshot.h @@ -21,6 +21,7 @@ #include #include +#include #include #include "base/basictypes.h" @@ -32,7 +33,6 @@ #include "snapshot/process_snapshot.h" #include "snapshot/system_snapshot.h" #include "snapshot/thread_snapshot.h" -#include "util/stdlib/move.h" #include "util/misc/uuid.h" #include "util/stdlib/pointer_container.h" @@ -73,7 +73,7 @@ class TestProcessSnapshot final : public ProcessSnapshot { //! \param[in] system The system snapshot that System() will return. The //! TestProcessSnapshot object takes ownership of \a system. void SetSystem(scoped_ptr system) { - system_ = crashpad::move(system); + system_ = std::move(system); } //! \brief Adds a thread snapshot to be returned by Threads(). @@ -97,7 +97,7 @@ class TestProcessSnapshot final : public ProcessSnapshot { //! \param[in] exception The exception snapshot that Exception() will return. //! The TestProcessSnapshot object takes ownership of \a exception. void SetException(scoped_ptr exception) { - exception_ = crashpad::move(exception); + exception_ = std::move(exception); } //! \brief Adds a memory map region snapshot to be returned by MemoryMap(). diff --git a/snapshot/test/test_thread_snapshot.h b/snapshot/test/test_thread_snapshot.h index 49a10c6..29e3f5f 100644 --- a/snapshot/test/test_thread_snapshot.h +++ b/snapshot/test/test_thread_snapshot.h @@ -17,6 +17,7 @@ #include +#include #include #include "base/basictypes.h" @@ -24,7 +25,6 @@ #include "snapshot/cpu_context.h" #include "snapshot/memory_snapshot.h" #include "snapshot/thread_snapshot.h" -#include "util/stdlib/move.h" #include "util/stdlib/pointer_container.h" namespace crashpad { @@ -56,9 +56,7 @@ class TestThreadSnapshot final : public ThreadSnapshot { //! //! \param[in] stack The memory region that Stack() will return. The //! TestThreadSnapshot object takes ownership of \a stack. - void SetStack(scoped_ptr stack) { - stack_ = crashpad::move(stack); - } + void SetStack(scoped_ptr stack) { stack_ = std::move(stack); } void SetThreadID(uint64_t thread_id) { thread_id_ = thread_id; } void SetSuspendCount(int suspend_count) { suspend_count_ = suspend_count; } diff --git a/test/win/win_child_process.cc b/test/win/win_child_process.cc index 1f11bc7..41cacfa 100644 --- a/test/win/win_child_process.cc +++ b/test/win/win_child_process.cc @@ -18,12 +18,12 @@ #include #include +#include #include "base/logging.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "gtest/gtest.h" -#include "util/stdlib/move.h" #include "util/stdlib/string_number_conversion.h" #include "util/string/split_string.h" #include "util/win/handle.h" @@ -126,8 +126,8 @@ bool CreateInheritablePipe(ScopedFileHANDLE* read_handle, if (!write_inheritable && !UnsetHandleInheritance(temp_write.get())) return false; - *read_handle = crashpad::move(temp_read); - *write_handle = crashpad::move(temp_write); + *read_handle = std::move(temp_read); + *write_handle = std::move(temp_write); return true; } @@ -213,7 +213,7 @@ scoped_ptr WinChildProcess::Launch() { return scoped_ptr(); } - return crashpad::move(handles_for_parent); + return std::move(handles_for_parent); } FileHandle WinChildProcess::ReadPipeHandle() const { diff --git a/tools/crashpad_database_util.cc b/tools/crashpad_database_util.cc index 50666f2..a1ad52b 100644 --- a/tools/crashpad_database_util.cc +++ b/tools/crashpad_database_util.cc @@ -22,6 +22,7 @@ #include #include +#include #include #include "base/basictypes.h" @@ -36,7 +37,6 @@ #include "tools/tool_support.h" #include "util/file/file_io.h" #include "util/file/file_reader.h" -#include "util/stdlib/move.h" #include "util/misc/uuid.h" namespace crashpad { @@ -553,7 +553,7 @@ int DatabaseUtilMain(int argc, char* argv[]) { return EXIT_FAILURE; } - file_reader = crashpad::move(file_path_reader); + file_reader = std::move(file_path_reader); } CrashReportDatabase::NewReport* new_report; diff --git a/util/mach/child_port_handshake.cc b/util/mach/child_port_handshake.cc index 3fe4c44..a7b6e57 100644 --- a/util/mach/child_port_handshake.cc +++ b/util/mach/child_port_handshake.cc @@ -23,6 +23,7 @@ #include #include +#include #include "base/logging.h" #include "base/mac/mach_logging.h" @@ -37,7 +38,6 @@ #include "util/mach/mach_message.h" #include "util/mach/mach_message_server.h" #include "util/misc/implicit_cast.h" -#include "util/stdlib/move.h" #include "util/misc/random_string.h" namespace crashpad { @@ -353,30 +353,30 @@ ChildPortHandshake::~ChildPortHandshake() { base::ScopedFD ChildPortHandshake::ClientReadFD() { DCHECK(client_read_fd_.is_valid()); - return crashpad::move(client_read_fd_); + return std::move(client_read_fd_); } base::ScopedFD ChildPortHandshake::ServerWriteFD() { DCHECK(server_write_fd_.is_valid()); - return crashpad::move(server_write_fd_); + return std::move(server_write_fd_); } mach_port_t ChildPortHandshake::RunServer(PortRightType port_right_type) { client_read_fd_.reset(); - return RunServerForFD(crashpad::move(server_write_fd_), port_right_type); + return RunServerForFD(std::move(server_write_fd_), port_right_type); } bool ChildPortHandshake::RunClient(mach_port_t port, mach_msg_type_name_t right_type) { server_write_fd_.reset(); - return RunClientForFD(crashpad::move(client_read_fd_), port, right_type); + return RunClientForFD(std::move(client_read_fd_), port, right_type); } // static mach_port_t ChildPortHandshake::RunServerForFD(base::ScopedFD server_write_fd, PortRightType port_right_type) { ChildPortHandshakeServer server; - return server.RunServer(crashpad::move(server_write_fd), port_right_type); + return server.RunServer(std::move(server_write_fd), port_right_type); } // static diff --git a/util/mach/child_port_handshake.h b/util/mach/child_port_handshake.h index f738cda..666f59b 100644 --- a/util/mach/child_port_handshake.h +++ b/util/mach/child_port_handshake.h @@ -138,7 +138,7 @@ class ChildPortHandshakeTest; //! // Obtain a receive right from the parent process. //! base::mac::ScopedMachReceiveRight receive_right( //! ChildPortHandshake::RunServerForFD( -//! crashpad::move(server_write_fd), +//! std::move(server_write_fd), //! ChildPortHandshake::PortRightType::kReceiveRight)); //! } //! \endcode diff --git a/util/net/http_transport.cc b/util/net/http_transport.cc index 07b0b34..8587d0a 100644 --- a/util/net/http_transport.cc +++ b/util/net/http_transport.cc @@ -14,7 +14,8 @@ #include "util/net/http_transport.h" -#include "util/stdlib/move.h" +#include + #include "util/net/http_body.h" namespace crashpad { @@ -44,7 +45,7 @@ void HTTPTransport::SetHeader(const std::string& header, } void HTTPTransport::SetBodyStream(scoped_ptr stream) { - body_stream_ = crashpad::move(stream); + body_stream_ = std::move(stream); } void HTTPTransport::SetTimeout(double timeout) { diff --git a/util/net/http_transport_test.cc b/util/net/http_transport_test.cc index b59b17f..46e7a5f 100644 --- a/util/net/http_transport_test.cc +++ b/util/net/http_transport_test.cc @@ -18,6 +18,7 @@ #include #include +#include #include #include "base/files/file_path.h" @@ -31,7 +32,6 @@ #include "test/multiprocess_exec.h" #include "test/paths.h" #include "util/file/file_io.h" -#include "util/stdlib/move.h" #include "util/misc/random_string.h" #include "util/net/http_body.h" #include "util/net/http_headers.h" @@ -52,7 +52,7 @@ class HTTPTransportTestFixture : public MultiprocessExec { RequestValidator request_validator) : MultiprocessExec(), headers_(headers), - body_stream_(crashpad::move(body_stream)), + body_stream_(std::move(body_stream)), response_code_(http_response_code), request_validator_(request_validator) { base::FilePath server_path = Paths::TestDataRoot().Append( @@ -103,7 +103,7 @@ class HTTPTransportTestFixture : public MultiprocessExec { for (const auto& pair : headers_) { transport->SetHeader(pair.first, pair.second); } - transport->SetBodyStream(crashpad::move(body_stream_)); + transport->SetBodyStream(std::move(body_stream_)); std::string response_body; bool success = transport->ExecuteSynchronously(&response_body); @@ -271,8 +271,8 @@ TEST(HTTPTransport, UnchunkedPlainText) { headers[kContentType] = kTextPlain; headers[kContentLength] = base::StringPrintf("%" PRIuS, strlen(kTextBody)); - HTTPTransportTestFixture test(headers, crashpad::move(body_stream), 200, - &UnchunkedPlainText); + HTTPTransportTestFixture test( + headers, std::move(body_stream), 200, &UnchunkedPlainText); test.Run(); } @@ -292,7 +292,10 @@ void RunUpload33k(bool has_content_length) { headers[kContentLength] = base::StringPrintf("%" PRIuS, request_string.size()); } - HTTPTransportTestFixture test(headers, crashpad::move(body_stream), 200, + HTTPTransportTestFixture test( + headers, + std::move(body_stream), + 200, [](HTTPTransportTestFixture* fixture, const std::string& request) { size_t body_start = request.rfind("\r\n"); EXPECT_EQ(33 * 1024u + 2, request.size() - body_start); diff --git a/util/stdlib/move.h b/util/stdlib/move.h deleted file mode 100644 index b6f15bc..0000000 --- a/util/stdlib/move.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2015 The Crashpad Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef CRASHPAD_UTIL_STDLIB_MOVE_H_ -#define CRASHPAD_UTIL_STDLIB_MOVE_H_ - -#include "util/stdlib/cxx.h" - -namespace crashpad { - -#if CXX_LIBRARY_VERSION >= 2011 -//! \brief A typedef for std::remove_reference until C++11 library support is -// always available. -template -using remove_reference = std::remove_reference; -#else -//! \brief A replacement for std::remove_reference until C++11 library support -// is always available. -template -struct remove_reference { using type = T; }; -template -struct remove_reference { using type = T; }; -#endif // CXX_LIBRARY_VERSION - -#if CXX_LIBRARY_VERSION >= 2011 -//! \brief A wrapper around std::move() until C++11 library support is -// always available. -template -typename std::remove_reference::type&& move(T&& t) { - return std::move(t); -} -#else -//! \brief A replacement for std::move() until C++11 library support is -// always available. -template -typename remove_reference::type&& move(T&& t) { - return static_cast::type&&>(t); -} -#endif // CXX_LIBRARY_VERSION - -} // namespace crashpad - -#endif // CRASHPAD_UTIL_STDLIB_MOVE_H_ diff --git a/util/util.gyp b/util/util.gyp index 5e89ec0..83f2c55 100644 --- a/util/util.gyp +++ b/util/util.gyp @@ -132,7 +132,6 @@ 'stdlib/aligned_allocator.h', 'stdlib/cxx.h', 'stdlib/map_insert.h', - 'stdlib/move.h', 'stdlib/objc.h', 'stdlib/pointer_container.h', 'stdlib/string_number_conversion.cc', diff --git a/util/win/exception_handler_server.cc b/util/win/exception_handler_server.cc index 4273523..5559efb 100644 --- a/util/win/exception_handler_server.cc +++ b/util/win/exception_handler_server.cc @@ -17,6 +17,8 @@ #include #include +#include + #include "base/logging.h" #include "base/numerics/safe_conversions.h" #include "base/rand_util.h" @@ -26,7 +28,6 @@ #include "snapshot/crashpad_info_client_options.h" #include "snapshot/win/process_snapshot_win.h" #include "util/file/file_writer.h" -#include "util/stdlib/move.h" #include "util/misc/random_string.h" #include "util/misc/tri_state.h" #include "util/misc/uuid.h" @@ -180,7 +181,7 @@ class ClientData { CreateEvent(nullptr, false /* auto reset */, false, nullptr)), non_crash_dump_completed_event_( CreateEvent(nullptr, false /* auto reset */, false, nullptr)), - process_(crashpad::move(process)), + process_(std::move(process)), crash_exception_information_address_( crash_exception_information_address), non_crash_exception_information_address_(