aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/restricted/abseil-cpp/absl/debugging/internal/demangle.cc
diff options
context:
space:
mode:
authorthegeorg <thegeorg@yandex-team.com>2024-01-25 20:29:07 +0300
committerthegeorg <thegeorg@yandex-team.com>2024-01-25 20:51:18 +0300
commit24abb4e0b50dd362e8cf30a682d5212252936b09 (patch)
treec5356c59cfe5480daca33b63b1742680a48586e8 /contrib/restricted/abseil-cpp/absl/debugging/internal/demangle.cc
parentb65dd88d2d36688300317c22b9c14ed9dcdeb37d (diff)
downloadydb-24abb4e0b50dd362e8cf30a682d5212252936b09.tar.gz
Update contrib/restricted/abseil-cpp to 20240116.0
Diffstat (limited to 'contrib/restricted/abseil-cpp/absl/debugging/internal/demangle.cc')
-rw-r--r--contrib/restricted/abseil-cpp/absl/debugging/internal/demangle.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/contrib/restricted/abseil-cpp/absl/debugging/internal/demangle.cc b/contrib/restricted/abseil-cpp/absl/debugging/internal/demangle.cc
index f2832915bf..381a2b504b 100644
--- a/contrib/restricted/abseil-cpp/absl/debugging/internal/demangle.cc
+++ b/contrib/restricted/abseil-cpp/absl/debugging/internal/demangle.cc
@@ -21,7 +21,15 @@
#include <cstdint>
#include <cstdio>
+#include <cstdlib>
#include <limits>
+#include <string>
+
+#include "absl/base/config.h"
+
+#if ABSL_INTERNAL_HAS_CXA_DEMANGLE
+#include <cxxabi.h>
+#endif
namespace absl {
ABSL_NAMESPACE_BEGIN
@@ -1983,6 +1991,22 @@ bool Demangle(const char* mangled, char* out, size_t out_size) {
state.parse_state.out_cur_idx > 0;
}
+std::string DemangleString(const char* mangled) {
+ std::string out;
+ int status = 0;
+ char* demangled = nullptr;
+#if ABSL_INTERNAL_HAS_CXA_DEMANGLE
+ demangled = abi::__cxa_demangle(mangled, nullptr, nullptr, &status);
+#endif
+ if (status == 0 && demangled != nullptr) {
+ out.append(demangled);
+ free(demangled);
+ } else {
+ out.append(mangled);
+ }
+ return out;
+}
+
} // namespace debugging_internal
ABSL_NAMESPACE_END
} // namespace absl