This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Replace std::once_flag with llvm::once_flag.
ClosedPublic

Authored by davide on Aug 21 2019, 4:35 PM.

Details

Summary

The former seems like it's not working on some platforms.
All the other uses use llvm::, so, let's change for consistency.

Diff Detail

Repository
rL LLVM

Event Timeline

davide created this revision.Aug 21 2019, 4:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 21 2019, 4:35 PM

I and Jason discussed this offline and he's fine with it, so, I'm going to land this now.

This revision was not accepted when it landed; it landed in state Needs Review.Aug 21 2019, 8:17 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 21 2019, 8:17 PM
mgorny added a subscriber: mgorny.Sep 2 2019, 10:55 AM

This broke NetBSD buildbot: http://lab.llvm.org:8011/builders/netbsd-amd64/builds/21974

FAILED: tools/lldb/source/Target/CMakeFiles/lldbTarget.dir/Process.cpp.o 
/usr/bin/g++  -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -DLIBXML2_DEFINED -DLLDB_CONFIGURATION_RELEASE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/lldb/source/Target -I/home/motus/netbsd8/netbsd8/llvm/tools/lldb/source/Target -Itools/lldb/source -I/home/motus/netbsd8/netbsd8/llvm/tools/lldb/include -Itools/lldb/include -Iinclude -I/home/motus/netbsd8/netbsd8/llvm/include -I/usr/pkg/include/python2.7 -I/home/motus/netbsd8/netbsd8/llvm/tools/clang/include -Itools/lldb/../clang/include -I/usr/pkg/include/libxml2 -I/home/motus/netbsd8/netbsd8/llvm/tools/lldb/source/. -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++14 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-deprecated-register -Wno-vla-extension -O3 -DNDEBUG    -fno-exceptions -fno-rtti -MD -MT tools/lldb/source/Target/CMakeFiles/lldbTarget.dir/Process.cpp.o -MF tools/lldb/source/Target/CMakeFiles/lldbTarget.dir/Process.cpp.o.d -o tools/lldb/source/Target/CMakeFiles/lldbTarget.dir/Process.cpp.o -c /home/motus/netbsd8/netbsd8/llvm/tools/lldb/source/Target/Process.cpp
/home/motus/netbsd8/netbsd8/llvm/tools/lldb/source/Target/Process.cpp: In member function 'lldb_private::UtilityFunction* lldb_private::Process::GetLoadImageUtilityFunction(lldb_private::Platform*, llvm::function_ref<std::unique_ptr<lldb_private::UtilityFunction>()>)':
/home/motus/netbsd8/netbsd8/llvm/tools/lldb/source/Target/Process.cpp:5969:63: error: no matching function for call to 'call_once(llvm::once_flag&, lldb_private::Process::GetLoadImageUtilityFunction(lldb_private::Platform*, llvm::function_ref<std::unique_ptr<lldb_private::UtilityFunction>()>)::<lambda()>)'
                  [&] { m_dlopen_utility_func_up = factory(); });
                                                               ^
In file included from /home/motus/netbsd8/netbsd8/llvm/tools/lldb/source/Target/Process.cpp:11:0:
/usr/include/g++/mutex:723:5: note: candidate: template<class _Callable, class ... _Args> void std::call_once(std::once_flag&, _Callable&&, _Args&& ...)
     call_once(once_flag& __once, _Callable&& __f, _Args&&... __args)
     ^
/usr/include/g++/mutex:723:5: note:   template argument deduction/substitution failed:
/home/motus/netbsd8/netbsd8/llvm/tools/lldb/source/Target/Process.cpp:5968:18: note:   cannot convert '((lldb_private::Process*)this)->lldb_private::Process::m_dlopen_utility_func_flag_once' (type 'llvm::once_flag') to type 'std::once_flag&'
   std::call_once(m_dlopen_utility_func_flag_once,
                  ^
/home/motus/netbsd8/netbsd8/llvm/tools/lldb/source/Target/Process.cpp: In member function 'void lldb_private::Process::PrintWarning(__uint64_t, const void*, const char*, ...)':
/home/motus/netbsd8/netbsd8/llvm/tools/lldb/source/Target/Process.cpp:5687:24: warning: second parameter of 'va_start' not last named argument [-Wvarargs]
     va_start(args, fmt);
                        ^
mgorny added a comment.Sep 2 2019, 9:58 PM

Unless I'm mistaken, this is fixed by replacing std::call_once with llvm::call_once. I'll complete testing and commit it later today.

krytarowski added a subscriber: krytarowski.EditedSep 3 2019, 4:51 AM

This breaks NetBSD as it shall be paired with llvm::call_once.