Not generating a translation unit directly but including the generated part is great.
However, emitting everything into a single file and selecting using preprocessor directives doesn't seem what other tablegen targets are doing. E.g. for intrinsics there is IntrinsicImpl.inc, IntrinsicEnums.inc. Clang has Attrs.inc, AttrImpl.inc, AttrVisitor.inc, etc.
The reason why MLIR does not split declaration and implementation-generation might be that nobody yet wanted to invest the work to split them. While I would not request splitting tablegen-generated files into separate files, fusing feels like a step backwards. If only implementation details change, with a merged output everything that includes OMP.h must be recompiled as well. I don't see how a separation into declaration and implementation causes the number of files to explode.
We are not fusing header and implementation. We had initially 3 files and after comments from a previous patch it was recommended to reduce that to two files. So after this patch you will have one header file and the implementation with the different code block.
OK, I found the header include is generated in CMakeLists.txt in include/llvm/Frontend. This patch removes the "-gen-directive-impl" target and integrates it into "-gen-directive-gen". IMHO "-gen-directive-impl" is the better name for for the implementation file, following the scheme set by "AttrImpl.inc" and "IntrinsicImpl.inc".
Sorry for me not noticing that there have been 3 tablegen targets per td.