Skip to content

[llvm][DebugInfo] Use formatv in GsymReaderV1 and GsymReaderV2#192000

Merged
kwk merged 1 commit intollvm:mainfrom
kwk:format-18
Apr 16, 2026
Merged

[llvm][DebugInfo] Use formatv in GsymReaderV1 and GsymReaderV2#192000
kwk merged 1 commit intollvm:mainfrom
kwk:format-18

Conversation

@kwk
Copy link
Copy Markdown
Contributor

@kwk kwk commented Apr 14, 2026

This relates to #35980.

Here are all independent PRs that deal with replacing format with formatv in llvm/lib/DebugInfo:

@llvmbot
Copy link
Copy Markdown
Member

llvmbot commented Apr 14, 2026

@llvm/pr-subscribers-debuginfo

Author: Konrad Kleine (kwk)

Changes

This relates to #35980.


Full diff: https://github.com/llvm/llvm-project/pull/192000.diff

1 Files Affected:

  • (modified) llvm/lib/DebugInfo/GSYM/GsymReader.cpp (+4-3)
diff --git a/llvm/lib/DebugInfo/GSYM/GsymReader.cpp b/llvm/lib/DebugInfo/GSYM/GsymReader.cpp
index 0a5bb7caaee8c..1a20bd6310e7f 100644
--- a/llvm/lib/DebugInfo/GSYM/GsymReader.cpp
+++ b/llvm/lib/DebugInfo/GSYM/GsymReader.cpp
@@ -17,6 +17,7 @@
 #include "llvm/DebugInfo/GSYM/LineTable.h"
 #include "llvm/Support/BinaryStreamReader.h"
 #include "llvm/Support/DataExtractor.h"
+#include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/MemoryBuffer.h"
 
 using namespace llvm;
@@ -398,7 +399,7 @@ void GsymReader::dump(raw_ostream &OS) {
   OS << " (ADDRESS)\n";
   OS << "====== =============================== \n";
   for (uint32_t I = 0; I < Header.NumAddresses; ++I) {
-    OS << format("[%4u] ", I);
+    OS << formatv("[{0,4}] ", I);
     switch (Hdr->AddrOffSize) {
     case 1: OS << HEX8(getAddrOffsets<uint8_t>()[I]); break;
     case 2: OS << HEX16(getAddrOffsets<uint16_t>()[I]); break;
@@ -413,13 +414,13 @@ void GsymReader::dump(raw_ostream &OS) {
   OS << "INDEX  Offset\n";
   OS << "====== ==========\n";
   for (uint32_t I = 0; I < Header.NumAddresses; ++I)
-    OS << format("[%4u] ", I) << HEX32(AddrInfoOffsets[I]) << "\n";
+    OS << formatv("[{0,4}] ", I) << HEX32(AddrInfoOffsets[I]) << "\n";
   // Dump the file table.
   OS << "\nFiles:\n";
   OS << "INDEX  DIRECTORY  BASENAME   PATH\n";
   OS << "====== ========== ========== ==============================\n";
   for (uint32_t I = 0; I < Files.size(); ++I) {
-    OS << format("[%4u] ", I) << HEX32(Files[I].Dir) << ' '
+    OS << formatv("[{0,4}] ", I) << HEX32(Files[I].Dir) << ' '
        << HEX32(Files[I].Base) << ' ';
     dump(OS, getFile(I));
     OS << "\n";

This was referenced Apr 14, 2026
Comment thread llvm/lib/DebugInfo/GSYM/GsymReader.cpp Outdated
@DavidSpickett DavidSpickett changed the title [llvm][DebugInfo] formatv in GsymReader [llvm][DebugInfo] Use formatv in GsymReader Apr 15, 2026
@kwk
Copy link
Copy Markdown
Contributor Author

kwk commented Apr 16, 2026

@s-barannikov do you approve this PR? If it is enough that David approved, I'm fine to merge it. After resolving the conflict of course.

Copy link
Copy Markdown
Contributor

@s-barannikov s-barannikov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, assuming conflict resolution doesn't change it significantly.

@kwk
Copy link
Copy Markdown
Contributor Author

kwk commented Apr 16, 2026

LGTM, assuming conflict resolution doesn't change it significantly.

It is not significantly different but the code was reorganized and split into V1 and V2 in c365068. I'm running local tests to see if the newly pushed code works.

UPDATE: ninja check-llvm worked fine locally.

@kwk kwk changed the title [llvm][DebugInfo] Use formatv in GsymReader [llvm][DebugInfo] Use formatv in GsymReaderV1 and GsymReaderV2 Apr 16, 2026
@kwk kwk merged commit d60b2b2 into llvm:main Apr 16, 2026
10 checks passed
@kwk kwk deleted the format-18 branch April 16, 2026 08:25
alexfh pushed a commit to alexfh/llvm-project that referenced this pull request Apr 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants