This is an archive of the discontinued LLVM Phabricator instance.

[llvm-debuginfod][NFC] Switch to OptTable
ClosedPublic

Authored by avillega on May 23 2023, 5:11 PM.

Diff Detail

Event Timeline

avillega created this revision.May 23 2023, 5:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 23 2023, 5:11 PM
avillega requested review of this revision.May 23 2023, 5:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 23 2023, 5:11 PM
avillega retitled this revision from [llvm-debuginfod] Switch to OptTable to [llvm-debuginfod] Switch cl to OptTable.May 23 2023, 5:15 PM
avillega added reviewers: phosek, mysterymath.
mysterymath accepted this revision.May 24 2023, 3:13 PM
mysterymath added inline comments.
llvm/tools/llvm-debuginfod/llvm-debuginfod.cpp
81–85

This should actually check that the integer is nonnegative, and the name should reflect this (NonNegInt?)

This revision is now accepted and ready to land.May 24 2023, 3:13 PM
avillega added inline comments.May 24 2023, 3:47 PM
llvm/tools/llvm-debuginfod/llvm-debuginfod.cpp
81–85

What are your thoughts on me changing the types of the Options to also be non-negative types. in this case ScanInterval and MaxConcurrency will become unsigned and usize_t respectivelly, which will catch the error of passing non-negative integers at parse time.

mysterymath added inline comments.May 24 2023, 4:24 PM
llvm/tools/llvm-debuginfod/llvm-debuginfod.cpp
81–85

Hmm, actually if this is intended to be a NFC change (oh, which should probably have the [NFC] commit label, as a nit-pick), it would probably be better to just change the error message to ": expected an integer...".

avillega updated this revision to Diff 525870.May 25 2023, 4:30 PM
avillega retitled this revision from [llvm-debuginfod] Switch cl to OptTable to [llvm-debuginfod][NFC] Switch to OptTable.

Review comments

avillega marked 2 inline comments as done.May 25 2023, 4:31 PM

Comments done

