-
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
0becae4
commit 44e8fe0
Showing
7 changed files
with
65 additions
and
55 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,36 @@ | ||
#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_view 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.data(), nullptr, nullptr, &status), | ||
&std::free); | ||
|
||
if(status == 0) | ||
return std::string(demangled_name.get()); | ||
else | ||
demangled_name.reset(); | ||
#endif | ||
return std::string(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