[llvm] r252253 - Fix bugpoint breakage on libcxx introduced by r252247

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 5 21:20:57 PST 2015


It looks like libc++ is correct here.  I suspect what's failing is
the part of the `enable_if` that isn't in the error message, the
`is_constructible` check:
--
  template <class _InputIterator>
      typename enable_if
      <  
           __is_input_iterator  <_InputIterator>::value && 
          !__is_forward_iterator<_InputIterator>::value && 
          is_constructible<
               value_type,
               typename iterator_traits<_InputIterator>::reference>::value,
          iterator>::type
      insert(const_iterator __position, _InputIterator __first, _InputIterator __last);
  template <class _ForwardIterator>
      typename enable_if
      <  
          __is_forward_iterator<_ForwardIterator>::value && 
          is_constructible<
               value_type,
               typename iterator_traits<_ForwardIterator>::reference>::value,
          iterator>::type
      insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last);
--

Looking at the definition of the NamedMDNode::*iterator classes, they
have (effectively):
--
struct NamedMDNode::iterator
: public std::iterator<std::bidirectional_iterator_tag, MDNode> {
MDNode *operator*() { ... }
};
--

Note that they dereference to `MDNode*`, not to `MDNode&` as the
iterator traits incorrectly suggest.

Since the `is_constructible` check is based on faulty iterator
traits, the overloads get ignored.

I think if you fix the NamedMDNode iterators your original code
should work just fine.

> On 2015-Nov-05, at 16:59, Keno Fischer <kfischer at college.harvard.edu> wrote:
> 
> The error was the following, which seems to be only failing on libc++ (from observing which buildbots fail & the fact that it passes locally on my linux machine with libstdc++ - I'm in the process of building this branch on my mac to make sure but wanted to try to get the buildbots green):
> 
> ```
> 
> /usr/home/buildslave/slave_as-bldslv5/lld-x86_64-freebsd/llvm.src/tools/bugpoint/CrashDebugger.cpp:831:20: error: no matching member function for call to 'insert'
>       NamedMDOps.insert(NamedMDOps.end(), NamedMD.op_begin(),
>       ~~~~~~~~~~~^~~~~~
> /usr/include/c++/v1/vector:715:14: note: candidate function not viable: no known conversion from 'op_iterator' (aka 'op_iterator_impl<llvm::MDNode *, llvm::MDNode>') to 'size_type' (aka 'unsigned long') for 2nd argument
>   iterator insert(const_iterator __position, size_type __n, const_reference __x);
>            ^
> /usr/include/c++/v1/vector:719:14: note: candidate template ignored: disabled by 'enable_if' [with _InputIterator = llvm::NamedMDNode::op_iterator_impl<llvm::MDNode *, llvm::MDNode>]
>            __is_input_iterator  <_InputIterator>::value &&
>            ^
> /usr/include/c++/v1/vector:730:13: note: candidate template ignored: disabled by 'enable_if' [with _ForwardIterator = llvm::NamedMDNode::op_iterator_impl<llvm::MDNode *, llvm::MDNode>]
>           __is_forward_iterator<_ForwardIterator>::value &&
>           ^
> /usr/include/c++/v1/vector:707:14: note: candidate function not viable: requires 2 arguments, but 3 were provided
>   iterator insert(const_iterator __position, const_reference __x);
>            ^
> /usr/include/c++/v1/vector:709:14: note: candidate function not viable: requires 2 arguments, but 3 were provided
>   iterator insert(const_iterator __position, value_type&& __x);
>            ^
> /usr/include/c++/v1/vector:739:14: note: candidate function not viable: requires 2 arguments, but 3 were provided
>   iterator insert(const_iterator __position, initializer_list<value_type> __il)
>            ^
> 
> ```
> 
> On Thu, Nov 5, 2015 at 7:54 PM, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:
> 
>> On 2015-Nov-05, at 16:45, Keno Fischer via llvm-commits <llvm-commits at lists.llvm.org> wrote:
>> 
>> Author: kfischer
>> Date: Thu Nov  5 18:45:47 2015
>> New Revision: 252253
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=252253&view=rev
>> Log:
>> Fix bugpoint breakage on libcxx introduced by r252247
>> 
>> Modified:
>>  llvm/trunk/tools/bugpoint/CrashDebugger.cpp
>> 
>> Modified: llvm/trunk/tools/bugpoint/CrashDebugger.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/CrashDebugger.cpp?rev=252253&r1=252252&r2=252253&view=diff
>> ==============================================================================
>> --- llvm/trunk/tools/bugpoint/CrashDebugger.cpp (original)
>> +++ llvm/trunk/tools/bugpoint/CrashDebugger.cpp Thu Nov  5 18:45:47 2015
>> @@ -828,8 +828,8 @@ static bool DebugACrash(BugDriver &BD,
>>     // contribute to the crash, bisect the operands of the remaining ones
>>     std::vector<const MDNode *> NamedMDOps;
>>     for (auto &NamedMD : BD.getProgram()->named_metadata())
>> -        NamedMDOps.insert(NamedMDOps.end(), NamedMD.op_begin(),
>> -                          NamedMD.op_end());
> 
> What was the error?  This seems strange.  Should we fix something?
> 
>> +        for (auto op : NamedMD.operands())
>> +          NamedMDOps.push_back(op);
> 
> Style nitpick: it'd be clearer to specify the type here (`MDNode *`?),
> and "op" should really be "Op".
> 
>>     ReduceCrashingNamedMDOps(BD, TestFn).reduceList(NamedMDOps, Error);
>>   }
>> }
>> 
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> 
> 



More information about the llvm-commits mailing list