OpenMPToolsInterface / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. Note: the repository does not accept github pull requests at this moment. Please submit your patches at http://reviews.llvm.org.
http://llvm.org
2 stars 4 forks source link

Implemented API ompd_get_omp_version_string() #40

Closed vigbalu closed 9 months ago

vigbalu commented 3 years ago

Current one is a skeletal implementation and returns "". Implemented to return omp version string.

vigbalu commented 3 years ago

I can have helper function as below, but seems it can be used only in couple of places. Not possible in (#37 ) because there is a concatenation operation after string is copied. We might have to add another helper function for concatenation which has to free and reallocate memory. I feel helper function would be better if there is more instances of these operations.

Please let me know your thoughts

ompd_rc_t alloc_and_copy_str (const char* str, char new_str) { ompd_rc_t ret; int str_length = strlen(str) + 1/for '\0'/; ret = callbacks->alloc_memory(str_length, (void ) new_str); if (ret != ompd_rc_ok) { return ret; }

strcpy (*new_str, str); return ompd_rc_ok; }

jprotze commented 3 years ago

I'm fine either way, we just cannot use static memory here.