diff options
author | 2018-10-29 14:28:56 -0700 | |
---|---|---|
committer | 2018-10-29 14:39:24 -0700 | |
commit | c57c680b16eb4857eef16134a811f4c2ff9d95f0 (patch) | |
tree | 9527328cb8738878e1b727a48620769224dddb2c /dexlayout/dex_ir_builder.cc | |
parent | ce2a00daa92670a4fc01ef59fdbc3769a846f69c (diff) |
Modernise code to use std::make_unique
Generated by clang-tidy.
Test: m checkbuild
Change-Id: Idb24960d9326c0d94ab5d04b18deb0894d23da9f
Diffstat (limited to 'dexlayout/dex_ir_builder.cc')
-rw-r--r-- | dexlayout/dex_ir_builder.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/dexlayout/dex_ir_builder.cc b/dexlayout/dex_ir_builder.cc index 947d3d5297..7789c5f77d 100644 --- a/dexlayout/dex_ir_builder.cc +++ b/dexlayout/dex_ir_builder.cc @@ -17,6 +17,7 @@ */ #include <stdint.h> +#include <memory> #include <vector> #include "dex_ir_builder.h" @@ -698,8 +699,8 @@ AnnotationsDirectoryItem* BuilderMaps::CreateAnnotationsDirectoryItem(const DexF uint32_t annotation_set_offset = fields[i].annotations_off_; AnnotationSetItem* annotation_set_item = CreateAnnotationSetItem(dex_file, field_set_item, annotation_set_offset); - field_annotations->push_back(std::unique_ptr<FieldAnnotation>( - new FieldAnnotation(field_id, annotation_set_item))); + field_annotations->push_back(std::make_unique<FieldAnnotation>( + field_id, annotation_set_item)); } } const DexFile::MethodAnnotationsItem* methods = @@ -714,8 +715,8 @@ AnnotationsDirectoryItem* BuilderMaps::CreateAnnotationsDirectoryItem(const DexF uint32_t annotation_set_offset = methods[i].annotations_off_; AnnotationSetItem* annotation_set_item = CreateAnnotationSetItem(dex_file, method_set_item, annotation_set_offset); - method_annotations->push_back(std::unique_ptr<MethodAnnotation>( - new MethodAnnotation(method_id, annotation_set_item))); + method_annotations->push_back(std::make_unique<MethodAnnotation>( + method_id, annotation_set_item)); } } const DexFile::ParameterAnnotationsItem* parameters = @@ -1160,9 +1161,9 @@ void BuilderMaps::ReadEncodedValue(const DexFile& dex_file, // Decode all name=value pairs. for (uint32_t i = 0; i < size; i++) { const uint32_t name_index = DecodeUnsignedLeb128(data); - elements->push_back(std::unique_ptr<AnnotationElement>( - new AnnotationElement(header_->StringIds()[name_index], - ReadEncodedValue(dex_file, data)))); + elements->push_back(std::make_unique<AnnotationElement>( + header_->StringIds()[name_index], + ReadEncodedValue(dex_file, data))); } item->SetEncodedAnnotation(new EncodedAnnotation(header_->TypeIds()[type_idx], elements)); break; |