-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
space-time-stack: allow demangled names
- Loading branch information
1 parent
6dae155
commit 7db6e97
Showing
7 changed files
with
75 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#ifndef KOKKOSTOOLS_COMMON_UTILS_DEMANGLE_HPP | ||
#define KOKKOSTOOLS_COMMON_UTILS_DEMANGLE_HPP | ||
|
||
#include <memory> | ||
#include <string> | ||
|
||
#if defined(__GXX_ABI_VERSION) | ||
#define HAVE_GCC_ABI_DEMANGLE | ||
#endif | ||
|
||
#if defined(HAVE_GCC_ABI_DEMANGLE) | ||
#include <cxxabi.h> | ||
#endif // HAVE_GCC_ABI_DEMANGLE | ||
|
||
namespace KokkosTools | ||
{ | ||
|
||
//! Demangme @p mangled_name. | ||
inline std::string demangleName(const std::string& mangled_name) | ||
{ | ||
#if defined(HAVE_GCC_ABI_DEMANGLE) | ||
int status = 0; | ||
|
||
std::unique_ptr<char, decltype(&std::free)> demangled_name( | ||
abi::__cxa_demangle(mangled_name.c_str(), nullptr, nullptr, &status), | ||
&std::free | ||
); | ||
|
||
if(status == 0) return std::string(demangled_name.get()); | ||
else demangled_name.reset(); | ||
#endif | ||
return mangled_name; | ||
} | ||
|
||
} // namespace KokkosTools | ||
|
||
#endif // KOKKOSTOOLS_COMMON_UTILS_DEMANGLE_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters