Reputation: 1642
For example, at llvm/lib/Support/Unix/Signals.inc
within the llvm project. What's the point of using this suffix for a cpp file?
Upvotes: 8
Views: 14497
Reputation: 311
In the context of llvm .inc files are generated by tablegen files :
https://llvm.org/docs/TableGen/ProgRef.html
So the .inc extension is used to distinguish between auto generated headerfile vs manually written headerfiles.
Upvotes: 8
Reputation: 129494
The extension is just a different one than .h or .hpp. I wasn't there when whoever decided to name the file this way. There is no particular reason other than convention that determine extensions in general.
As Jonathan points out, it may be to distinguish it from "regular header files" that are usable anywhere.
The comment above the inclusion of these files is perhaps a reasonable explanation:
// Include the platform-specific parts of this class.
#ifdef LLVM_ON_UNIX
#include "Unix/Signals.inc"
#endif
#ifdef LLVM_ON_WIN32
#include "Windows/Signals.inc"
#endif
These contain platform specific parts, it is not, as such, a "header-file", it is just a portion of code that is dependent on the target architecture, and someone decided that it's better to have two separate files than to have a huge #ifdef
in the one source file. [A reasonable decision, in my mind, as the Unix file I looked at is several hundred lines, with further stuff included and some more #if
]
Upvotes: 13