[llvm] [Debuginfo] add debuginfod factory method (PR #154633)

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 29 14:11:56 PDT 2025


zeroomega wrote:

> We are seeing build failures from debuginfod after this patch is landed. We believe this patch is the culprit:
> 
> It changed the constructor of DebuginfodServer and introduced a new factory method `create`. The error is in the new create method, which returns a DebuginfodServer object directly, instead of an Expected object.
> 
> Error message:
> 
> ```
> [4475/4877](226) Building CXX object lib/Debuginfod/CMakeFiles/LLVMDebuginfod.dir/Debuginfod.cpp.o
> FAILED: lib/Debuginfod/CMakeFiles/LLVMDebuginfod.dir/Debuginfod.cpp.o 
> /b/s/w/ir/x/w/rc/cxx-rbeprg_jlfd/reclient-cxx-wrapper.sh /b/s/w/ir/x/w/cipd/bin/clang++ --sysroot=/b/s/w/ir/x/w/cipd/linux -DCPPHTTPLIB_ZLIB_SUPPORT -DCURL_STATICLIB -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/b/s/w/ir/x/w/llvm_build/lib/Debuginfod -I/b/s/w/ir/x/w/llvm-llvm-project/llvm/lib/Debuginfod -I/b/s/w/ir/x/w/rc/tensorflow-venv/store/python_venv-nacb1phkpgklqiq46g3ivnt518/contents/lib/python3.8/site-packages/tensorflow/include -I/b/s/w/ir/x/w/llvm_build/include -I/b/s/w/ir/x/w/llvm-llvm-project/llvm/include -isystem /b/s/w/ir/x/w/install-curl-x86_64-linux-gnu/include -isystem /b/s/w/ir/x/w/install-boringssl-x86_64-linux-gnu/include -isystem /b/s/w/ir/x/w/install-zlib-x86_64-linux-gnu/include -isystem /b/s/w/ir/x/w/install-cpp-httplib-x86_64-linux-gnu/include -isystem /b/s/w/ir/x/w/install-zstd-x86_64-linux-gnu/include -stdlib=libc++ -fPIC -fno-semantic-interposition -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 -Wno-comment -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -ffat-lto-objects -ffile-prefix-map=/b/s/w/ir/x/w/llvm_build=../llvm-llvm-project -ffile-prefix-map=/b/s/w/ir/x/w/llvm-llvm-project/= -no-canonical-prefixes -O3 -DNDEBUG -std=c++17 -fvisibility=default  -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -UNDEBUG -MD -MT lib/Debuginfod/CMakeFiles/LLVMDebuginfod.dir/Debuginfod.cpp.o -MF lib/Debuginfod/CMakeFiles/LLVMDebuginfod.dir/Debuginfod.cpp.o.d -o lib/Debuginfod/CMakeFiles/LLVMDebuginfod.dir/Debuginfod.cpp.o -c /b/s/w/ir/x/w/llvm-llvm-project/llvm/lib/Debuginfod/Debuginfod.cpp
> /b/s/w/ir/x/w/llvm-llvm-project/llvm/lib/Debuginfod/Debuginfod.cpp:622:10: error: no viable conversion from returned value of type '__libcpp_remove_reference_t<llvm::DebuginfodServer &>' (aka 'llvm::DebuginfodServer') to function return type 'Expected<DebuginfodServer>'
>   622 |   return std::move(Serverd);
>       |          ^~~~~~~~~~~~~~~~~~
> /b/s/w/ir/x/w/llvm-llvm-project/llvm/include/llvm/Support/Error.h:485:40: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from '__libcpp_remove_reference_t<llvm::DebuginfodServer &>' (aka 'llvm::DebuginfodServer') to 'const Expected<llvm::DebuginfodServer> &' for 1st argument
>   485 | template <class T> class [[nodiscard]] Expected {
>       |                                        ^~~~~~~~
> /b/s/w/ir/x/w/llvm-llvm-project/llvm/include/llvm/Support/Error.h:507:3: note: candidate constructor not viable: no known conversion from '__libcpp_remove_reference_t<llvm::DebuginfodServer &>' (aka 'llvm::DebuginfodServer') to 'Error &&' for 1st argument
>   507 |   Expected(Error &&Err)
>       |   ^        ~~~~~~~~~~~
> /b/s/w/ir/x/w/llvm-llvm-project/llvm/include/llvm/Support/Error.h:521:3: note: candidate constructor not viable: no known conversion from '__libcpp_remove_reference_t<llvm::DebuginfodServer &>' (aka 'llvm::DebuginfodServer') to 'ErrorSuccess' for 1st argument
>   521 |   Expected(ErrorSuccess) = delete;
>       |   ^        ~~~~~~~~~~~~
> /b/s/w/ir/x/w/llvm-llvm-project/llvm/include/llvm/Support/Error.h:539:3: note: candidate constructor not viable: no known conversion from '__libcpp_remove_reference_t<llvm::DebuginfodServer &>' (aka 'llvm::DebuginfodServer') to 'Expected<llvm::DebuginfodServer> &&' for 1st argument
>   539 |   Expected(Expected &&Other) { moveConstruct(std::move(Other)); }
>       |   ^        ~~~~~~~~~~~~~~~~
> /b/s/w/ir/x/w/llvm-llvm-project/llvm/include/llvm/Support/Error.h:526:3: note: candidate template ignored: requirement 'std::is_convertible_v<llvm::DebuginfodServer, llvm::DebuginfodServer>' was not satisfied [with OtherT = __libcpp_remove_reference_t<llvm::DebuginfodServer &>]
>   526 |   Expected(OtherT &&Val,
>       |   ^
> /b/s/w/ir/x/w/llvm-llvm-project/llvm/include/llvm/Support/Error.h:544:3: note: candidate template ignored: could not match 'Expected<OtherT>' against '__libcpp_remove_reference_t<llvm::DebuginfodServer &>' (aka 'llvm::DebuginfodServer')
>   544 |   Expected(Expected<OtherT> &&Other,
>       |   ^
> /b/s/w/ir/x/w/llvm-llvm-project/llvm/include/llvm/Support/Error.h:552:12: note: explicit constructor is not a candidate
>   552 |   explicit Expected(
>       |            ^
> 1 error generated.
> ```
> 
> Failed build task: https://ci.chromium.org/ui/p/fuchsia/builders/toolchain.ci/clang-host-linux-x64/b8705178398451644929/overview
> 
> I will revert the change. Please correct the issue and reland your change later.

The issue is that HTTPServer class will not have a move ctor when httplib is not used. In that case, Expected<DebuginfodServer>(DebuginfodServer&&) ctor will fail as DebuginfodServer will also not have a move ctor. Fixing forward in https://github.com/llvm/llvm-project/pull/156107

https://github.com/llvm/llvm-project/pull/154633


More information about the llvm-commits mailing list