[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[creduce-dev] templates
It's great that people have been submitting pull requests lately (and
that Yang has been accepting them)!
I was thinking about sitting down and writing a clang_delta pass that
would take the example below (from C-Reduce issue #66) and push first
the char * template parameter and second the int parameter through the code.
Actually we probably want two new passes: one that propagates parameters
around, and another that eliminates unused template arguments.
But, I haven't hacked clang before and am not even sure how to get
started. Is there anyone here who hacks on clang who could give me a
quick outline of what the implementation to these would probably look
like? What APIs to use, basically?
Thanks,
John
#include <iostream>
template <typename T, typename> class cls {
public:
static void foo(T);
};
template <typename T, typename F> void cls<T, F>::foo(T a) { std::cout
<< a; }
int main() { cls<char *, int>::foo("hello"); }