<div dir="ltr">Looks you are right, but I was in hurry trying to fix build bot failures ASAP.</div><br><div class="gmail_quote"><div dir="ltr">вт, 10 апр. 2018 г. в 18:28, Alexander Kornienko <<a href="mailto:alexfh@google.com">alexfh@google.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Mon, Apr 9, 2018 at 8:09 PM Zinovy Nis <<a href="mailto:zinovy.nis@gmail.com" target="_blank">zinovy.nis@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I had compilation errors here on MVSV@PSP and for ARM:<div><br></div><div>------------------------</div><div><pre style="font-family:"Courier New",courier,monotype,monospace;font-size:medium"><span class="m_1307125229806072083gmail-m_-7158905880230949599inbox-inbox-stdout">FAILED: /usr/bin/c++   -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/clang/tools/extra/clang-tidy/bugprone -I/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/tools/clang/tools/extra/clang-tidy/bugprone -I/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/tools/clang/include -Itools/clang/include -Iinclude -I/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3    -UNDEBUG  -fno-exceptions -fno-rtti -MMD -MT tools/clang/tools/extra/clang-tidy/bugprone/CMakeFiles/clangTidyBugproneModule.dir/ParentVirtualCallCheck.cpp.o -MF tools/clang/tools/extra/clang-tidy/bugprone/CMakeFiles/clangTidyBugproneModule.dir/ParentVirtualCallCheck.cpp.o.d -o tools/clang/tools/extra/clang-tidy/bugprone/CMakeFiles/clangTidyBugproneModule.dir/ParentVirtualCallCheck.cpp.o -c /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/tools/clang/tools/extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp
/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/tools/clang/tools/extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp: In function 'bool clang::tidy::bugprone::isParentOf(const clang::CXXRecordDecl&, const clang::CXXRecordDecl&)':
/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/tools/clang/tools/extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp:30:63: error: use of 'auto' in lambda parameter declaration only available with -std=c++14 or -std=gnu++14
   const auto ClassIter = llvm::find_if(ThisClass.bases(), [=](auto &Base) {
                                                               ^</span></pre></div></div></blockquote></div></div><div dir="ltr"><div class="gmail_quote"><div>But that seems to be unrelated to llvm::find_if? The compiler is complaining about the use of `auto` in the lambda argument type.</div></div></div><div dir="ltr"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><pre style="font-family:"Courier New",courier,monotype,monospace;font-size:medium"><span class="m_1307125229806072083gmail-m_-7158905880230949599inbox-inbox-stdout">
/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/tools/clang/tools/extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp: In lambda function:
/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/tools/clang/tools/extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp:31:27: error: request for member 'getType' in 'Base', which is of non-class type 'int'
     auto *BaseDecl = Base.getType()->getAsCXXRecordDecl();
                           ^
/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/tools/clang/tools/extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp: In function 'std::__cxx11::string clang::tidy::bugprone::getExprAsString(const clang::Expr&, clang::ASTContext&)':
/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/tools/clang/tools/extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp:77:48: error: no matching function for call to 'remove_if(std::__cxx11::string&, <unresolved overloaded function type>)'
   Text.erase(llvm::remove_if(Text, std::isspace), Text.end());
                                                ^</span></pre></div></div></blockquote></div></div><div dir="ltr"><div class="gmail_quote"><div>It also doesn't look specific to llvm::remove_if. That can be fixed either by wrapping std::isspace into a lambda or by using a static_cast<int (*)(int)> to select the right overload.</div></div></div><div dir="ltr"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><pre style="font-family:"Courier New",courier,monotype,monospace;font-size:medium"><span class="m_1307125229806072083gmail-m_-7158905880230949599inbox-inbox-stdout">
In file included from /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/include/llvm/ADT/StringRef.h:13:0,
                 from /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/include/llvm/ADT/StringMap.h:17,
                 from /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/tools/clang/tools/extra/clang-tidy/bugprone/../ClangTidyOptions.h:14,
                 from /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/tools/clang/tools/extra/clang-tidy/bugprone/../ClangTidyDiagnosticConsumer.h:13,
                 from /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/tools/clang/tools/extra/clang-tidy/bugprone/../ClangTidy.h:13,
                 from /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/tools/clang/tools/extra/clang-tidy/bugprone/ParentVirtualCallCheck.h:13,
                 from /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/tools/clang/tools/extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp:10:
/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/include/llvm/ADT/STLExtras.h:886:6: note: candidate: template<class R, class UnaryPredicate> decltype (llvm::adl_begin(Range)) llvm::remove_if(R&&, UnaryPredicate)
 auto remove_if(R &&Range, UnaryPredicate P) -> decltype(adl_begin(Range)) {
      ^
/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/include/llvm/ADT/STLExtras.h:886:6: note:   template argument deduction/substitution failed:
/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/tools/clang/tools/extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp:77:48: note:   couldn't deduce template parameter 'UnaryPredicate'
   Text.erase(llvm::remove_if(Text, std::isspace), Text.end());
                                                ^
In file included from /usr/include/c++/5/bits/stl_algobase.h:71:0,
                 from /usr/include/c++/5/algorithm:61,
                 from /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/include/llvm/ADT/Optional.h:23,
                 from /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/tools/clang/tools/extra/clang-tidy/bugprone/../ClangTidyOptions.h:13,
                 from /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/tools/clang/tools/extra/clang-tidy/bugprone/../ClangTidyDiagnosticConsumer.h:13,
                 from /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/tools/clang/tools/extra/clang-tidy/bugprone/../ClangTidy.h:13,
                 from /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/tools/clang/tools/extra/clang-tidy/bugprone/ParentVirtualCallCheck.h:13,
                 from /home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/tools/clang/tools/extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp:10:
/usr/include/c++/5/bits/predefined_ops.h: In instantiation of 'bool __gnu_cxx::__ops::_Iter_pred<_Predicate>::operator()(_Iterator) [with _Iterator = const clang::CXXBaseSpecifier*; _Predicate = clang::tidy::bugprone::isParentOf(const clang::CXXRecordDecl&, const clang::CXXRecordDecl&)::<lambda(int&)>]':
/usr/include/c++/5/bits/stl_algo.h:120:14:   required from '_RandomAccessIterator std::__find_if(_RandomAccessIterator, _RandomAccessIterator, _Predicate, std::random_access_iterator_tag) [with _RandomAccessIterator = const clang::CXXBaseSpecifier*; _Predicate = __gnu_cxx::__ops::_Iter_pred<clang::tidy::bugprone::isParentOf(const clang::CXXRecordDecl&, const clang::CXXRecordDecl&)::<lambda(int&)> >]'
/usr/include/c++/5/bits/stl_algo.h:161:23:   required from '_Iterator std::__find_if(_Iterator, _Iterator, _Predicate) [with _Iterator = const clang::CXXBaseSpecifier*; _Predicate = __gnu_cxx::__ops::_Iter_pred<clang::tidy::bugprone::isParentOf(const clang::CXXRecordDecl&, const clang::CXXRecordDecl&)::<lambda(int&)> >]'
/usr/include/c++/5/bits/stl_algo.h:3815:28:   required from '_IIter std::find_if(_IIter, _IIter, _Predicate) [with _IIter = const clang::CXXBaseSpecifier*; _Predicate = clang::tidy::bugprone::isParentOf(const clan</span><span class="m_1307125229806072083gmail-m_-7158905880230949599inbox-inbox-stdout">g::CXXRecordDecl&, const clang::CXXRecordDecl&)::<lambda(int&)>]'
/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/include/llvm/ADT/STLExtras.h:875:22:   required from 'decltype (llvm::adl_begin(Range)) llvm::find_if(R&&, UnaryPredicate) [with R = llvm::iterator_range<const clang::CXXBaseSpecifier*>; UnaryPredicate = clang::tidy::bugprone::isParentOf(const clang::CXXRecordDecl&, const clang::CXXRecordDecl&)::<lambda(int&)>; decltype (llvm::adl_begin(Range)) = const clang::CXXBaseSpecifier*]'
/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/tools/clang/tools/extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp:34:4:   required from here
/usr/include/c++/5/bits/predefined_ops.h:234:30: error: no match for call to '(clang::tidy::bugprone::isParentOf(const clang::CXXRecordDecl&, const clang::CXXRecordDecl&)::<lambda(int&)>) (const clang::CXXBaseSpecifier&)'
  { return bool(_M_pred(*__it)); }
                              ^
/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/tools/clang/tools/extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp:30:73: note: candidate: clang::tidy::bugprone::isParentOf(const clang::CXXRecordDecl&, const clang::CXXRecordDecl&)::<lambda(int&)>
   const auto ClassIter = llvm::find_if(ThisClass.bases(), [=](auto &Base) {
                                                                         ^
/home/uweigand/sandbox/buildbot/clang-s390x-linux-multistage/llvm/tools/clang/tools/extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp:30:73: note:   no known conversion for argument 1 from 'const clang::CXXBaseSpecifier' to 'int&'
</span><span class="m_1307125229806072083gmail-m_-7158905880230949599inbox-inbox-stdout">ninja: build stopped: subcommand failed.</span></pre><pre style="font-family:"Courier New",courier,monotype,monospace;font-size:medium"><span class="m_1307125229806072083gmail-m_-7158905880230949599inbox-inbox-stdout">--------------------------------------</span></pre></div><div><br><div class="gmail_quote"><div dir="ltr">пн, 9 апр. 2018 г. в 19:43, Alexander Kornienko <<a href="mailto:alexfh@google.com" target="_blank">alexfh@google.com</a>>:<br></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Fri, Apr 6, 2018 at 10:42 PM Zinovy Nis via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Author: zinovy.nis<br>
Date: Fri Apr  6 13:39:23 2018<br>
New Revision: 329452<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=329452&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=329452&view=rev</a><br>
Log:<br>
[clang-tidy] Fix compilation for ParentVirtualCallCheck.cpp<br>
<br>
<br>
Modified:<br>
    clang-tools-extra/trunk/clang-tidy/bugprone/ParentVirtualCallCheck.cpp<br>
<br>
Modified: clang-tools-extra/trunk/clang-tidy/bugprone/ParentVirtualCallCheck.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/bugprone/ParentVirtualCallCheck.cpp?rev=329452&r1=329451&r2=329452&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/bugprone/ParentVirtualCallCheck.cpp?rev=329452&r1=329451&r2=329452&view=diff</a><br>
==============================================================================<br>
--- clang-tools-extra/trunk/clang-tidy/bugprone/ParentVirtualCallCheck.cpp (original)<br>
+++ clang-tools-extra/trunk/clang-tidy/bugprone/ParentVirtualCallCheck.cpp Fri Apr  6 13:39:23 2018<br>
@@ -11,8 +11,8 @@<br>
 #include "clang/AST/ASTContext.h"<br>
 #include "clang/ASTMatchers/ASTMatchFinder.h"<br>
 #include "clang/Tooling/FixIt.h"<br>
-#include "llvm/ADT/STLExtras.h"<br>
 #include "llvm/ADT/SmallVector.h"<br>
+#include <algorithm><br>
 #include <cctype><br>
<br>
 using namespace clang::ast_matchers;<br>
@@ -27,11 +27,13 @@ static bool isParentOf(const CXXRecordDe<br>
                        const CXXRecordDecl &ThisClass) {<br>
   if (Parent.getCanonicalDecl() == ThisClass.getCanonicalDecl())<br>
     return true;<br>
-  const auto ClassIter = llvm::find_if(ThisClass.bases(), [=](auto &Base) {<br>
-    auto *BaseDecl = Base.getType()->getAsCXXRecordDecl();<br>
-    assert(BaseDecl);<br>
-    return Parent.getCanonicalDecl() == BaseDecl->getCanonicalDecl();<br>
-  });<br>
+  const auto ClassIter = std::find_if(<br></blockquote><div><br></div><div>So what was wrong with llvm::find_if? Why didn't it work here?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+      ThisClass.bases().begin(), ThisClass.bases().end(),<br>
+      [=](const CXXBaseSpecifier &Base) {<br>
+        auto *BaseDecl = Base.getType()->getAsCXXRecordDecl();<br>
+        assert(BaseDecl);<br>
+        return Parent.getCanonicalDecl() == BaseDecl->getCanonicalDecl();<br>
+      });<br>
   return ClassIter != ThisClass.bases_end();<br>
 }<br>
<br>
@@ -74,7 +76,8 @@ static std::string getNameAsString(const<br>
 static std::string getExprAsString(const clang::Expr &E,<br>
                                    clang::ASTContext &AC) {<br>
   std::string Text = tooling::fixit::getText(E, AC).str();<br>
-  Text.erase(llvm::remove_if(Text, std::isspace), Text.end());<br>
+  Text.erase(std::remove_if(Text.begin(), Text.end(), std::isspace),<br>
+             Text.end());<br>
   return Text;<br>
 }<br>
<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div>
</blockquote></div></div></div>
</blockquote></div></div></blockquote></div>