[cfe-dev] clang-tidy how to exclude header from being preprocessed -- NOLINT not working

Roman Lebedev via cfe-dev cfe-dev at lists.llvm.org
Thu May 3 02:25:26 PDT 2018


On Thu, May 3, 2018 at 12:19 PM, Oza, Hiral <Hiral.Oza at netapp.com> wrote:
> Hello Roman,
>
>>> With above sample, I want to skip tidy-ing a.h and I tried placing ‘//
>>> NOLINT’ but tidy is still parsing a.h.
>> It can't not parse it. Are you asking about not issuing diagnostics from it?
>
> Yes. I don't want any diagnostics from 'a.h'. Simply put tidy should ignore a.h. How to do that with tidy?
>
>
>
>>> I also tried with ‘// NOLINTNEXTLINE’ but still tidy is considering
>>> a.c:01 line and impacts the overall performance.
>>I would guess as per http://clang.llvm.org/extra/clang-tidy/
>>you should try using -header-filter=<string>
>
> Can you suggest example.
> $ clag-tidy -checks="*" -header-filter=".*;-a.h", correct?
Not sure, never needed that.
I would guess the other way around, -header-filter=".*/a.h"
Also be aware that -isystem will suppress the warnings as usual.

> -----Original Message-----
> From: Roman Lebedev <lebedev.ri at gmail.com>
> Sent: Thursday, May 3, 2018 2:41 PM
> To: Oza, Hiral <Hiral.Oza at netapp.com>
> Cc: cfe-dev at lists.llvm.org
> Subject: Re: [cfe-dev] clang-tidy how to exclude header from being preprocessed -- NOLINT not working
>
> On Thu, May 3, 2018 at 11:47 AM, Oza, Hiral via cfe-dev <cfe-dev at lists.llvm.org> wrote:
>> Greetings!
>>
>>
>>
>> How to exclude #include-ed header files while running clang-tidy?
>> Tried ‘// NOLINT’ and ‘// NOLINTNEXTLINE’ but it didn’t help!!!
>>
>>
>>
>> Sample program:
>>
>> a.h:
>>
>> 01 #include <inc1.h>
>>
>> 02 #include <inc2.h>
>>
>> 03 #include “inc3.h>
>>
>> // other code
>>
>>
>>
>> a.c:
>>
>> 01 #include <a.h> // NOLINT
>>
>> // other code
>>
>>
>>
>> With above sample, I want to skip tidy-ing a.h and I tried placing ‘//
>> NOLINT’ but tidy is still parsing a.h.
> It can't not parse it. Are you asking about not issuing diagnostics from it?
>
>> I also tried with ‘// NOLINTNEXTLINE’ but still tidy is considering
>> a.c:01 line and impacts the overall performance.
>
> I would guess as per http://clang.llvm.org/extra/clang-tidy/
> you should try using -header-filter=<string>
>
>> Thanks,
> Roman.
>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>



More information about the cfe-dev mailing list