[cfe-dev] Check if inside a header file

Jordan Rose jordan_rose at apple.com
Fri Jan 17 17:37:59 PST 2014

There's not actually any difference between a header file passed as a main file and a normal main file. C doesn't care that one has a .h and/or lives in your include/ folder and that the other has a .c and/or lives in src/ or lib/. I think you've just got to accept that.


On Jan 17, 2014, at 16:50, Nikola Smiljanic <popizdeh at gmail.com> wrote:

> Is there a way to know if I'm inside a header file in the Preprocessor class. I've only been able to find warn_using_directive_in_header that does a similar check, only to realize that it's not 100% correct. It uses SourceMgr.isInMainFile which is not right if you pass a header file directly, no warning is generated in that case.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

More information about the cfe-dev mailing list