"Automatic explicit" template instantiation?

Dear Clang developers,

In order to get better re-compilation speeds for heavily templated code,
it is sometimes suggested to move the definition of a template out of a header file, and use explicit instantiation.

It seems that IBM’s C++ compiler features a technique (“tempinc”) that can generate such explicit instantiations automatically, as long as the developer adheres to some rules. See, for example: http://www.msg.ucsf.edu/local/programs/IBM_Compilers/C:C++/html/compiler/ref/tutmplat5.htm

Note that I have never used the IBM compiler and its “tempinc” technique myself,
but I was wondering whether people on this list are familiar with and/or have experience with this technique and whether it has been considered for inclusion into Clang (or why it was rejected).

Kind regards,
Niek J Bouman

I haven’t contributed to Clang yet, and I’m not familiar with IBM’s anything really, but I feel like your proposal is beating around the bush a bit.

In my opinion, Clang is too deeply coupled and adheres too closely to the OOP style.

For example, the Sena class is over 10,000 lines, all by it’s self.

That to me is an indication that it’s trying to do too much.

I don’t believe in hard limits, but my modules are around 1000-1200 lines total, including both the struct definitions and function definitions that operate on them.

Hell, my (slightly minimal but not overly so) Unicode library which supports UTF-8, UTF-16, and UTF-32 is only about 3200 lines, and it includes a string formatting subsystem and String to Number and Number to String subsystems…

My point is that Clang’s abstraction layers aren’t broken down in the correct places, and it could use some serious refactoring.

I might have been unclear, but by “heavily templated code” I was referring to *user code*, not to Clang’s codebase.

So my question is about an optional compiler feature, provided to users of the compiler, instead of suggesting to refactor Clang’s codebase.

Kind regards,

I see, I totally misread that, sorry for the confusion.

I thought you were trying to optimze how long it takes to compile Clang it’s self.