[flang-commits] [flang] 0a8d5f4 - [flang] Use std::make_unique (NFC) (#97238)
via flang-commits
flang-commits at lists.llvm.org
Mon Jul 1 14:41:09 PDT 2024
Author: Kazu Hirata
Date: 2024-07-01T14:41:06-07:00
New Revision: 0a8d5f4e599fca394610a690e026c0460fc43270
URL: https://github.com/llvm/llvm-project/commit/0a8d5f4e599fca394610a690e026c0460fc43270
DIFF: https://github.com/llvm/llvm-project/commit/0a8d5f4e599fca394610a690e026c0460fc43270.diff
LOG: [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.
Added:
Modified:
flang/lib/Optimizer/Builder/TemporaryStorage.cpp
Removed:
################################################################################
diff --git a/flang/lib/Optimizer/Builder/TemporaryStorage.cpp b/flang/lib/Optimizer/Builder/TemporaryStorage.cpp
index d34dad52c28b0..4c59574dd433a 100644
--- a/flang/lib/Optimizer/Builder/TemporaryStorage.cpp
+++ b/flang/lib/Optimizer/Builder/TemporaryStorage.cpp
@@ -305,8 +305,7 @@ fir::factory::AnyVectorSubscriptStack::AnyVectorSubscriptStack(
mlir::Type variableStaticType, bool shapeCanBeSavedAsRegister, int rank)
: AnyVariableStack{loc, builder, variableStaticType} {
if (shapeCanBeSavedAsRegister) {
- shapeTemp =
- std::unique_ptr<TemporaryStorage>(new TemporaryStorage{SSARegister{}});
+ shapeTemp = std::make_unique<TemporaryStorage>(SSARegister{});
return;
}
// The shape will be tracked as the dimension inside a descriptor because
@@ -315,8 +314,8 @@ fir::factory::AnyVectorSubscriptStack::AnyVectorSubscriptStack(
mlir::Type type =
fir::BoxType::get(builder.getVarLenSeqTy(builder.getI32Type(), rank));
boxType = type;
- shapeTemp = std::unique_ptr<TemporaryStorage>(
- new TemporaryStorage{AnyVariableStack{loc, builder, type}});
+ shapeTemp =
+ std::make_unique<TemporaryStorage>(AnyVariableStack{loc, builder, type});
}
void fir::factory::AnyVectorSubscriptStack::pushShape(
More information about the flang-commits
mailing list