[flang-commits] [flang] a8c294d - [flang] Remove redundant string initialization (NFC)
Kazu Hirata via flang-commits
flang-commits at lists.llvm.org
Sun Aug 14 12:52:17 PDT 2022
Author: Kazu Hirata
Date: 2022-08-14T12:52:01-07:00
New Revision: a8c294d6aae340afba9347ef3d41fbb7a9ab51be
URL: https://github.com/llvm/llvm-project/commit/a8c294d6aae340afba9347ef3d41fbb7a9ab51be
DIFF: https://github.com/llvm/llvm-project/commit/a8c294d6aae340afba9347ef3d41fbb7a9ab51be.diff
LOG: [flang] Remove redundant string initialization (NFC)
Identified with readability-redundant-string-init.
Added:
Modified:
flang/examples/FlangOmpReport/FlangOmpReportVisitor.h
flang/lib/Lower/Mangler.cpp
flang/lib/Optimizer/Support/InternalNames.cpp
flang/lib/Semantics/tools.cpp
Removed:
################################################################################
diff --git a/flang/examples/FlangOmpReport/FlangOmpReportVisitor.h b/flang/examples/FlangOmpReport/FlangOmpReportVisitor.h
index d31fa8cc46896..188a7e9b87764 100644
--- a/flang/examples/FlangOmpReport/FlangOmpReportVisitor.h
+++ b/flang/examples/FlangOmpReport/FlangOmpReportVisitor.h
@@ -80,7 +80,7 @@ struct OpenMPCounterVisitor {
void Post(const OmpClause &c);
void PostClauseCommon(const ClauseInfo &ci);
- std::string clauseDetails{""};
+ std::string clauseDetails;
llvm::SmallVector<LogRecord> constructClauses;
llvm::SmallVector<OmpWrapperType *> ompWrapperStack;
llvm::DenseMap<OmpWrapperType *, llvm::SmallVector<ClauseInfo>> clauseStrings;
diff --git a/flang/lib/Lower/Mangler.cpp b/flang/lib/Lower/Mangler.cpp
index d6b85184e3a5e..3f90910bc3893 100644
--- a/flang/lib/Lower/Mangler.cpp
+++ b/flang/lib/Lower/Mangler.cpp
@@ -222,7 +222,7 @@ std::string Fortran::lower::mangle::mangleArrayLiteral(
const Fortran::evaluate::ConstantSubscripts &shape,
Fortran::common::TypeCategory cat, int kind,
Fortran::common::ConstantSubscript charLen) {
- std::string typeId = "";
+ std::string typeId;
for (Fortran::evaluate::ConstantSubscript extent : shape)
typeId.append(std::to_string(extent)).append("x");
if (charLen >= 0)
diff --git a/flang/lib/Optimizer/Support/InternalNames.cpp b/flang/lib/Optimizer/Support/InternalNames.cpp
index 19a2740a51a88..b1cedb068a383 100644
--- a/flang/lib/Optimizer/Support/InternalNames.cpp
+++ b/flang/lib/Optimizer/Support/InternalNames.cpp
@@ -329,7 +329,7 @@ static std::string
mangleTypeDescriptorKinds(llvm::ArrayRef<std::int64_t> kinds) {
if (kinds.empty())
return "";
- std::string result = "";
+ std::string result;
for (std::int64_t kind : kinds)
result += "." + std::to_string(kind);
return result;
diff --git a/flang/lib/Semantics/tools.cpp b/flang/lib/Semantics/tools.cpp
index d5eaed819c765..b97744049996d 100644
--- a/flang/lib/Semantics/tools.cpp
+++ b/flang/lib/Semantics/tools.cpp
@@ -1294,7 +1294,7 @@ template <ComponentKind componentKind>
std::string
ComponentIterator<componentKind>::const_iterator::BuildResultDesignatorName()
const {
- std::string designator{""};
+ std::string designator;
for (const auto &node : componentPath_) {
designator += "%" + DEREF(node.component()).name().ToString();
}
More information about the flang-commits
mailing list