From 78bec65b27f21c4731735b1873775522f5e7fa6b Mon Sep 17 00:00:00 2001 From: Mark Mentovai Date: Tue, 28 Oct 2014 17:28:31 -0400 Subject: [PATCH] minidump: Use decltype(object) instead of typeof(object). TEST=minidump_test R=rsesek@chromium.org Review URL: https://codereview.chromium.org/681313005 --- minidump/minidump_memory_writer.cc | 2 +- minidump/minidump_module_writer.cc | 10 +++++----- minidump/minidump_writable.cc | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/minidump/minidump_memory_writer.cc b/minidump/minidump_memory_writer.cc index d79ca7b2..30977a9e 100644 --- a/minidump/minidump_memory_writer.cc +++ b/minidump/minidump_memory_writer.cc @@ -76,7 +76,7 @@ bool MinidumpMemoryWriter::WillWriteAtOffsetImpl(off_t offset) { DCHECK_GE(registered_memory_descriptors_.size(), 1u); uint64_t base_address = MemoryRangeBaseAddress(); - typeof(registered_memory_descriptors_[0]->StartOfMemoryRange) local_address; + decltype(registered_memory_descriptors_[0]->StartOfMemoryRange) local_address; if (!AssignIfInRange(&local_address, base_address)) { LOG(ERROR) << "base_address " << base_address << " out of range"; return false; diff --git a/minidump/minidump_module_writer.cc b/minidump/minidump_module_writer.cc index 45ca9e43..0543e3a6 100644 --- a/minidump/minidump_module_writer.cc +++ b/minidump/minidump_module_writer.cc @@ -47,7 +47,7 @@ MinidumpModuleCodeViewRecordPDBLinkWriter::SizeOfObject() { DCHECK_GE(state(), kStateFrozen); // NUL-terminate. - return offsetof(typeof(codeview_record_), pdb_name) + + return offsetof(decltype(codeview_record_), pdb_name) + (pdb_name_.size() + 1) * sizeof(pdb_name_[0]); } @@ -58,7 +58,7 @@ bool MinidumpModuleCodeViewRecordPDBLinkWriter::WriteObject( WritableIoVec iov; iov.iov_base = &codeview_record_; - iov.iov_len = offsetof(typeof(codeview_record_), pdb_name); + iov.iov_len = offsetof(decltype(codeview_record_), pdb_name); std::vector iovecs(1, iov); // NUL-terminate. @@ -131,12 +131,12 @@ bool MinidumpModuleMiscDebugRecordWriter::Freeze() { // NUL-terminate. if (!image_debug_misc_.Unicode) { DCHECK(data_utf16_.empty()); - image_debug_misc_.Length = offsetof(typeof(image_debug_misc_), Data) + + image_debug_misc_.Length = offsetof(decltype(image_debug_misc_), Data) + (data_.size() + 1) * sizeof(data_[0]); } else { DCHECK(data_.empty()); image_debug_misc_.Length = - offsetof(typeof(image_debug_misc_), Data) + + offsetof(decltype(image_debug_misc_), Data) + (data_utf16_.size() + 1) * sizeof(data_utf16_[0]); } @@ -153,7 +153,7 @@ bool MinidumpModuleMiscDebugRecordWriter::WriteObject( FileWriterInterface* file_writer) { DCHECK_EQ(state(), kStateWritable); - const size_t base_length = offsetof(typeof(image_debug_misc_), Data); + const size_t base_length = offsetof(decltype(image_debug_misc_), Data); WritableIoVec iov; iov.iov_base = &image_debug_misc_; diff --git a/minidump/minidump_writable.cc b/minidump/minidump_writable.cc index 3bb4bffa..5e87c941 100644 --- a/minidump/minidump_writable.cc +++ b/minidump/minidump_writable.cc @@ -180,7 +180,7 @@ size_t MinidumpWritable::WillWriteAtOffset( } if (!registered_location_descriptors_.empty()) { - typeof(registered_location_descriptors_[0]->DataSize) local_size; + decltype(registered_location_descriptors_[0]->DataSize) local_size; if (!AssignIfInRange(&local_size, size)) { LOG(ERROR) << "size " << size << " out of range"; return kInvalidSize;