capstone
capstone copied to clipboard
[Auto-Sync] Translate templates to functions and not macros
Currently C++ template functions are translated to macros:
template<int targ>
void func() {
return targ;
}
becomes
#define DEFINE_func(targ) \
void func_##targ() { \
return targ; \
}
This is helpful, because targ can also be a type. Also it mimics the sematic closer.
On the other hand it leads to many many duplicated functions and is bad for general obj file size. Also it is annoying to debug (you cannot set breakpoints in macros).
The CppTranslator should instead generate the templates as functions and pass the template arguments via additional parameter.
The edge case of template<typename T> must be handled somehow.