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

Junhee Yoo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 20 20:59:32 PDT 2023


junhee-yoo added a comment.

After https://reviews.llvm.org/D137096, I faced compile error:

>   /llvm-project/llvm/tools/llvm-readobj/ELFDumper.cpp:7182:7: error: call to member function 'printNumber' is ambiguous
>       W.printNumber("Count", Count[I]);
>       ~~^~~~~~~~~~~
>                  ^
>   12 errors generated

which was occurred by absence of "printNumber(StringRef Label, size_t Value)".
To fix this, I just added that one.

Env:
OS: macOS 13.2.1 (22D68)
LLVM version: 14.0.6 (from homebrew)

Build command:

CMake:

> cmake -DLLVM_TARGETS_TO_BUILD="AArch64" -DCMAKE_BUILD_TYPE=Debug -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_BUILD_EXAMPLES=ON -DLLVM_ENABLE_PROJECTS=mlir -G Ninja ../llvm

Compile command:

> /opt/homebrew/opt/llvm at 14/bin/clang++ -DBUILD_EXAMPLES -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_LIBCPP_ENABLE_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I<path-to>/llvm-project/build/tools/llvm-readobj -I<path-to>/llvm-project/llvm/tools/llvm-readobj -I<path-to>/llvm-project/build/include -I<path-to>/llvm-project/llvm/include -isystem /opt/homebrew/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk  -fno-exceptions -funwind-tables -fno-rtti -std=c++17 -MD -MT tools/llvm-readobj/CMakeFiles/llvm-readobj.dir/ELFDumper.cpp.o -MF tools/llvm-readobj/CMakeFiles/llvm-readobj.dir/ELFDumper.cpp.o.d -o tools/llvm-readobj/CMakeFiles/llvm-readobj.dir/ELFDumper.cpp.o -c <path-to>/llvm-project/llvm/tools/llvm-readobj/ELFDumper.cpp



- hide some information with `<path-to>`

Full compile error message:

> /llvm-project/llvm/tools/llvm-readobj/ELFDumper.cpp:7182:7: error: call to member function 'printNumber' is ambiguous
>
>   W.printNumber("Count", Count[I]);
>   ~~^~~~~~~~~~~
>
> /llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:201:16: note: candidate function
>
>   virtual void printNumber(StringRef Label, uint64_t Value) {
>                ^
>
> /llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:205:16: note: candidate function
>
>   virtual void printNumber(StringRef Label, uint32_t Value) {
>                ^
>
> /llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:209:16: note: candidate function
>
>   virtual void printNumber(StringRef Label, uint16_t Value) {
>                ^
>
> /llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:213:16: note: candidate function
>
>   virtual void printNumber(StringRef Label, uint8_t Value) {
>                ^
>
> /llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:217:16: note: candidate function
>
>   virtual void printNumber(StringRef Label, int64_t Value) {
>                ^
>
> /llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:221:16: note: candidate function
>
>   virtual void printNumber(StringRef Label, int32_t Value) {
>                ^
>
> /llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:225:16: note: candidate function
>
>   virtual void printNumber(StringRef Label, int16_t Value) {
>                ^
>
> /llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:229:16: note: candidate function
>
>   virtual void printNumber(StringRef Label, int8_t Value) {
>                ^
>
> /llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:237:16: note: candidate function
>
>   virtual void printNumber(StringRef Label, float Value) {
>                ^
>
> /llvm-project/llvm/include/llvm/Support/ScopedPrinter.h:241:16: note: candidate function
>
>     virtual void printNumber(StringRef Label, double Value) {
>                  ^
>   12 errors generated.
>   [3837/4064] Building CXX object tools/llvm-reduce/CMakeFiles/llvm-reduce.dir/ReducerWorkItem.cpp.o
>   ninja: build stopped: subcommand failed.


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