[PATCH] D146492: Add new printNumber() for size_t

Junhee Yoo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 21 00:14:52 PDT 2023


junhee-yoo added a comment.

@paulkirth thanks for your kind reply.

I've checked `static_cast<uint64_t>` is worked, but few more lines need to be applied.

  --- 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);
     }

I'm not sure the reason why it reproduced on my labtop - I'd also tried for clean build - but it happens everytimes.
I also saw the build error log on CI/CD <https://buildkite.com/llvm-project/premerge-checks/builds/142201#01870203-5f60-4d28-9725-de71189023db> and it seems that the compiler of CI/CD treats `size_t` as `uint64_t`.
And I found that there is `-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk` on the compile command.

Please let me try to build this again only within llvm at 14.

PS. Sorry to make your mailbox massy with my summary editing.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146492/new/

https://reviews.llvm.org/D146492



More information about the llvm-commits mailing list