Page MenuHomePhabricator

Move to C++14
ClosedPublic

Authored by jfb on Tue, Aug 13, 10:16 PM.

Details

Summary

I just bumped the minimum compiler versions to support C++14 in D66188.

Following our process and our previous agreement, I'm now officially bumping the C++ version to 14 and updating the documentation.

Diff Detail

Repository
rL LLVM

Event Timeline

jfb created this revision.Tue, Aug 13, 10:16 PM
chandlerc accepted this revision.Tue, Aug 13, 10:26 PM

This too LGTM, and again, thanks for driving this all the way through.

This revision is now accepted and ready to land.Tue, Aug 13, 10:26 PM
hans added a subscriber: hans.Wed, Aug 14, 5:37 AM

Perhaps add a note in docs/ReleaseNotes.rst as well?

jfb added a comment.Wed, Aug 14, 7:54 AM

Perhaps add a note in docs/ReleaseNotes.rst as well?

I can, but that seems odd: aren’t release notes for users of LLVM, not developers? In other words, what would someone reading this note take away from it, and do based on reading it?

xbolva00 added inline comments.
llvm/cmake/modules/HandleLLVMOptions.cmake
24 ↗(On Diff #215025)

Useless handling of C++1Y?

All compilers have to support C++14 now.

hans added a comment.Wed, Aug 14, 9:30 AM
In D66195#1629329, @jfb wrote:

Perhaps add a note in docs/ReleaseNotes.rst as well?

I can, but that seems odd: aren’t release notes for users of LLVM, not developers? In other words, what would someone reading this note take away from it, and do based on reading it?

I think the releases are also used by folks doing various kinds of out-of-tree LLVM stuff, and this change might let them use C++14 in their code by default. But yeah, not a huge deal maybe.

Closed by commit rL368887: Move to C++14 (authored by jfb, committed by ). · Explain WhyWed, Aug 14, 10:38 AM
This revision was automatically updated to reflect the committed changes.
jfb marked 2 inline comments as done.Wed, Aug 14, 10:56 AM
jfb added inline comments.
llvm/cmake/modules/HandleLLVMOptions.cmake
24 ↗(On Diff #215025)

r368890

In D66195#1629329, @jfb wrote:

Perhaps add a note in docs/ReleaseNotes.rst as well?

I can, but that seems odd: aren’t release notes for users of LLVM, not developers? In other words, what would someone reading this note take away from it, and do based on reading it?

I think the releases are also used by folks doing various kinds of out-of-tree LLVM stuff, and this change might let them use C++14 in their code by default.

I agree with Hans that there should be an LLVM release note. Another action for an LLVM user (who, to be clear, is a developer of an LLVM-based compiler) would be to update their host toolchain before trying to migrate to the newer LLVM version.

dexonsmith added inline comments.Wed, Aug 14, 6:46 PM
llvm/trunk/include/llvm/Support/type_traits.h
195–199

It seems like we don't need LLVM_IS_FINAL anymore, given that #if defined(__cplusplus) looks like it would always be true for this header. At least we can remove the #if guard.

It looks like building with gcc 5.1 (the new minimum) is broken after this change, while it worked fine previously:

/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/bin/g++  -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/lld/ELF -I/b/s/w/ir/cache/builder/src/third_party/llvm/lld/ELF -I/b/s/w/ir/cache/builder/src/third_party/llvm/lld/include -Itools/lld/include -I/usr/include/libxml2 -Iinclude -I/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include -DLLVM_FORCE_HEAD_REVISION -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 -O3    -UNDEBUG  -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -MD -MT tools/lld/ELF/CMakeFiles/lldELF.dir/LinkerScript.cpp.o -MF tools/lld/ELF/CMakeFiles/lldELF.dir/LinkerScript.cpp.o.d -o tools/lld/ELF/CMakeFiles/lldELF.dir/LinkerScript.cpp.o -c /b/s/w/ir/cache/builder/src/third_party/llvm/lld/ELF/LinkerScript.cpp
In file included from /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/stl_algobase.h:71:0,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/memory:62,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/Optional.h:22,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/STLExtras.h:19,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/StringRef.h:12,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/StringMap.h:16,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/Support/Host.h:16,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/Hashing.h:48,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/lld/include/lld/Common/LLVM.h:19,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/lld/include/lld/Common/ErrorHandler.h:71,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/lld/ELF/Config.h:12,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/lld/ELF/LinkerScript.h:12,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/lld/ELF/LinkerScript.cpp:13:
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/predefined_ops.h: In instantiation of ‘constexpr bool __gnu_cxx::__ops::_Iter_comp_iter<_Compare>::operator()(_Iterator1, _Iterator2) [with _Iterator1 = lld::elf::InputSectionBase*; _Iterator2 = lld::elf::InputSectionBase*; _Compare = std::function<bool(lld::elf::InputSectionBase*, lld::elf::InputSectionBase*)>]’:
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/functional:1982:6:   required by substitution of ‘template<class _Res, class ... _ArgTypes> template<class _Functor> using _Invoke = decltype (std::__callable_functor(declval<_Functor&>())((declval<_ArgTypes>)()...)) [with _Functor = __gnu_cxx::__ops::_Iter_comp_iter<std::function<bool(lld::elf::InputSectionBase*, lld::elf::InputSectionBase*)> >; _Res = bool; _ArgTypes = {lld::elf::InputSectionBase*, lld::elf::InputSectionBase*}]’
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/functional:1992:56:   required by substitution of ‘template<class _Res, class ... _ArgTypes> template<class _Functor> using _Callable = std::__and_<std::function<_Res(_ArgTypes ...)>::_NotSelf<_Functor>, std::__check_func_return_type<std::function<_Res(_ArgTypes ...)>::_Invoke<_Functor>, _Res> > [with _Functor = __gnu_cxx::__ops::_Iter_comp_iter<std::function<bool(lld::elf::InputSectionBase*, lld::elf::InputSectionBase*)> >; _Res = bool; _ArgTypes = {lld::elf::InputSectionBase*, lld::elf::InputSectionBase*}]’
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/functional:2057:9:   required by substitution of ‘template<class _Functor, class> std::function<_Res(_ArgTypes ...)>::function(_Functor) [with _Functor = __gnu_cxx::__ops::_Iter_comp_iter<std::function<bool(lld::elf::InputSectionBase*, lld::elf::InputSectionBase*)> >; <template-parameter-1-2> = <missing>]’
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/predefined_ops.h:130:46:   required from ‘constexpr __gnu_cxx::__ops::_Iter_comp_iter<_Compare> __gnu_cxx::__ops::__iter_comp_iter(_Compare) [with _Compare = std::function<bool(lld::elf::InputSectionBase*, lld::elf::InputSectionBase*)>]’
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/stl_algo.h:4933:43:   required from ‘void std::stable_sort(_RAIter, _RAIter, _Compare) [with _RAIter = lld::elf::InputSection**; _Compare = std::function<bool(lld::elf::InputSectionBase*, lld::elf::InputSectionBase*)>]’
/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/STLExtras.h:1322:19:   required from ‘void llvm::stable_sort(R&&, Compare) [with R = llvm::MutableArrayRef<lld::elf::InputSection*>&; Compare = std::function<bool(lld::elf::InputSectionBase*, lld::elf::InputSectionBase*)>]’
/b/s/w/ir/cache/builder/src/third_party/llvm/lld/ELF/LinkerScript.cpp:347:44:   required from here
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/predefined_ops.h:123:46: error: no match for call to ‘(std::function<bool(lld::elf::InputSectionBase*, lld::elf::InputSectionBase*)>) (lld::elf::InputSectionBase&, lld::elf::InputSectionBase&)’
         { return bool(_M_comp(*__it1, *__it2)); }
                                              ^
In file included from /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/memory:79:0,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/Optional.h:22,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/STLExtras.h:19,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/StringRef.h:12,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/StringMap.h:16,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/Support/Host.h:16,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/Hashing.h:48,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/lld/include/lld/Common/LLVM.h:19,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/lld/include/lld/Common/ErrorHandler.h:71,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/lld/ELF/Config.h:12,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/lld/ELF/LinkerScript.h:12,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/lld/ELF/LinkerScript.cpp:13:
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/functional:2266:5: note: candidate: _Res std::function<_Res(_ArgTypes ...)>::operator()(_ArgTypes ...) const [with _Res = bool; _ArgTypes = {lld::elf::InputSectionBase*, lld::elf::InputSectionBase*}]
     function<_Res(_ArgTypes...)>::
     ^
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/functional:2266:5: note:   no known conversion for argument 1 from ‘lld::elf::InputSectionBase’ to ‘lld::elf::InputSectionBase*’

Has anyone seen this before? Any known workarounds?

jfb marked 3 inline comments as done.Thu, Aug 15, 9:32 AM
In D66195#1629329, @jfb wrote:

Perhaps add a note in docs/ReleaseNotes.rst as well?

I can, but that seems odd: aren’t release notes for users of LLVM, not developers? In other words, what would someone reading this note take away from it, and do based on reading it?

I think the releases are also used by folks doing various kinds of out-of-tree LLVM stuff, and this change might let them use C++14 in their code by default.

I agree with Hans that there should be an LLVM release note. Another action for an LLVM user (who, to be clear, is a developer of an LLVM-based compiler) would be to update their host toolchain before trying to migrate to the newer LLVM version.

Our process already handles this:

Once the RFC reaches consensus, update the CMake toolchain version checks as well as the getting started guide. We want to soft-error when developers compile LLVM. We say “soft-error” because the error can be turned into a warning using a CMake flag. This is an important step: LLVM still doesn’t have code which requires the new toolchains, but it soon will. If you compile LLVM but don’t read the mailing list, we should tell you!

So it's the soft-error that tells developers what to do, not release notes. I can certainly add something, but it doesn't seem to be the right audience. If we do want something in the release notes, I think we should amend the process document to say so, and it should be done when we change the toolchain requirements, not when we change the language version.

llvm/trunk/include/llvm/Support/type_traits.h
195–199

I did it separately yesterday, see llvm.org/r368910
I wanted to keep this change small... and it still had some explosions :)

jfb marked an inline comment as done.EditedThu, Aug 15, 9:33 AM

Ugh that's an ugly one...

/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/STLExtras.h:1322:19:   required from ‘void llvm::stable_sort(R&&, Compare) [with R = llvm::MutableArrayRef<lld::elf::InputSection*>&; Compare = std::function<bool(lld::elf::InputSectionBase*, lld::elf::InputSectionBase*)>]’
/b/s/w/ir/cache/builder/src/third_party/llvm/lld/ELF/LinkerScript.cpp:347:44:   required from here
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/predefined_ops.h:123:46: error: no match for call to ‘(std::function<bool(lld::elf::InputSectionBase*, lld::elf::InputSectionBase*)>) (lld::elf::InputSectionBase&, lld::elf::InputSectionBase&)’

Looks like we do the following:

template <typename R, typename Compare>
void stable_sort(R &&Range, Compare C) {
  std::stable_sort(adl_begin(Range), adl_end(Range), C);
}

static void sortSections(MutableArrayRef<InputSection *> vec,
                         SortSectionPolicy k) {
  if (k != SortSectionPolicy::Default && k != SortSectionPolicy::None)
    llvm::stable_sort(vec, getComparator(k));
}

static std::function<bool(InputSectionBase *, InputSectionBase *)>
getComparator(SortSectionPolicy k) {
  switch (k) {
  case SortSectionPolicy::Alignment:
    return [](InputSectionBase *a, InputSectionBase *b) {
      // ">" is not a mistake. Sections with larger alignments are placed
      // before sections with smaller alignments in order to reduce the
      // amount of padding necessary. This is compatible with GNU.
      return a->alignment > b->alignment;
    };
  case SortSectionPolicy::Name:
    return [](InputSectionBase *a, InputSectionBase *b) {
      return a->name < b->name;
    };
  case SortSectionPolicy::Priority:
    return [](InputSectionBase *a, InputSectionBase *b) {
      return getPriority(a->name) < getPriority(b->name);
    };
  default:
    llvm_unreachable("unknown sort policy");
  }
}

Has anyone seen this before? Any known workarounds?

I haven't seen it before... taking a look now.

jfb added a comment.Thu, Aug 15, 10:00 AM
In D66195#1631746, @jfb wrote:

Ugh that's an ugly one...

/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/STLExtras.h:1322:19:   required from ‘void llvm::stable_sort(R&&, Compare) [with R = llvm::MutableArrayRef<lld::elf::InputSection*>&; Compare = std::function<bool(lld::elf::InputSectionBase*, lld::elf::InputSectionBase*)>]’
/b/s/w/ir/cache/builder/src/third_party/llvm/lld/ELF/LinkerScript.cpp:347:44:   required from here
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/predefined_ops.h:123:46: error: no match for call to ‘(std::function<bool(lld::elf::InputSectionBase*, lld::elf::InputSectionBase*)>) (lld::elf::InputSectionBase&, lld::elf::InputSectionBase&)’

Looks like we do the following:

template <typename R, typename Compare>
void stable_sort(R &&Range, Compare C) {
  std::stable_sort(adl_begin(Range), adl_end(Range), C);
}

static void sortSections(MutableArrayRef<InputSection *> vec,
                         SortSectionPolicy k) {
  if (k != SortSectionPolicy::Default && k != SortSectionPolicy::None)
    llvm::stable_sort(vec, getComparator(k));
}

static std::function<bool(InputSectionBase *, InputSectionBase *)>
getComparator(SortSectionPolicy k) {
  switch (k) {
  case SortSectionPolicy::Alignment:
    return [](InputSectionBase *a, InputSectionBase *b) {
      // ">" is not a mistake. Sections with larger alignments are placed
      // before sections with smaller alignments in order to reduce the
      // amount of padding necessary. This is compatible with GNU.
      return a->alignment > b->alignment;
    };
  case SortSectionPolicy::Name:
    return [](InputSectionBase *a, InputSectionBase *b) {
      return a->name < b->name;
    };
  case SortSectionPolicy::Priority:
    return [](InputSectionBase *a, InputSectionBase *b) {
      return getPriority(a->name) < getPriority(b->name);
    };
  default:
    llvm_unreachable("unknown sort policy");
  }
}

Has anyone seen this before? Any known workarounds?

I haven't seen it before... taking a look now.

I have a repro, will try to figure out a workaround. It's fixed in 5.2. Talking to Jonathan Wakely we'd probably be better off on 5.5, but that'll be a separate discussion.

jfb added a comment.Thu, Aug 15, 10:12 AM

I have a repro, will try to figure out a workaround. It's fixed in 5.2. Talking to Jonathan Wakely we'd probably be better off on 5.5, but that'll be a separate discussion.

I have a fix. Building and testing... Will send a patch soon.

jfb added a comment.Thu, Aug 15, 10:25 AM
In D66195#1631797, @jfb wrote:

I have a repro, will try to figure out a workaround. It's fixed in 5.2. Talking to Jonathan Wakely we'd probably be better off on 5.5, but that'll be a separate discussion.

I have a fix. Building and testing... Will send a patch soon.

https://reviews.llvm.org/D66306

Thanks, that helped! Next one (build step 3810/3982, so hopefully not too much left after this):

FAILED: tools/llvm-nm/CMakeFiles/llvm-nm.dir/llvm-nm.cpp.o 
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/bin/g++  -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/llvm-nm -I/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/tools/llvm-nm -I/usr/include/libxml2 -Iinclude -I/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include -DLLVM_FORCE_HEAD_REVISION -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 -O3    -UNDEBUG  -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -MD -MT tools/llvm-nm/CMakeFiles/llvm-nm.dir/llvm-nm.cpp.o -MF tools/llvm-nm/CMakeFiles/llvm-nm.dir/llvm-nm.cpp.o.d -o tools/llvm-nm/CMakeFiles/llvm-nm.dir/llvm-nm.cpp.o -c /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/tools/llvm-nm/llvm-nm.cpp
In file included from /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/stl_algobase.h:71:0,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/memory:62,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/Optional.h:22,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/STLExtras.h:19,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/StringRef.h:12,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/StringSwitch.h:15,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/tools/llvm-nm/llvm-nm.cpp:18:
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/predefined_ops.h: In instantiation of ‘constexpr bool __gnu_cxx::__ops::_Iter_comp_iter<_Compare>::operator()(_Iterator1, _Iterator2) [with _Iterator1 = {anonymous}::NMSymbol; _Iterator2 = {anonymous}::NMSymbol; _Compare = std::function<bool(const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&)>]’:
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/functional:1982:6:   required by substitution of ‘template<class _Res, class ... _ArgTypes> template<class _Functor> using _Invoke = decltype (std::__callable_functor(declval<_Functor&>())((declval<_ArgTypes>)()...)) [with _Functor = __gnu_cxx::__ops::_Iter_comp_iter<std::function<bool(const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&)> >; _Res = bool; _ArgTypes = {const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&}]’
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/functional:1992:56:   required by substitution of ‘template<class _Res, class ... _ArgTypes> template<class _Functor> using _Callable = std::__and_<std::function<_Res(_ArgTypes ...)>::_NotSelf<_Functor>, std::__check_func_return_type<std::function<_Res(_ArgTypes ...)>::_Invoke<_Functor>, _Res> > [with _Functor = __gnu_cxx::__ops::_Iter_comp_iter<std::function<bool(const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&)> >; _Res = bool; _ArgTypes = {const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&}]’
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/functional:2057:9:   required by substitution of ‘template<class _Functor, class> std::function<_Res(_ArgTypes ...)>::function(_Functor) [with _Functor = __gnu_cxx::__ops::_Iter_comp_iter<std::function<bool(const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&)> >; <template-parameter-1-2> = <missing>]’
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/predefined_ops.h:130:46:   required from ‘constexpr __gnu_cxx::__ops::_Iter_comp_iter<_Compare> __gnu_cxx::__ops::__iter_comp_iter(_Compare) [with _Compare = std::function<bool(const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&)>]’
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/stl_algo.h:4729:70:   required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator<{anonymous}::NMSymbol*, std::vector<{anonymous}::NMSymbol> >; _Compare = std::function<bool(const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&)>]’
/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/STLExtras.h:1125:12:   required from ‘void llvm::sort(IteratorTy, IteratorTy, Compare) [with IteratorTy = __gnu_cxx::__normal_iterator<{anonymous}::NMSymbol*, std::vector<{anonymous}::NMSymbol> >; Compare = std::function<bool(const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&)>]’
/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/STLExtras.h:1130:13:   required from ‘void llvm::sort(Container&&, Compare) [with Container = std::vector<{anonymous}::NMSymbol>&; Compare = std::function<bool(const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&)>]’
/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/tools/llvm-nm/llvm-nm.cpp:724:31:   required from here
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/predefined_ops.h:123:31: error: no match for ‘operator*’ (operand type is ‘{anonymous}::NMSymbol’)
         { return bool(_M_comp(*__it1, *__it2)); }
                               ^
