From ce3b687b88e5b33a47546274d2471dffceda9a6c Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sun, 31 Jul 2022 15:17:05 -0700 Subject: [PATCH] [BOLT] Remove redundaunt string initialization (NFC) Identified with readability-redundant-string-init. --- bolt/lib/Profile/YAMLProfileWriter.cpp | 2 +- bolt/lib/Rewrite/DWARFRewriter.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bolt/lib/Profile/YAMLProfileWriter.cpp b/bolt/lib/Profile/YAMLProfileWriter.cpp index bf00a087b213..03f3ac36f373 100644 --- a/bolt/lib/Profile/YAMLProfileWriter.cpp +++ b/bolt/lib/Profile/YAMLProfileWriter.cpp @@ -160,7 +160,7 @@ std::error_code YAMLProfileWriter::writeProfile(const RewriteInstance &RI) { StringSet<> EventNames = RI.getProfileReader()->getEventNames(); if (!EventNames.empty()) { - std::string Sep = ""; + std::string Sep; for (const StringMapEntry &EventEntry : EventNames) { BP.Header.EventNames += Sep + EventEntry.first().str(); Sep = ","; diff --git a/bolt/lib/Rewrite/DWARFRewriter.cpp b/bolt/lib/Rewrite/DWARFRewriter.cpp index eff1ffa0353d..ceb1cdfad8ff 100644 --- a/bolt/lib/Rewrite/DWARFRewriter.cpp +++ b/bolt/lib/Rewrite/DWARFRewriter.cpp @@ -235,7 +235,7 @@ void DWARFRewriter::updateDebugInfo() { (void)AttrInfoVal; assert(AttrInfoVal && "Skeleton CU doesn't have dwo_name."); - std::string ObjectName = ""; + std::string ObjectName; { std::lock_guard Lock(AccessMutex); @@ -1436,7 +1436,7 @@ void DWARFRewriter::writeDWP( TUContributionVector TUContributionsToCU; for (const SectionRef &Section : DWOFile->sections()) { std::string DWOTUSection; - std::string Storage = ""; + std::string Storage; std::unique_ptr OutputData; StringRef SectionName = getSectionName(Section); Expected ContentsExp = Section.getContents(); @@ -1593,7 +1593,7 @@ void DWARFRewriter::writeDWOFiles( // Handling .debug_rnglists.dwo seperatly. The original .o/.dwo might not // have .debug_rnglists so won't be part of the loop below. if (!RangeListssWriter->empty()) { - std::string Storage = ""; + std::string Storage; std::unique_ptr OutputData; if (Optional OutData = updateDebugData( (*DWOCU)->getContext(), Storage, "debug_rnglists.dwo", "", @@ -1605,7 +1605,7 @@ void DWARFRewriter::writeDWOFiles( TUContributionVector TUContributionsToCU; for (const SectionRef &Section : File->sections()) { - std::string Storage = ""; + std::string Storage; std::string DWOTUSection; std::unique_ptr OutputData; StringRef SectionName = getSectionName(Section);