[cfe-dev] Different Clang-Tidy results on Linux vs Windows

MyDeveloper Day via cfe-dev cfe-dev at lists.llvm.org
Fri Jan 18 01:40:05 PST 2019


@JonasToth I wonder if this could this be related to
https://bugs.llvm.org/show_bug.cgi?id=38471

You know how bugs go, you see it once, you see it everywhere....

Perhaps the -checks='' has the effect here of changing the checks being
used by default, Hugo what is the reason for supplying an empty -checks
here?

Normally I'd recommend using a .clang-tidy file in the root of the project
where you specify the checks you want (more specifically those you don't
want, so you get new ones when added)

"C:\Program Files\CMake\bin\cmake.exe" -E __run_co_compile
--tidy="C:/Program
Files/LLVM/bin/clang-tidy.exe;-enable-check-profile;-checks=''"


On Thu, Jan 17, 2019 at 8:46 PM Jonas Toth via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hey Hugo,
>
> that is weird, but the default configurations could differ.
> `modernize-use-auto` has a feature that disables the replacements if the
> type (e.g. `bool`) is shorter/same length as `auto`.
> Could you please check if that for some reason interfered?
>
> Best, Jonas
> Am 16.01.19 um 19:13 schrieb Hugo lindström via cfe-dev:
>
> Greetings!
>
> I'm using CMake and the CXX_CLANG_TIDY property to enable Clang-Tidy on
> Linux (GCC/Clang) and Windows (MSVC).
>
> I use these lines to demo that I get different results on the platforms:
> const TU8* comp_ptr = static_cast<const TU8*>(buf_ptr);
> const TU8* t = NULL;
> Using Ninja and MSVC on Windows, Clang-Tidy modernize only reports
>
> C:\Zebra\llvm-demo\build-win\..\src\aligned_buffer.cc:7:18: warning: use nullptr [modernize-use-nullptr]
>   const TU8* t = NULL;
>                  ^~~~~
>                  nullptr
>
> Using Make and GCC on Linux, Clang-Tidy modernize reports
>
> /tmp/workspace/llvm-demo/src/aligned_buffer.cc:6:9: warning: use auto when initializing with a cast to avoid duplicating the type name [modernize-use-auto]
>   const TU8* comp_ptr = static_cast<const TU8*>(buf_ptr);
>         ^~~~
>         auto
>
> /tmp/workspace/llvm-demo/src/aligned_buffer.cc:7:18: warning: use nullptr [modernize-use-nullptr]
>   const TU8* t = NULL;
>                  ^~~~~
>                  nullptr
>
>
> Both platforms have clang-tidy-6.0 and CMake 3.13
>
> Demo project: https://github.com/hugolm84/llvm-demo
>
> Is this expected, or do I do something wrong? I thought the clang-tidy
> binary would do the same checks on any platform it can run on?
> Can the compiler flags have anything to do with this? I use
>
> target_compile_options(${PROJECT_NAME}
>>     PRIVATE
>>         $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:GNU>>:
>>             $<$<CONFIG:Debug>:-O0 -Wall -Wextra>>
>>         $<$<CXX_COMPILER_ID:MSVC>:
>>             $<$<CONFIG:Debug>:/Od /W4 /Zi>>
>> )
>
>
>
> Thanks in advance!
>
> Ps. This is my first post to the mailing list, please forgive me if the
> format is off or if this is the wrong forum.
>
> Best
>
> _______________________________________________
> cfe-dev mailing listcfe-dev at lists.llvm.orghttp://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190118/f67e2ee8/attachment-0001.html>


More information about the cfe-dev mailing list