In file included from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APFloat.h:19:0,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/IR/Type.h:17,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/IR/DerivedTypes.h:23,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/IR/Function.h:29,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/tools/llvm-nm/llvm-nm.cpp:21:
/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APInt.h:2097:14: note: candidate: llvm::APInt llvm::operator*(llvm::APInt, uint64_t)
 inline APInt operator*(APInt a, uint64_t RHS) {
              ^
/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APInt.h:2097:14: note:   candidate expects 2 arguments, 1 provided
/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APInt.h:2102:14: note: candidate: llvm::APInt llvm::operator*(uint64_t, llvm::APInt)
 inline APInt operator*(uint64_t LHS, APInt b) {
              ^
/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APInt.h:2102:14: note:   candidate expects 2 arguments, 1 provided
In file included from /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/stl_algobase.h:71:0,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/memory:62,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/Optional.h:22,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/STLExtras.h:19,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/StringRef.h:12,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/StringSwitch.h:15,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/tools/llvm-nm/llvm-nm.cpp:18:
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/predefined_ops.h:123:39: error: no match for ‘operator*’ (operand type is ‘{anonymous}::NMSymbol’)
         { return bool(_M_comp(*__it1, *__it2)); }
                                       ^
In file included from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APFloat.h:19:0,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/IR/Type.h:17,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/IR/DerivedTypes.h:23,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/IR/Function.h:29,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/tools/llvm-nm/llvm-nm.cpp:21:
/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APInt.h:2097:14: note: candidate: llvm::APInt llvm::operator*(llvm::APInt, uint64_t)
 inline APInt operator*(APInt a, uint64_t RHS) {
              ^
/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APInt.h:2097:14: note:   candidate expects 2 arguments, 1 provided
/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APInt.h:2102:14: note: candidate: llvm::APInt llvm::operator*(uint64_t, llvm::APInt)
 inline APInt operator*(uint64_t LHS, APInt b) {
              ^
/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APInt.h:2102:14: note:   candidate expects 2 arguments, 1 provided
jfb added a comment.Thu, Aug 15, 1:17 PM

Thanks, that helped! Next one (build step 3810/3982, so hopefully not too much left after this):

FAILED: tools/llvm-nm/CMakeFiles/llvm-nm.dir/llvm-nm.cpp.o 
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/bin/g++  -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/llvm-nm -I/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/tools/llvm-nm -I/usr/include/libxml2 -Iinclude -I/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include -DLLVM_FORCE_HEAD_REVISION -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 -O3    -UNDEBUG  -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -MD -MT tools/llvm-nm/CMakeFiles/llvm-nm.dir/llvm-nm.cpp.o -MF tools/llvm-nm/CMakeFiles/llvm-nm.dir/llvm-nm.cpp.o.d -o tools/llvm-nm/CMakeFiles/llvm-nm.dir/llvm-nm.cpp.o -c /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/tools/llvm-nm/llvm-nm.cpp
In file included from /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/stl_algobase.h:71:0,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/memory:62,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/Optional.h:22,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/STLExtras.h:19,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/StringRef.h:12,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/StringSwitch.h:15,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/tools/llvm-nm/llvm-nm.cpp:18:
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/predefined_ops.h: In instantiation of ‘constexpr bool __gnu_cxx::__ops::_Iter_comp_iter<_Compare>::operator()(_Iterator1, _Iterator2) [with _Iterator1 = {anonymous}::NMSymbol; _Iterator2 = {anonymous}::NMSymbol; _Compare = std::function<bool(const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&)>]’:
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/functional:1982:6:   required by substitution of ‘template<class _Res, class ... _ArgTypes> template<class _Functor> using _Invoke = decltype (std::__callable_functor(declval<_Functor&>())((declval<_ArgTypes>)()...)) [with _Functor = __gnu_cxx::__ops::_Iter_comp_iter<std::function<bool(const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&)> >; _Res = bool; _ArgTypes = {const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&}]’
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/functional:1992:56:   required by substitution of ‘template<class _Res, class ... _ArgTypes> template<class _Functor> using _Callable = std::__and_<std::function<_Res(_ArgTypes ...)>::_NotSelf<_Functor>, std::__check_func_return_type<std::function<_Res(_ArgTypes ...)>::_Invoke<_Functor>, _Res> > [with _Functor = __gnu_cxx::__ops::_Iter_comp_iter<std::function<bool(const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&)> >; _Res = bool; _ArgTypes = {const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&}]’
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/functional:2057:9:   required by substitution of ‘template<class _Functor, class> std::function<_Res(_ArgTypes ...)>::function(_Functor) [with _Functor = __gnu_cxx::__ops::_Iter_comp_iter<std::function<bool(const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&)> >; <template-parameter-1-2> = <missing>]’
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/predefined_ops.h:130:46:   required from ‘constexpr __gnu_cxx::__ops::_Iter_comp_iter<_Compare> __gnu_cxx::__ops::__iter_comp_iter(_Compare) [with _Compare = std::function<bool(const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&)>]’
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/stl_algo.h:4729:70:   required from ‘void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator<{anonymous}::NMSymbol*, std::vector<{anonymous}::NMSymbol> >; _Compare = std::function<bool(const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&)>]’
/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/STLExtras.h:1125:12:   required from ‘void llvm::sort(IteratorTy, IteratorTy, Compare) [with IteratorTy = __gnu_cxx::__normal_iterator<{anonymous}::NMSymbol*, std::vector<{anonymous}::NMSymbol> >; Compare = std::function<bool(const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&)>]’
/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/STLExtras.h:1130:13:   required from ‘void llvm::sort(Container&&, Compare) [with Container = std::vector<{anonymous}::NMSymbol>&; Compare = std::function<bool(const {anonymous}::NMSymbol&, const {anonymous}::NMSymbol&)>]’
/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/tools/llvm-nm/llvm-nm.cpp:724:31:   required from here
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/predefined_ops.h:123:31: error: no match for ‘operator*’ (operand type is ‘{anonymous}::NMSymbol’)
         { return bool(_M_comp(*__it1, *__it2)); }
                               ^
In file included from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APFloat.h:19:0,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/IR/Type.h:17,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/IR/DerivedTypes.h:23,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/IR/Function.h:29,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/tools/llvm-nm/llvm-nm.cpp:21:
/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APInt.h:2097:14: note: candidate: llvm::APInt llvm::operator*(llvm::APInt, uint64_t)
 inline APInt operator*(APInt a, uint64_t RHS) {
              ^
/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APInt.h:2097:14: note:   candidate expects 2 arguments, 1 provided
/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APInt.h:2102:14: note: candidate: llvm::APInt llvm::operator*(uint64_t, llvm::APInt)
 inline APInt operator*(uint64_t LHS, APInt b) {
              ^
/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APInt.h:2102:14: note:   candidate expects 2 arguments, 1 provided
In file included from /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/stl_algobase.h:71:0,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/memory:62,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/Optional.h:22,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/STLExtras.h:19,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/StringRef.h:12,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/StringSwitch.h:15,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/tools/llvm-nm/llvm-nm.cpp:18:
/b/s/w/ir/cache/builder/src/third_party/llvm-build-tools/gcc510trusty/include/c++/5.1.0/bits/predefined_ops.h:123:39: error: no match for ‘operator*’ (operand type is ‘{anonymous}::NMSymbol’)
         { return bool(_M_comp(*__it1, *__it2)); }
                                       ^
In file included from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APFloat.h:19:0,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/IR/Type.h:17,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/IR/DerivedTypes.h:23,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/IR/Function.h:29,
                 from /b/s/w/ir/cache/builder/src/third_party/llvm/llvm/tools/llvm-nm/llvm-nm.cpp:21:
/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APInt.h:2097:14: note: candidate: llvm::APInt llvm::operator*(llvm::APInt, uint64_t)
 inline APInt operator*(APInt a, uint64_t RHS) {
              ^
/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APInt.h:2097:14: note:   candidate expects 2 arguments, 1 provided
/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APInt.h:2102:14: note: candidate: llvm::APInt llvm::operator*(uint64_t, llvm::APInt)
 inline APInt operator*(uint64_t LHS, APInt b) {
              ^
/b/s/w/ir/cache/builder/src/third_party/llvm/llvm/include/llvm/ADT/APInt.h:2102:14: note:   candidate expects 2 arguments, 1 provided

Thanks, here's a fix for this one: https://reviews.llvm.org/D66310