<div dir="ltr"><div>Hi Pete, David,</div><div><br></div>This is still failing for -std=c++1y (latest released Mac OS + Xcode. call cmake with -DLLVM_USE_CXX1Y=YES):<div><br></div><div><div>[1117/25/457] Building CXX object lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/ARMException.cpp.o</div><div>FAILED: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++   -DGTEST_HAS_RTTI=0 -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -stdlib=libc++ -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++1y -fcolor-diagnostics -O3  -Ilib/CodeGen/AsmPrinter -I/Users/filcab/work/llvm/lib/CodeGen/AsmPrinter -Iinclude -I/Users/filcab/work/llvm/include    -UNDEBUG -fno-exceptions -fno-rtti -MMD -MT lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/ARMException.cpp.o -MF lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/ARMException.cpp.o.d -o lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/ARMException.cpp.o -c /Users/filcab/work/llvm/lib/CodeGen/AsmPrinter/ARMException.cpp</div><div>/Users/filcab/work/llvm/lib/CodeGen/AsmPrinter/ARMException.cpp:118:32: error: no matching function for call to 'reverse'</div><div>  for (const GlobalValue *GV : reverse(TypeInfos)) {</div><div>                               ^~~~~~~</div><div>/Users/filcab/work/llvm/include/llvm/ADT/STLExtras.h:210:38: note: candidate template ignored: disabled by 'enable_if' [with ContainerTy = const std::__1::vector<const llvm::GlobalValue *, std::__1::allocator<const llvm::GlobalValue *> > &]</div><div>             typename std::enable_if<has_rbegin<ContainerTy>::value>::type * =</div><div>                                     ^</div><div>/Users/filcab/work/llvm/include/llvm/ADT/STLExtras.h:225:6: note: candidate template ignored: substitution failure [with ContainerTy = const std::__1::vector<const llvm::GlobalValue *, std::__1::allocator<const llvm::GlobalValue *> > &]: call to 'make_reverse_iterator' is ambiguous</div><div>auto reverse(</div><div>     ^</div><div>/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:2335:1: note: candidate function template not viable: requires 2 arguments, but 1 was provided</div><div>reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)</div><div>^</div><div>1 error generated.</div><div>[1117/0/482] Building CXX object lib/IR/CMakeFiles/LLVMCore.dir/Function.cpp.o</div><div>ninja: build stopped: subcommand failed.</div><div><br></div><div>C++11 works:</div><div>[llvm-cmake]% /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++   -DGTEST_HAS_RTTI=0 -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -stdlib=libc++ -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++11 -fcolor-diagnostics -O3  -Ilib/CodeGen/AsmPrinter -I/Users/filcab/work/llvm/lib/CodeGen/AsmPrinter -Iinclude -I/Users/filcab/work/llvm/include    -UNDEBUG -fno-exceptions -fno-rtti -MMD -MT lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/ARMException.cpp.o -MF lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/ARMException.cpp.o.d -o lib/CodeGen/AsmPrinter/CMakeFiles/LLVMAsmPrinter.dir/ARMException.cpp.o -c /Users/filcab/work/llvm/lib/CodeGen/AsmPrinter/ARMException.cpp<br></div><div><br></div></div><div class="gmail_extra"><br></div><div class="gmail_extra">Thank you,</div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">  Filipe<br></div></div>
<br><div class="gmail_quote">On Wed, Jul 29, 2015 at 3:24 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Wed, Jul 29, 2015 at 3:21 PM, Pete Cooper <span dir="ltr"><<a href="mailto:peter_cooper@apple.com" target="_blank">peter_cooper@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span><blockquote type="cite"><div>On Jul 29, 2015, at 2:44 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:</div><br><div><div dir="ltr">Drop the ", int" from enable_if and use nullptr instead of 0 for the default value (enable_if uses void* by default, so this is sort of more typical - of course the 0 works too)<br><br>Perhaps add:<br><br><div>  const TypeParam c = {0, 1, 2, 3};</div><div>  TestRev(reverse(c));<br><br>to TYPED_TEST(RangeAdapterLValueTest, TrivialOperation), to test the const cases?<br></div></div></div></blockquote></span>Done.  I remove the custom vector types from the lvalue test as they don’t support const_iterator’s.  But they are tested in the rvalue test so that should be fine.<span><br><blockquote type="cite"><div><div dir="ltr"><div><br>& run the whole thing through clang-format, if you haven't already? (I see some inconsistencies - like the space, or not, between the {} for the two Test derived class templates)<br></div></div></div></blockquote></span>Yeo, there were a few missing places.  I went over the changes made by clang format and all looked fine.</div><div><span><blockquote type="cite"><div><div dir="ltr"><div><br>& then feel free to commit at your leisure & we'll cross our fingers for the GCC bots.</div></div></div></blockquote></span>Great.  Thanks again for all the help.</div></div></blockquote><div><br></div></span><div>Sure thing - 'preciate the patience.</div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>  I get the feeling as this point that you could have written it faster than helping me, so i really appreciate the guidance on this.</div></div></blockquote></span><div><br>Perhaps, perhaps not - I probably would've missed a bunch of the things I've caught in code review here. The benefit of being that second pair of eyes. (forest, trees, etc)<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>  Its r243581.</div></div></blockquote><div><br>Awesome,<br>- Dave<br> </div><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><span><font color="#888888"><div><br></div></font></span><div><span><font color="#888888">Pete</font></span><div><div><br><blockquote type="cite"><div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 29, 2015 at 2:38 PM, Pete Cooper <span dir="ltr"><<a href="mailto:peter_cooper@apple.com" target="_blank">peter_cooper@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span><blockquote type="cite"><div>On Jul 29, 2015, at 2:22 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:</div><br><div><br><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">On Wed, Jul 29, 2015 at 2:02 PM, Pete Cooper<span> </span></span><span dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><<a href="mailto:peter_cooper@apple.com" target="_blank">peter_cooper@apple.com</a>></span><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important"><span> </span></span><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">wrote:</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><blockquote class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span><blockquote type="cite"><div>On Jul 29, 2015, at 1:50 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:</div><br><div><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">Yep, something like that looks about right. I'm not sure if it can be generalized further so we can reuse some of the machinery for begin, end, rbegin, rend, getDecl, etc. You can probably just SFINAE on begin/rbegin and assume end/rend exist - but if we can get the SFINAE tidy enough it wouldn't hurt to test for both, I suppose.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">btw, my change to the test that demonstrates the problem with using universal ref/lvalue ref distinction to differentiate is this: add "const ReverseOnlyVector/const BidirectionalVector" to the Types vector & you'll see failures in the existing implementation. Alternatively/in addition, could refactor out the body of the TrivialOperation test into a template, then instantiate that template with TypeParam and const TypeParam, so you don't have to list all of them as const/non-const in the list of types.</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">Also, I added this rvalue version:</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">template <typename T> struct RangeAdapterRValueTest : testing::Test {};</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">typedef ::testing::Types<std::vector<int>, std::list<int>, ReverseOnlyVector,</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">                         BidirectionalVector> RangeAdapterRValueTestTypes;</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">TYPED_TEST_CASE(RangeAdapterRValueTest, RangeAdapterRValueTestTypes);</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">template<typename R></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">void TestRev(const R& r) {</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"> <span> </span>int counter = 3;</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"> <span> </span>for (int i : r)</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">   <span> </span>EXPECT_EQ(i, counter--);</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">}</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">TYPED_TEST(RangeAdapterRValueTest, TrivialOperation) {</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"> <span> </span>TestRev(reverse(TypeParam({0, 1, 2, 3})));</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">}</div></div></blockquote></span>Very nice.  Thanks for doing that.</div><div><br></div><div>Here’s a patch with the fixes.  I had to extend has_rbegin to handle whether its a class or not (int[] failed without that).  Otherwise its basically just like has_getDecl.  I think has_getDecl is in an internal namespace.  I can do the same here if you like, i’m fine either way.</div></div></blockquote><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br>So the rvalue tests I added don't cover the non-rvalue case your existing test cases covered (nor the array cases) - looks like you dropped the originals?<br></div></div></blockquote></span>Sorry, i misread your email before.  I thought what you had replaced my tests, now I see that it was the additional of rvalue tests.  I’ve refactored what I had to use the TestRev method you have and added lvalue tests.<span><br><blockquote type="cite"><div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br>I wonder if the SFINAE can be done without trying to derive from the type (some types might not be derivable)<br><br>Maybe the hasDecl was written pre-C++11?<br><br>This /seems/ to work in the basic case:<br><br><div>struct foo {</div><div>  void func();</div><div>};</div><div><br></div><div>struct bar {</div><div>};</div><div><br></div><div>template<typename T></div><div>struct has_func {</div><div>  template<typename U></div><div>  static char (&f(const U&, decltype(&U::func)))[1];</div><div>  static char (&f(...))[2];</div><div>  const static bool value = sizeof(f(std::declval<T>(), nullptr)) == 1;</div><div>};</div><div><br></div><div>static_assert(has_func<foo>::value, "");</div><div>static_assert(!has_func<bar>::value, "”);<br></div></div></div></blockquote></span>Yeah, thats much better.  In fact there were a couple of cases failing with my implementation when i brought back all the tests.  This version handles everything.</div><div><br></div><div></div></div><br><div style="word-wrap:break-word"><div><br><blockquote type="cite"><div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div><br>(plus the extra non-class detection you had too)</div> </div><blockquote class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>Cheers,</div><div>Pete</div></div></blockquote></div></blockquote></div><br></div><br></blockquote></div><br></div>
</div></blockquote></div></div></div><br></div></blockquote></div></div></div><br></div></div>
<br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div></div>