[llvm][DebugInfo] Use formatv in DWARFAcceleratorTable#191981
Conversation
This relates to llvm#35980.
|
@llvm/pr-subscribers-debuginfo Author: Konrad Kleine (kwk) ChangesThis relates to #35980. Full diff: https://github.com/llvm/llvm-project/pull/191981.diff 1 Files Affected:
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
index e442b5182f6a4..d37e75d46551c 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
@@ -32,7 +32,7 @@ static raw_ostream &operator<<(raw_ostream &OS, const Atom &A) {
StringRef Str = dwarf::AtomTypeString(A.Value);
if (!Str.empty())
return OS << Str;
- return OS << "DW_ATOM_unknown_" << format("%x", A.Value);
+ return OS << "DW_ATOM_unknown_" << formatv("{0:x-}", A.Value);
}
} // namespace
@@ -185,7 +185,7 @@ bool AppleAcceleratorTable::dumpName(ScopedPrinter &W,
return false; // End of list
DictScope NameScope(W, ("Name@0x" + Twine::utohexstr(NameOffset)).str());
- W.startLine() << format("String: 0x%08" PRIx64, StringOffset);
+ W.startLine() << formatv("String: {0:x8}", StringOffset);
W.getOStream() << " \"" << StringSection.getCStr(&StringOffset) << "\"\n";
unsigned NumData = AccelSection.getU32(DataOffset);
@@ -193,7 +193,7 @@ bool AppleAcceleratorTable::dumpName(ScopedPrinter &W,
ListScope DataScope(W, ("Data " + Twine(Data)).str());
unsigned i = 0;
for (auto &Atom : AtomForms) {
- W.startLine() << format("Atom[%d]: ", i);
+ W.startLine() << formatv("Atom[{0}]: ", i);
if (Atom.extractValue(AccelSection, DataOffset, FormParams)) {
Atom.dump(W.getOStream());
if (std::optional<uint64_t> Val = Atom.getAsUnsignedConstant()) {
@@ -859,7 +859,7 @@ void DWARFDebugNames::NameIndex::dumpName(ScopedPrinter &W,
if (Hash)
W.printHex("Hash", *Hash);
- W.startLine() << format("String: 0x%08" PRIx64, NTE.getStringOffset());
+ W.startLine() << formatv("String: {0:x8}", NTE.getStringOffset());
W.getOStream() << " \"" << NTE.getString() << "\"\n";
uint64_t EntryOffset = NTE.getEntryOffset();
@@ -870,7 +870,7 @@ void DWARFDebugNames::NameIndex::dumpName(ScopedPrinter &W,
void DWARFDebugNames::NameIndex::dumpCUs(ScopedPrinter &W) const {
ListScope CUScope(W, "Compilation Unit offsets");
for (uint32_t CU = 0; CU < Hdr.CompUnitCount; ++CU)
- W.startLine() << format("CU[%u]: 0x%08" PRIx64 "\n", CU, getCUOffset(CU));
+ W.startLine() << formatv("CU[{0}]: {1:x8}\n", CU, getCUOffset(CU));
}
void DWARFDebugNames::NameIndex::dumpLocalTUs(ScopedPrinter &W) const {
@@ -879,8 +879,8 @@ void DWARFDebugNames::NameIndex::dumpLocalTUs(ScopedPrinter &W) const {
ListScope TUScope(W, "Local Type Unit offsets");
for (uint32_t TU = 0; TU < Hdr.LocalTypeUnitCount; ++TU)
- W.startLine() << format("LocalTU[%u]: 0x%08" PRIx64 "\n", TU,
- getLocalTUOffset(TU));
+ W.startLine() << formatv("LocalTU[{0}]: {1:x8}\n", TU,
+ getLocalTUOffset(TU));
}
void DWARFDebugNames::NameIndex::dumpForeignTUs(ScopedPrinter &W) const {
@@ -889,8 +889,8 @@ void DWARFDebugNames::NameIndex::dumpForeignTUs(ScopedPrinter &W) const {
ListScope TUScope(W, "Foreign Type Unit signatures");
for (uint32_t TU = 0; TU < Hdr.ForeignTypeUnitCount; ++TU) {
- W.startLine() << format("ForeignTU[%u]: 0x%016" PRIx64 "\n", TU,
- getForeignTUSignature(TU));
+ W.startLine() << formatv("ForeignTU[{0}]: {1:x16}\n", TU,
+ getForeignTUSignature(TU));
}
}
|
|
General comment: Add "use" to all the titles "Use formatv in ...." |
DavidSpickett
left a comment
There was a problem hiding this comment.
LGTM
Please land without the list of PRs in the description (GitHub will give you a chance to edit it before landing).
|
Also [spread out landing these by a bit. A few at a time is ok and then give it maybe an hour for the bots to pick it up. 64-bit builds will likely be fine but I have a feeling some of these specifiers and casts might have been masking poor choices. So you might get reports from the Arm 32-bit bots. |
@DavidSpickett I'm sorry I've only seen this comment now. I'm going to change the remaining PRs accordingly. |
This relates to #35980.
Here are all independent PRs that deal with replacing
formatwithformatvinllvm/lib/DebugInfo: