summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmdline/token_range.h2
-rw-r--r--compiler/driver/simple_compiler_options_map.h2
-rw-r--r--dex2oat/dex2oat_options.cc4
-rw-r--r--dex2oat/linker/elf_writer_quick.cc20
-rw-r--r--dexlayout/dex_ir_builder.cc15
-rw-r--r--openjdkjvmti/OpenjdkJvmTi.cc3
-rw-r--r--runtime/monitor_test.cc5
-rw-r--r--runtime/native_stack_dump.cc9
-rw-r--r--runtime/parsed_options.cc5
9 files changed, 35 insertions, 30 deletions
diff --git a/cmdline/token_range.h b/cmdline/token_range.h
index 642bb1d34c..e28ead92df 100644
--- a/cmdline/token_range.h
+++ b/cmdline/token_range.h
@@ -325,7 +325,7 @@ struct TokenRange {
string_idx += remaining;
maybe_push_wildcard_token();
- return std::unique_ptr<TokenRange>(new TokenRange(std::move(new_token_list)));
+ return std::make_unique<TokenRange>(std::move(new_token_list));
}
// Do a quick match token-by-token, and see if they match.
diff --git a/compiler/driver/simple_compiler_options_map.h b/compiler/driver/simple_compiler_options_map.h
index 3860da9f66..e7a51a4995 100644
--- a/compiler/driver/simple_compiler_options_map.h
+++ b/compiler/driver/simple_compiler_options_map.h
@@ -50,7 +50,7 @@ using Parser = CmdlineParser<SimpleParseArgumentMap, SimpleParseArgumentMapKey>;
static inline Parser CreateSimpleParser(bool ignore_unrecognized) {
std::unique_ptr<Parser::Builder> parser_builder =
- std::unique_ptr<Parser::Builder>(new Parser::Builder());
+ std::make_unique<Parser::Builder>();
AddCompilerOptionsArgumentParserOptions<SimpleParseArgumentMap>(*parser_builder);
diff --git a/dex2oat/dex2oat_options.cc b/dex2oat/dex2oat_options.cc
index 710f14c4c5..236c1fc894 100644
--- a/dex2oat/dex2oat_options.cc
+++ b/dex2oat/dex2oat_options.cc
@@ -187,7 +187,7 @@ static void AddTargetMappings(Builder& builder) {
}
static Parser CreateArgumentParser() {
- std::unique_ptr<Builder> parser_builder = std::unique_ptr<Builder>(new Builder());
+ std::unique_ptr<Builder> parser_builder = std::make_unique<Builder>();
AddInputMappings(*parser_builder);
AddGeneratedArtifactMappings(*parser_builder);
@@ -267,7 +267,7 @@ std::unique_ptr<Dex2oatArgumentMap> Dex2oatArgumentMap::Parse(int argc,
return nullptr;
}
- return std::unique_ptr<Dex2oatArgumentMap>(new Dex2oatArgumentMap(parser.ReleaseArgumentsMap()));
+ return std::make_unique<Dex2oatArgumentMap>(parser.ReleaseArgumentsMap());
}
#pragma GCC diagnostic pop
diff --git a/dex2oat/linker/elf_writer_quick.cc b/dex2oat/linker/elf_writer_quick.cc
index 9a7f93d9fc..9fbcca4715 100644
--- a/dex2oat/linker/elf_writer_quick.cc
+++ b/dex2oat/linker/elf_writer_quick.cc
@@ -17,6 +17,7 @@
#include "elf_writer_quick.h"
#include <openssl/sha.h>
+#include <memory>
#include <unordered_map>
#include <unordered_set>
@@ -263,16 +264,15 @@ void ElfWriterQuick<ElfTypes>::PrepareDebugInfo(const debug::DebugInfo& debug_in
if (!debug_info.Empty() && compiler_options_.GetGenerateMiniDebugInfo()) {
// Prepare the mini-debug-info in background while we do other I/O.
Thread* self = Thread::Current();
- debug_info_task_ = std::unique_ptr<DebugInfoTask>(
- new DebugInfoTask(builder_->GetIsa(),
- compiler_options_.GetInstructionSetFeatures(),
- builder_->GetText()->GetAddress(),
- text_size_,
- builder_->GetDex()->Exists() ? builder_->GetDex()->GetAddress() : 0,
- dex_section_size_,
- debug_info));
- debug_info_thread_pool_ = std::unique_ptr<ThreadPool>(
- new ThreadPool("Mini-debug-info writer", 1));
+ debug_info_task_ = std::make_unique<DebugInfoTask>(
+ builder_->GetIsa(),
+ compiler_options_.GetInstructionSetFeatures(),
+ builder_->GetText()->GetAddress(),
+ text_size_,
+ builder_->GetDex()->Exists() ? builder_->GetDex()->GetAddress() : 0,
+ dex_section_size_,
+ debug_info);
+ debug_info_thread_pool_ = std::make_unique<ThreadPool>("Mini-debug-info writer", 1);
debug_info_thread_pool_->AddTask(self, debug_info_task_.get());
debug_info_thread_pool_->StartWorkers(self);
}
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;
diff --git a/openjdkjvmti/OpenjdkJvmTi.cc b/openjdkjvmti/OpenjdkJvmTi.cc
index a2fabbfe83..bd5b598ec7 100644
--- a/openjdkjvmti/OpenjdkJvmTi.cc
+++ b/openjdkjvmti/OpenjdkJvmTi.cc
@@ -29,6 +29,7 @@
* questions.
*/
+#include <memory>
#include <string>
#include <type_traits>
#include <vector>
@@ -1492,7 +1493,7 @@ ArtJvmTiEnv::ArtJvmTiEnv(art::JavaVMExt* runtime, EventHandler* event_handler, j
capabilities(),
event_info_mutex_("jvmtiEnv_EventInfoMutex"),
last_error_mutex_("jvmtiEnv_LastErrorMutex", art::LockLevel::kGenericBottomLock) {
- object_tag_table = std::unique_ptr<ObjectTagTable>(new ObjectTagTable(event_handler, this));
+ object_tag_table = std::make_unique<ObjectTagTable>(event_handler, this);
functions = &gJvmtiInterface;
}
diff --git a/runtime/monitor_test.cc b/runtime/monitor_test.cc
index 8610899b9b..8ddd50f031 100644
--- a/runtime/monitor_test.cc
+++ b/runtime/monitor_test.cc
@@ -16,6 +16,7 @@
#include "monitor.h"
+#include <memory>
#include <string>
#include "base/atomic.h"
@@ -251,8 +252,8 @@ static void CommonWaitSetup(MonitorTest* test, ClassLinker* class_linker, uint64
"hello, world!"));
// Create the barrier used to synchronize.
- test->barrier_ = std::unique_ptr<Barrier>(new Barrier(2));
- test->complete_barrier_ = std::unique_ptr<Barrier>(new Barrier(3));
+ test->barrier_ = std::make_unique<Barrier>(2);
+ test->complete_barrier_ = std::make_unique<Barrier>(3);
test->completed_ = false;
// Our job: Fill the heap, then try Wait.
diff --git a/runtime/native_stack_dump.cc b/runtime/native_stack_dump.cc
index ce295aacde..10f589831f 100644
--- a/runtime/native_stack_dump.cc
+++ b/runtime/native_stack_dump.cc
@@ -16,6 +16,7 @@
#include "native_stack_dump.h"
+#include <memory>
#include <ostream>
#include <stdio.h>
@@ -128,10 +129,10 @@ static std::unique_ptr<Addr2linePipe> Connect(const std::string& name, const cha
} else {
close(caller_to_addr2line[0]);
close(addr2line_to_caller[1]);
- return std::unique_ptr<Addr2linePipe>(new Addr2linePipe(addr2line_to_caller[0],
- caller_to_addr2line[1],
- name,
- pid));
+ return std::make_unique<Addr2linePipe>(addr2line_to_caller[0],
+ caller_to_addr2line[1],
+ name,
+ pid);
}
}
diff --git a/runtime/parsed_options.cc b/runtime/parsed_options.cc
index 2e495cc866..715792876d 100644
--- a/runtime/parsed_options.cc
+++ b/runtime/parsed_options.cc
@@ -16,6 +16,7 @@
#include "parsed_options.h"
+#include <memory>
#include <sstream>
#include <android-base/logging.h>
@@ -67,7 +68,7 @@ std::unique_ptr<RuntimeParser> ParsedOptions::MakeParser(bool ignore_unrecognize
using M = RuntimeArgumentMap;
std::unique_ptr<RuntimeParser::Builder> parser_builder =
- std::unique_ptr<RuntimeParser::Builder>(new RuntimeParser::Builder());
+ std::make_unique<RuntimeParser::Builder>();
parser_builder->
Define("-Xzygote")
@@ -346,7 +347,7 @@ std::unique_ptr<RuntimeParser> ParsedOptions::MakeParser(bool ignore_unrecognize
// TODO: Move Usage information into this DSL.
- return std::unique_ptr<RuntimeParser>(new RuntimeParser(parser_builder->Build()));
+ return std::make_unique<RuntimeParser>(parser_builder->Build());
}
#pragma GCC diagnostic pop