Anyway to tell clang to always include a header file?

We’ve got some #define’s we’d always like defined for a particular target but we’d like to not have the users be aware that they need to #include that header. Is it possible to set up a list of “default” header files that are always included for a particular target?

Phil

Try -include yourfile.h

Hi Phil

You can try add all your 'default include' headers into an umbrella header then add '-include umbrella.h' to your clang invocation. That is assume you are providing a build environment for your user. Otherwise, always add one line of #include at the beginning of every file might be simpler.

Steven

We've got some #define's we'd always like defined for a particular
target but we'd like to not have the users be aware that they need to
#include that header. Is it possible to set up a list of "default"
header files that are always included for a particular target?

Poke around in lib/Basic/Targets.cpp

The usual way to do this is to have your FooTargetInfo call methods on the MacroBuilder, and have it set your pre-#defined things that way.

Jon