[cfe-dev] Emitting code for instantiated templates

Harmen van der Spek hvdspek at liacs.nl
Fri Oct 15 06:55:49 PDT 2010


Hi,

Is there a possibility in Clang to emit C++ code in which all templates 
have been instantiated? I would like to have a different source location
for each specific instantiation, such that I can use clang::Rewriter to
edit each instantiation separately.

For example:

template <typename T>
class A {
	T field;
};

int main() {
   A<int> a;
   A<float> b;
}

Would become something like:

class A_int {
   int field;
};

class A_float {
   float field;
};

int main() {
   A_int a;
   B_float b;
}


Thanks,

Harmen




More information about the cfe-dev mailing list