Re: [clang-tools-extra] r329452 - [clang-tidy] Fix compilation for ParentVirtualCallCheck.cpp

2018-04-10 Thread Zinovy Nis via cfe-commits
OK)

вт, 10 апр. 2018 г. в 18:44, Alexander Kornienko :

> I totally get it, no worries. But if you have free cycles, it would be
> nice to brush this code up again.
>
>
> On Tue, Apr 10, 2018 at 5:32 PM Zinovy Nis  wrote:
>
>> Looks you are right, but I was in hurry trying to fix build bot failures
>> ASAP.
>>
>> вт, 10 апр. 2018 г. в 18:28, Alexander Kornienko :
>>
>>> On Mon, Apr 9, 2018 at 8:09 PM Zinovy Nis  wrote:
>>>
 I had compilation errors here on MVSV@PSP and for ARM:

 

 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 ) 
 {
^

 But that seems to be unrelated to llvm::find_if? The compiler is
>>> complaining about the use of `auto` in the lambda argument type.
>>>
>>>

 /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&, 
 )'
Text.erase(llvm::remove_if(Text, std::isspace), Text.end());
 ^

 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)> to select the right overload.
>>>
>>>

 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 
 

Re: [clang-tools-extra] r329452 - [clang-tidy] Fix compilation for ParentVirtualCallCheck.cpp

2018-04-10 Thread Alexander Kornienko via cfe-commits
I totally get it, no worries. But if you have free cycles, it would be nice
to brush this code up again.

On Tue, Apr 10, 2018 at 5:32 PM Zinovy Nis  wrote:

> Looks you are right, but I was in hurry trying to fix build bot failures
> ASAP.
>
> вт, 10 апр. 2018 г. в 18:28, Alexander Kornienko :
>
>> On Mon, Apr 9, 2018 at 8:09 PM Zinovy Nis  wrote:
>>
>>> I had compilation errors here on MVSV@PSP and for ARM:
>>>
>>> 
>>>
>>> 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 ) {
>>>^
>>>
>>> But that seems to be unrelated to llvm::find_if? The compiler is
>> complaining about the use of `auto` in the lambda argument type.
>>
>>
>>>
>>> /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&, 
>>> )'
>>>Text.erase(llvm::remove_if(Text, std::isspace), Text.end());
>>> ^
>>>
>>> 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)> to select the right overload.
>>
>>
>>>
>>> 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 
>>> 

Re: [clang-tools-extra] r329452 - [clang-tidy] Fix compilation for ParentVirtualCallCheck.cpp

2018-04-10 Thread Zinovy Nis via cfe-commits
Looks you are right, but I was in hurry trying to fix build bot failures
ASAP.

вт, 10 апр. 2018 г. в 18:28, Alexander Kornienko :

> On Mon, Apr 9, 2018 at 8:09 PM Zinovy Nis  wrote:
>
>> I had compilation errors here on MVSV@PSP and for ARM:
>>
>> 
>>
>> 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 ) {
>>^
>>
>> But that seems to be unrelated to llvm::find_if? The compiler is
> complaining about the use of `auto` in the lambda argument type.
>
>
>>
>> /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&, 
>> )'
>>Text.erase(llvm::remove_if(Text, std::isspace), Text.end());
>> ^
>>
>> 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)> to select the right overload.
>
>
>>
>> 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:
>> 

Re: [clang-tools-extra] r329452 - [clang-tidy] Fix compilation for ParentVirtualCallCheck.cpp

2018-04-10 Thread Alexander Kornienko via cfe-commits
On Mon, Apr 9, 2018 at 8:09 PM Zinovy Nis  wrote:

> I had compilation errors here on MVSV@PSP and for ARM:
>
> 
>
> 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 ) {
>^
>
> But that seems to be unrelated to llvm::find_if? The compiler is
complaining about the use of `auto` in the lambda argument type.


>
> /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&, 
> )'
>Text.erase(llvm::remove_if(Text, std::isspace), Text.end());
> ^
>
> 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 to select the right overload.


>
> 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 decltype 
> (llvm::adl_begin(Range)) llvm::remove_if(R&&, UnaryPredicate)
>  auto remove_if(R &, UnaryPredicate P) -> 

Re: [clang-tools-extra] r329452 - [clang-tidy] Fix compilation for ParentVirtualCallCheck.cpp

2018-04-09 Thread Zinovy Nis via cfe-commits
I had compilation errors here on MVSV@PSP and for ARM:



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 ) {
   ^
/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&, )'
   Text.erase(llvm::remove_if(Text, std::isspace), Text.end());
