C++14: Use std::make_unique where possible. Bug: b/147359661 Change-Id: I20e3b90b02327250d77a1006cea712022ad0f9d5 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/39951 Reviewed-by: Alexis Hétu <sugoi@google.com> Reviewed-by: Nicolas Capens <nicolascapens@google.com> Tested-by: Ben Clayton <bclayton@google.com>
diff --git a/src/Reactor/Coroutine.hpp b/src/Reactor/Coroutine.hpp index 92ad2e3..7d45115 100644 --- a/src/Reactor/Coroutine.hpp +++ b/src/Reactor/Coroutine.hpp
@@ -185,7 +185,7 @@ using Sig = Nucleus::CoroutineBegin<Arguments...>; auto pfn = (Sig *)routine->getEntry(Nucleus::CoroutineEntryBegin); auto handle = pfn(args...); - return std::unique_ptr<Stream<Return>>(new Stream<Return>(routine, handle)); + return std::make_unique<Stream<Return>>(routine, handle); } # ifdef Yield // Defined in WinBase.h
diff --git a/src/Reactor/LLVMReactor.cpp b/src/Reactor/LLVMReactor.cpp index f64f910..d5244a8 100644 --- a/src/Reactor/LLVMReactor.cpp +++ b/src/Reactor/LLVMReactor.cpp
@@ -1499,7 +1499,7 @@ jit->function = rr::createFunction("", T(ReturnType), T(Params)); #ifdef ENABLE_RR_DEBUG_INFO - jit->debugInfo = std::unique_ptr<DebugInfo>(new DebugInfo(jit->builder.get(), &jit->context, jit->module.get(), jit->function)); + jit->debugInfo = std::make_unique<DebugInfo>(jit->builder.get(), &jit->context, jit->module.get(), jit->function); #endif // ENABLE_RR_DEBUG_INFO jit->builder->SetInsertPoint(llvm::BasicBlock::Create(jit->context, "", jit->function)); @@ -4908,7 +4908,7 @@ // #ifdef ENABLE_RR_DEBUG_INFO - jit->debugInfo = std::unique_ptr<rr::DebugInfo>(new rr::DebugInfo(jit->builder.get(), &jit->context, jit->module.get(), jit->function)); + jit->debugInfo = std::make_unique<rr::DebugInfo>(jit->builder.get(), &jit->context, jit->module.get(), jit->function); #endif // ENABLE_RR_DEBUG_INFO jit->coroutine.suspendBlock = llvm::BasicBlock::Create(jit->context, "suspend", jit->function);
diff --git a/src/Reactor/LLVMReactorDebugInfo.cpp b/src/Reactor/LLVMReactorDebugInfo.cpp index 0cf4723..f36f9c9 100644 --- a/src/Reactor/LLVMReactorDebugInfo.cpp +++ b/src/Reactor/LLVMReactorDebugInfo.cpp
@@ -521,7 +521,7 @@ return it->second.get(); } - auto tokens = std::unique_ptr<LineTokens>(new LineTokens()); + auto tokens = std::make_unique<LineTokens>(); std::ifstream file(path); std::string line;