Problem with clang-tidy not finding all issues when additional header is included

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with clang-tidy not finding all issues when additional header is included

Fangrui Song via cfe-dev
Hello, is this the right place to ask about clang-tidy problems? Please direct me somewhere else if appropriate. In a nutshell, I've got a situation where clang-tidy on Mac OS Catalina (installed by compiling LLVM 10.0.0 through Homebrew) will correctly find issues in a source file; but when a standard library header is included, it stops finding them all.

A trivial example reproduces the issue:
-----
// #include <vector>
typedef int MyInt;
typedef float MyFloat;
-----

Running "clang-tidy main.cpp -checks=-*,modernize-use-using" with the include commented out:
-----
2 warnings generated.
/Users/andrew.mcdonald/Desktop/Test/main.cpp:2:1: warning: use 'using' instead of 'typedef' [modernize-use-using]
typedef int MyInt;
^~~~~~~~~~~~~~~~~
using MyInt = int
/Users/andrew.mcdonald/Desktop/Test/main.cpp:3:1: warning: use 'using' instead of 'typedef' [modernize-use-using]
typedef float MyFloat;
^~~~~~~~~~~~~~~~~~~~~
using MyFloat = float
-----

With the include enabled, it only reports one of them:
-----
1044 warnings generated.
/Users/andrew.mcdonald/Desktop/Test/main.cpp:3:1: warning: use 'using' instead of 'typedef' [modernize-use-using]
typedef float MyFloat;
^~~~~~~~~~~~~~~~~~~~~
using MyFloat = float
Suppressed 1043 warnings (1043 in non-user code).
-----

It seems to work fine through Godbolt, so I'm wondering if there's a specific installation issue. Are there any verbose or debugging flags that would help to show what's going wrong?
Thanks for any help

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Problem with clang-tidy not finding all issues when additional header is included

Fangrui Song via cfe-dev
On Tue, 5 May 2020 at 00:32, Andrew McDonald via cfe-dev
<[hidden email]> wrote:
>
> Hello, is this the right place to ask about clang-tidy problems? Please direct me somewhere else if appropriate. In a nutshell, I've got a situation where clang-tidy on Mac OS Catalina (installed by compiling LLVM 10.0.0 through Homebrew) will correctly find issues in a source file; but when a standard library header is included, it stops finding them all.

We've recently run clang-tidy on a big internal code base, and I've
noticed a similar issue:
When there are 2 issues on a single given line, only the first issue
is reported.

Could this be related?

My 2 cents,
Chris
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev