Add DemangleTypeName function
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <Windows.h>
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#include <cxxabi.h>
|
||||
#endif
|
||||
#include <fstream>
|
||||
#include <filesystem>
|
||||
@@ -90,5 +91,15 @@ namespace OpenVulkano
|
||||
template Array<char> Utils::ReadFile<std::string>(const std::string& filePath, bool emptyOnMissing, bool nullTerminateString);
|
||||
template Array<char> Utils::ReadFile<std::filesystem::path>(const std::filesystem::path& filePath,
|
||||
bool emptyOnMissing, bool nullTerminateString);
|
||||
|
||||
|
||||
std::string Utils::DemangleTypeName(const char* name)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
return name
|
||||
#else
|
||||
int status = 0;
|
||||
std::unique_ptr<char, void(*)(void*)> res(abi::__cxa_demangle(name, NULL, NULL, &status), std::free);
|
||||
return (status==0) ? res.get() : name ;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user