Accessing File Types with clang-tidy

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

Accessing File Types with clang-tidy

via cfe-dev
Hello,

I've been doing some work on writing a check with clang-tidy. I want my check to behave differently on header files than on implementation files. 

My current plan is to do this by looking at the extension of the file type (and assume the file is not a header file if the extension is of the form ".c*"). 

To do this, I need a way of getting the file name as a string. Within llvm, what is the standard way of accessing the name of a file clang-tidy is running on?

Best,
Shyan Akmal

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

Re: Accessing File Types with clang-tidy

via cfe-dev
On 16/10/18 00:42, Shyan Akmal via cfe-dev wrote:
> Hello,
>
> I've been doing some work on writing a check with clang-tidy. I want my
> check to behave differently on header files than on implementation files.
>
> My current plan is to do this by looking at the extension of the file
> type (and assume the file is not a header file if the extension is of
> the form ".c*").

You can do that with the AST Matcher isExpansionInFileMatching().

Thanks,

Stephen.


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev