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

Oza, Hiral via cfe-dev cfe-dev at lists.llvm.org
Thu May 3 02:19:55 PDT 2018


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?



-----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