-
Notifications
You must be signed in to change notification settings - Fork 59
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 a6ffd65
Showing
7 changed files
with
76 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,49 @@ | ||
//@HEADER | ||
// ************************************************************************ | ||
// | ||
// Kokkos v. 4.0 | ||
// Copyright (2022) National Technology & Engineering | ||
// Solutions of Sandia, LLC (NTESS). | ||
// | ||
// Under the terms of Contract DE-NA0003525 with NTESS, | ||
// the U.S. Government retains certain rights in this software. | ||
// | ||
// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://kokkos.org/LICENSE for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//@HEADER | ||
|
||
#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 { | ||
|
||
//! Demangle @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()); | ||
#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