It would also be nice to update the bazel build. Technically we (because we don't work in google3) aren't required to keep the bazel build clean, though Google LLVM integrators will often see a commit was broken by a @ google.com address and ask that you fix it.

In these cases, it might not be immediately obvious to the integrator how to fix this issues so it would certainly be courteous to fix it before landing. You can opt to join the bazel-build group https://reviews.llvm.org/project/profile/107/ which will add precommit checks to ensure the bazel build built cleanly.

Though feel free to ignore

llvm/tools/llvm-debuginfod/CMakeLists.txt
13

@mysterymath I do not have commit access yet, as the reviewer, if you think everything is ready to go could you please commit it for me? Thanks

It would also be nice to update the bazel build. Technically we (because we don't work in google3) aren't required to keep the bazel build clean, though Google LLVM integrators will often see a commit was broken by a @ google.com address and ask that you fix it.

In these cases, it might not be immediately obvious to the integrator how to fix this issues so it would certainly be courteous to fix it before landing. You can opt to join the bazel-build group https://reviews.llvm.org/project/profile/107/ which will add precommit checks to ensure the bazel build built cleanly.

Though feel free to ignore

I couldn't find usages of llvm-debuginfod in the bazel files, I am assuming we currently do not build llvm-debuginfod with bazel given that it is not part of the default targets.

llvm/tools/llvm-debuginfod/CMakeLists.txt
13

You are very right, I copy pasted it from another

avillega updated this revision to Diff 525878.May 25 2023, 4:45 PM

Fix review comments

avillega marked an inline comment as done.May 25 2023, 4:46 PM
This revision was landed with ongoing or failed builds.May 26 2023, 2:43 PM
This revision was automatically updated to reflect the committed changes.
mgorny added a subscriber: mgorny.May 27 2023, 12:34 AM

This is causing a build failure for me, using gcc-13 on 32-bit x86:

samu: job failed: /usr/lib/ccache/bin/x86_64-pc-linux-gnu-g++ -m32 -mfpmath=sse -DCPPHTTPLIB_OPENSSL_SUPPORT -DCPPHTTPLIB_ZLIB_SUPPORT 
-D_DEBUG -D_FILE_OFFSET_BITS=64 -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_LIBCPP_ENABLE_ASSERTIONS -D__STDC_CONSTANT_M
ACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/var/tmp/portage/sys-devel/llvm-17.0.0_pre20230527/work/llvm_build-abi_x86_32.x86/
tools/llvm-debuginfod -I/var/tmp/portage/sys-devel/llvm-17.0.0_pre20230527/work/llvm/tools/llvm-debuginfod -I/var/tmp/portage/sys-devel
/llvm-17.0.0_pre20230527/work/llvm_build-abi_x86_32.x86/include -I/var/tmp/portage/sys-devel/llvm-17.0.0_pre20230527/work/llvm/include 
 -march=znver2 --param=l1-cache-size=32 --param=l1-cache-line-size=64 -O2 -pipe -frecord-gcc-switches -fPIC -fno-semantic-interposition
 -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-m
issing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-
move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wc
tad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -std=c++17 -UNDEBUG -MD -MT tools/llvm-debuginfod/CMakeFi
les/llvm-debuginfod.dir/llvm-debuginfod.cpp.o -MF tools/llvm-debuginfod/CMakeFiles/llvm-debuginfod.dir/llvm-debuginfod.cpp.o.d -o tools
/llvm-debuginfod/CMakeFiles/llvm-debuginfod.dir/llvm-debuginfod.cpp.o -c /var/tmp/portage/sys-devel/llvm-17.0.0_pre20230527/work/llvm/t
ools/llvm-debuginfod/llvm-debuginfod.cpp
/var/tmp/portage/sys-devel/llvm-17.0.0_pre20230527/work/llvm/tools/llvm-debuginfod/llvm-debuginfod.cpp: In function ‘void parseArgs(int
, char**)’:
/var/tmp/portage/sys-devel/llvm-17.0.0_pre20230527/work/llvm/tools/llvm-debuginfod/llvm-debuginfod.cpp:113:14: error: no matching funct
ion for call to ‘parseIntArg(llvm::opt::InputArgList&, {anonymous}::ID, size_t&, long unsigned int)’
  113 |   parseIntArg(Args, OPT_max_concurrency, MaxConcurrency, 0ul);
      |   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/sys-devel/llvm-17.0.0_pre20230527/work/llvm/tools/llvm-debuginfod/llvm-debuginfod.cpp:77:13: note: candidate: ‘templat
e<class T> void parseIntArg(const llvm::opt::InputArgList&, int, T&, T)’
   77 | static void parseIntArg(const opt::InputArgList &Args, int ID, T &Value,
      |             ^~~~~~~~~~~
/var/tmp/portage/sys-devel/llvm-17.0.0_pre20230527/work/llvm/tools/llvm-debuginfod/llvm-debuginfod.cpp:77:13: note:   template argument deduction/substitution failed:
/var/tmp/portage/sys-devel/llvm-17.0.0_pre20230527/work/llvm/tools/llvm-debuginfod/llvm-debuginfod.cpp:113:14: note:   deduced conflicting types for parameter ‘T’ (‘unsigned int’ and ‘long unsigned int’)
  113 |   parseIntArg(Args, OPT_max_concurrency, MaxConcurrency, 0ul);
      |   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
samu: subcommand failed
thakis added a subscriber: thakis.May 27 2023, 3:26 PM

This breaks building on windows: http://45.33.8.238/win/79161/step_4.txt

Please take a look and revert for now if it takes a while to fix.

This breaks building on windows: http://45.33.8.238/win/79161/step_4.txt

Please take a look and revert for now if it takes a while to fix.

I want to revert it but I don't have commit access, if you do have commit access could you please revert on my behalf? Thanks!

avillega reopened this revision.May 30 2023, 3:48 PM
This revision is now accepted and ready to land.May 30 2023, 3:48 PM
avillega updated this revision to Diff 526829.May 30 2023, 3:49 PM

This is a reland of https://reviews.llvm.org/D151273 which
had to be reverted because size_t type is implementation
dependant and the original change was assuming unsigned long
for the default value of one the command line arguments.

avillega added inline comments.May 30 2023, 3:50 PM
llvm/tools/llvm-debuginfod/llvm-debuginfod.cpp
113

In the previous version, this was using 0ul as the default value which was breaking some targets.

This revision was landed with ongoing or failed builds.May 30 2023, 4:04 PM
This revision was automatically updated to reflect the committed changes.