Skip to content

Commit eb5dbaf

Browse files
[clang] Use std::make_unique (NFC) (#97176)
This patch is based on clang-tidy's modernize-make-unique but limited to those cases where type names are mentioned twice like `std::unique_ptr<Type>(new Type())`, which is a bit mouthful.
1 parent bc6d925 commit eb5dbaf

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

clang/lib/CodeGen/CGCoroutine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static void createCoroData(CodeGenFunction &CGF,
103103
return;
104104
}
105105

106-
CurCoro.Data = std::unique_ptr<CGCoroData>(new CGCoroData);
106+
CurCoro.Data = std::make_unique<CGCoroData>();
107107
CurCoro.Data->CoroId = CoroId;
108108
CurCoro.Data->CoroIdExpr = CoroIdExpr;
109109
}

clang/lib/Interpreter/CodeCompletion.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,7 @@ void ReplCodeCompleter::codeComplete(CompilerInstance *InterpCI,
368368
llvm::SmallVector<const llvm::MemoryBuffer *, 1> tb = {};
369369
InterpCI->getFrontendOpts().Inputs[0] = FrontendInputFile(
370370
CodeCompletionFileName, Language::CXX, InputKind::Source);
371-
auto Act = std::unique_ptr<IncrementalSyntaxOnlyAction>(
372-
new IncrementalSyntaxOnlyAction(ParentCI));
371+
auto Act = std::make_unique<IncrementalSyntaxOnlyAction>(ParentCI);
373372
std::unique_ptr<llvm::MemoryBuffer> MB =
374373
llvm::MemoryBuffer::getMemBufferCopy(Content, CodeCompletionFileName);
375374
llvm::SmallVector<ASTUnit::RemappedFile, 4> RemappedFiles;

0 commit comments

Comments
 (0)