[BOLT] Remove redundaunt string initialization (NFC)
authorKazu Hirata <kazu@google.com>
Sun, 31 Jul 2022 22:17:05 +0000 (15:17 -0700)
committerKazu Hirata <kazu@google.com>
Sun, 31 Jul 2022 22:17:05 +0000 (15:17 -0700)
Identified with readability-redundant-string-init.

bolt/lib/Profile/YAMLProfileWriter.cpp
bolt/lib/Rewrite/DWARFRewriter.cpp

index bf00a08..03f3ac3 100644 (file)
@@ -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<NoneType> &EventEntry : EventNames) {
       BP.Header.EventNames += Sep + EventEntry.first().str();
       Sep = ",";
index eff1ffa..ceb1cdf 100644 (file)
@@ -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<std::mutex> 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<DebugBufferVector> OutputData;
       StringRef SectionName = getSectionName(Section);
       Expected<StringRef> 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<DebugBufferVector> OutputData;
         if (Optional<StringRef> 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<DebugBufferVector> OutputData;
       StringRef SectionName = getSectionName(Section);