Skip to content

Commit 8cfca52

Browse files
[SandboxIR] Use std::make_unique (NFC)
With std::make_unique, we don't have to mention the type twice. Identified with modernize-make-unique.
1 parent 7a64855 commit 8cfca52

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

llvm/lib/SandboxIR/Context.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -295,20 +295,17 @@ Value *Context::getOrCreateValueInternal(llvm::Value *LLVMV, llvm::User *U) {
295295
}
296296
case llvm::Instruction::CatchSwitch: {
297297
auto *LLVMCatchSwitchInst = cast<llvm::CatchSwitchInst>(LLVMV);
298-
It->second = std::unique_ptr<CatchSwitchInst>(
299-
new CatchSwitchInst(LLVMCatchSwitchInst, *this));
298+
It->second = std::make_unique<CatchSwitchInst>(LLVMCatchSwitchInst, *this);
300299
return It->second.get();
301300
}
302301
case llvm::Instruction::Resume: {
303302
auto *LLVMResumeInst = cast<llvm::ResumeInst>(LLVMV);
304-
It->second =
305-
std::unique_ptr<ResumeInst>(new ResumeInst(LLVMResumeInst, *this));
303+
It->second = std::make_unique<ResumeInst>(LLVMResumeInst, *this);
306304
return It->second.get();
307305
}
308306
case llvm::Instruction::Switch: {
309307
auto *LLVMSwitchInst = cast<llvm::SwitchInst>(LLVMV);
310-
It->second =
311-
std::unique_ptr<SwitchInst>(new SwitchInst(LLVMSwitchInst, *this));
308+
It->second = std::make_unique<SwitchInst>(LLVMSwitchInst, *this);
312309
return It->second.get();
313310
}
314311
case llvm::Instruction::FNeg: {
@@ -549,15 +546,15 @@ Context::createGetElementPtrInst(llvm::GetElementPtrInst *I) {
549546
return cast<GetElementPtrInst>(registerValue(std::move(NewPtr)));
550547
}
551548
CatchSwitchInst *Context::createCatchSwitchInst(llvm::CatchSwitchInst *I) {
552-
auto NewPtr = std::unique_ptr<CatchSwitchInst>(new CatchSwitchInst(I, *this));
549+
auto NewPtr = std::make_unique<CatchSwitchInst>(I, *this);
553550
return cast<CatchSwitchInst>(registerValue(std::move(NewPtr)));
554551
}
555552
ResumeInst *Context::createResumeInst(llvm::ResumeInst *I) {
556-
auto NewPtr = std::unique_ptr<ResumeInst>(new ResumeInst(I, *this));
553+
auto NewPtr = std::make_unique<ResumeInst>(I, *this);
557554
return cast<ResumeInst>(registerValue(std::move(NewPtr)));
558555
}
559556
SwitchInst *Context::createSwitchInst(llvm::SwitchInst *I) {
560-
auto NewPtr = std::unique_ptr<SwitchInst>(new SwitchInst(I, *this));
557+
auto NewPtr = std::make_unique<SwitchInst>(I, *this);
561558
return cast<SwitchInst>(registerValue(std::move(NewPtr)));
562559
}
563560
UnaryOperator *Context::createUnaryOperator(llvm::UnaryOperator *I) {

0 commit comments

Comments
 (0)