[llvm] 064e249 - [llvm-readobj] Fix ambiguous call of printNumber in ELFDumper.cpp (NFC)
Jie Fu via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 20 19:36:55 PDT 2023
Author: Jie Fu
Date: 2023-03-21T10:36:46+08:00
New Revision: 064e2497e2ebe9ac30ac96923a26a52484300fdf
URL: https://github.com/llvm/llvm-project/commit/064e2497e2ebe9ac30ac96923a26a52484300fdf
DIFF: https://github.com/llvm/llvm-project/commit/064e2497e2ebe9ac30ac96923a26a52484300fdf.diff
LOG: [llvm-readobj] Fix ambiguous call of printNumber in ELFDumper.cpp (NFC)
/Users/jiefu/llvm-project/llvm/tools/llvm-readobj/ELFDumper.cpp:7175:5: error: call to member function 'printNumber' is ambiguous
W.printNumber("TotalBuckets", NBucket);
~~^~~~~~~~~~~
/Users/jiefu/llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:201:16: note: candidate function
virtual void printNumber(StringRef Label, uint64_t Value) {
^
/Users/jiefu/llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:205:16: note: candidate function
virtual void printNumber(StringRef Label, uint32_t Value) {
^
/Users/jiefu/llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:209:16: note: candidate function
virtual void printNumber(StringRef Label, uint16_t Value) {
^
/Users/jiefu/llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:213:16: note: candidate function
virtual void printNumber(StringRef Label, uint8_t Value) {
^
/Users/jiefu/llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:217:16: note: candidate function
virtual void printNumber(StringRef Label, int64_t Value) {
^
/Users/jiefu/llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:221:16: note: candidate function
virtual void printNumber(StringRef Label, int32_t Value) {
^
/Users/jiefu/llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:225:16: note: candidate function
virtual void printNumber(StringRef Label, int16_t Value) {
^
/Users/jiefu/llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:229:16: note: candidate function
virtual void printNumber(StringRef Label, int8_t Value) {
^
/Users/jiefu/llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:237:16: note: candidate function
virtual void printNumber(StringRef Label, float Value) {
^
/Users/jiefu/llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:241:16: note: candidate function
virtual void printNumber(StringRef Label, double Value) {
^
Added:
Modified:
llvm/tools/llvm-readobj/ELFDumper.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp
index 3f1f226d1fe4a..0298e8dce50ed 100644
--- a/llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -7172,14 +7172,14 @@ void LLVMELFDumper<ELFT>::printHashHistogramStats(size_t NBucket,
StringRef BucketName = IsGnu ? "Bucket" : "Chain";
StringRef ListName = IsGnu ? "Buckets" : "Chains";
DictScope Outer(W, HistName);
- W.printNumber("TotalBuckets", NBucket);
+ W.printNumber("TotalBuckets", static_cast<uint64_t>(NBucket));
ListScope Buckets(W, ListName);
size_t CumulativeNonZero = 0;
for (size_t I = 0; I < MaxChain; ++I) {
CumulativeNonZero += Count[I] * I;
DictScope Bucket(W, BucketName);
- W.printNumber("Length", I);
- W.printNumber("Count", Count[I]);
+ W.printNumber("Length", static_cast<uint64_t>(I));
+ W.printNumber("Count", static_cast<uint64_t>(Count[I]));
W.printNumber("Percentage", (float)(Count[I] * 100.0) / NBucket);
W.printNumber("Coverage", (float)(CumulativeNonZero * 100.0) / TotalSyms);
}
More information about the llvm-commits
mailing list