Skip to content

Commit 0a8d5f4

Browse files
[flang] Use std::make_unique (NFC) (#97238)
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 8f7887a commit 0a8d5f4

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

flang/lib/Optimizer/Builder/TemporaryStorage.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,7 @@ fir::factory::AnyVectorSubscriptStack::AnyVectorSubscriptStack(
305305
mlir::Type variableStaticType, bool shapeCanBeSavedAsRegister, int rank)
306306
: AnyVariableStack{loc, builder, variableStaticType} {
307307
if (shapeCanBeSavedAsRegister) {
308-
shapeTemp =
309-
std::unique_ptr<TemporaryStorage>(new TemporaryStorage{SSARegister{}});
308+
shapeTemp = std::make_unique<TemporaryStorage>(SSARegister{});
310309
return;
311310
}
312311
// The shape will be tracked as the dimension inside a descriptor because
@@ -315,8 +314,8 @@ fir::factory::AnyVectorSubscriptStack::AnyVectorSubscriptStack(
315314
mlir::Type type =
316315
fir::BoxType::get(builder.getVarLenSeqTy(builder.getI32Type(), rank));
317316
boxType = type;
318-
shapeTemp = std::unique_ptr<TemporaryStorage>(
319-
new TemporaryStorage{AnyVariableStack{loc, builder, type}});
317+
shapeTemp =
318+
std::make_unique<TemporaryStorage>(AnyVariableStack{loc, builder, type});
320319
}
321320

322321
void fir::factory::AnyVectorSubscriptStack::pushShape(

0 commit comments

Comments
 (0)