[llvm] Gsymutil aggregation similar to DwarfDump --verify (PR #81154)

Kevin Frei via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 12 09:36:30 PST 2024


================
@@ -596,29 +612,26 @@ Error DwarfTransformer::convert(uint32_t NumThreads, raw_ostream *OS) {
       DWARFDie Die = getDie(*CU);
       if (Die) {
         CUInfo CUI(DICtx, dyn_cast<DWARFCompileUnit>(CU.get()));
-        pool.async([this, CUI, &LogMutex, OS, Die]() mutable {
-          std::string ThreadLogStorage;
-          raw_string_ostream ThreadOS(ThreadLogStorage);
-          handleDie(OS ? &ThreadOS: nullptr, CUI, Die);
-          ThreadOS.flush();
-          if (OS && !ThreadLogStorage.empty()) {
-            // Print ThreadLogStorage lines into an actual stream under a lock
-            std::lock_guard<std::mutex> guard(LogMutex);
-            *OS << ThreadLogStorage;
-          }
+        pool.async([this, CUI, &LogMutex, Out, Die]() mutable {
+          StringAggregator ThreadOut(Out.IsShowingDetail());
+          handleDie(ThreadOut, CUI, Die);
+          // Print ThreadLogStorage lines into an actual stream under a lock
+          std::lock_guard<std::mutex> guard(LogMutex);
+          Out.Merge(ThreadOut);
         });
       }
     }
     pool.wait();
   }
   size_t FunctionsAddedCount = Gsym.getNumFunctionInfos() - NumBefore;
-  if (OS)
-    *OS << "Loaded " << FunctionsAddedCount << " functions from DWARF.\n";
+  if (Out.IsShowingDetail())
----------------
kevinfrei wrote:

👍 

https://github.com/llvm/llvm-project/pull/81154


More information about the llvm-commits mailing list