^
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 decltype
(llvm::adl_begin(Range)) llvm::remove_if(R&&, UnaryPredicate)
 auto remove_if(R &, 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 

Re: [clang-tools-extra] r329452 - [clang-tidy] Fix compilation for ParentVirtualCallCheck.cpp

2018-04-09 Thread Alexander Kornienko via cfe-commits
On Fri, Apr 6, 2018 at 10:42 PM Zinovy Nis via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: zinovy.nis
> Date: Fri Apr  6 13:39:23 2018
> New Revision: 329452
>
> URL: http://llvm.org/viewvc/llvm-project?rev=329452=rev
> Log:
> [clang-tidy] Fix compilation for ParentVirtualCallCheck.cpp
>
>
> Modified:
> clang-tools-extra/trunk/clang-tidy/bugprone/ParentVirtualCallCheck.cpp
>
> Modified:
> clang-tools-extra/trunk/clang-tidy/bugprone/ParentVirtualCallCheck.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/bugprone/ParentVirtualCallCheck.cpp?rev=329452=329451=329452=diff
>
> ==
> --- clang-tools-extra/trunk/clang-tidy/bugprone/ParentVirtualCallCheck.cpp
> (original)
> +++ clang-tools-extra/trunk/clang-tidy/bugprone/ParentVirtualCallCheck.cpp
> Fri Apr  6 13:39:23 2018
> @@ -11,8 +11,8 @@
>  #include "clang/AST/ASTContext.h"
>  #include "clang/ASTMatchers/ASTMatchFinder.h"
>  #include "clang/Tooling/FixIt.h"
> -#include "llvm/ADT/STLExtras.h"
>  #include "llvm/ADT/SmallVector.h"
> +#include 
>  #include 
>
>  using namespace clang::ast_matchers;
> @@ -27,11 +27,13 @@ static bool isParentOf(const CXXRecordDe
> const CXXRecordDecl ) {
>if (Parent.getCanonicalDecl() == ThisClass.getCanonicalDecl())
>  return true;
> -  const auto ClassIter = llvm::find_if(ThisClass.bases(), [=](auto )
> {
> -auto *BaseDecl = Base.getType()->getAsCXXRecordDecl();
> -assert(BaseDecl);
> -return Parent.getCanonicalDecl() == BaseDecl->getCanonicalDecl();
> -  });
> +  const auto ClassIter = std::find_if(
>

So what was wrong with llvm::find_if? Why didn't it work here?


> +  ThisClass.bases().begin(), ThisClass.bases().end(),
> +  [=](const CXXBaseSpecifier ) {
> +auto *BaseDecl = Base.getType()->getAsCXXRecordDecl();
> +assert(BaseDecl);
> +return Parent.getCanonicalDecl() == BaseDecl->getCanonicalDecl();
> +  });
>return ClassIter != ThisClass.bases_end();
>  }
>
> @@ -74,7 +76,8 @@ static std::string getNameAsString(const
>  static std::string getExprAsString(const clang::Expr ,
> clang::ASTContext ) {
>std::string Text = tooling::fixit::getText(E, AC).str();
> -  Text.erase(llvm::remove_if(Text, std::isspace), Text.end());
> +  Text.erase(std::remove_if(Text.begin(), Text.end(), std::isspace),
> + Text.end());
>return Text;
>  }
>
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r329452 - [clang-tidy] Fix compilation for ParentVirtualCallCheck.cpp

2018-04-06 Thread Zinovy Nis via cfe-commits
Author: zinovy.nis
Date: Fri Apr  6 13:39:23 2018
New Revision: 329452

URL: http://llvm.org/viewvc/llvm-project?rev=329452=rev
Log:
[clang-tidy] Fix compilation for ParentVirtualCallCheck.cpp


Modified:
clang-tools-extra/trunk/clang-tidy/bugprone/ParentVirtualCallCheck.cpp

Modified: clang-tools-extra/trunk/clang-tidy/bugprone/ParentVirtualCallCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/bugprone/ParentVirtualCallCheck.cpp?rev=329452=329451=329452=diff
==
--- clang-tools-extra/trunk/clang-tidy/bugprone/ParentVirtualCallCheck.cpp 
(original)
+++ clang-tools-extra/trunk/clang-tidy/bugprone/ParentVirtualCallCheck.cpp Fri 
Apr  6 13:39:23 2018
@@ -11,8 +11,8 @@
 #include "clang/AST/ASTContext.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
 #include "clang/Tooling/FixIt.h"
-#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallVector.h"
+#include 
 #include 
 
 using namespace clang::ast_matchers;
@@ -27,11 +27,13 @@ static bool isParentOf(const CXXRecordDe
const CXXRecordDecl ) {
   if (Parent.getCanonicalDecl() == ThisClass.getCanonicalDecl())
 return true;
-  const auto ClassIter = llvm::find_if(ThisClass.bases(), [=](auto ) {
-auto *BaseDecl = Base.getType()->getAsCXXRecordDecl();
-assert(BaseDecl);
-return Parent.getCanonicalDecl() == BaseDecl->getCanonicalDecl();
-  });
+  const auto ClassIter = std::find_if(
+  ThisClass.bases().begin(), ThisClass.bases().end(),
+  [=](const CXXBaseSpecifier ) {
+auto *BaseDecl = Base.getType()->getAsCXXRecordDecl();
+assert(BaseDecl);
+return Parent.getCanonicalDecl() == BaseDecl->getCanonicalDecl();
+  });
   return ClassIter != ThisClass.bases_end();
 }
 
@@ -74,7 +76,8 @@ static std::string getNameAsString(const
 static std::string getExprAsString(const clang::Expr ,
clang::ASTContext ) {
   std::string Text = tooling::fixit::getText(E, AC).str();
-  Text.erase(llvm::remove_if(Text, std::isspace), Text.end());
+  Text.erase(std::remove_if(Text.begin(), Text.end(), std::isspace),
+ Text.end());
   return Text;
 }
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits