diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2023-08-30 07:14:22 +0200 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-08-30 18:22:56 +0200 |
| commit | 5092df19372bd6957bd43649da43add30777212d (patch) | |
| tree | bfc20215881a8e8699739069dab898b95dfd3ec6 /demangle/third_party/llvm/lib/Demangle/Demangle.cpp | |
| parent | af6ca21ed0f2715aad0b2ae80d200589b5e31089 (diff) | |
kill demangle
Diffstat (limited to 'demangle/third_party/llvm/lib/Demangle/Demangle.cpp')
| -rw-r--r-- | demangle/third_party/llvm/lib/Demangle/Demangle.cpp | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/demangle/third_party/llvm/lib/Demangle/Demangle.cpp b/demangle/third_party/llvm/lib/Demangle/Demangle.cpp deleted file mode 100644 index b5f2369d..00000000 --- a/demangle/third_party/llvm/lib/Demangle/Demangle.cpp +++ /dev/null @@ -1,68 +0,0 @@ -//===-- Demangle.cpp - Common demangling functions ------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -/// -/// \file This file contains definitions of common demangling functions. -/// -//===----------------------------------------------------------------------===// - -#include "llvm/Demangle/Demangle.h" -#include <cstdlib> -#include <cstring> - -static bool isItaniumEncoding(const char *S) { - // Itanium encoding requires 1 or 3 leading underscores, followed by 'Z'. - return std::strncmp(S, "_Z", 2) == 0 || std::strncmp(S, "___Z", 4) == 0; -} - -#if 0 -static bool isRustEncoding(const char *S) { return S[0] == '_' && S[1] == 'R'; } - -static bool isDLangEncoding(const std::string &MangledName) { - return MangledName.size() >= 2 && MangledName[0] == '_' && - MangledName[1] == 'D'; -} -#endif - -std::string llvm::demangle(const std::string &MangledName) { - std::string Result; - const char *S = MangledName.c_str(); - - if (nonMicrosoftDemangle(S, Result)) - return Result; - - if (S[0] == '_' && nonMicrosoftDemangle(S + 1, Result)) - return Result; - - if (char *Demangled = - microsoftDemangle(S, nullptr, nullptr, nullptr, nullptr)) { - Result = Demangled; - std::free(Demangled); - return Result; - } - - return MangledName; -} - -bool llvm::nonMicrosoftDemangle(const char *MangledName, std::string &Result) { - char *Demangled = nullptr; - if (isItaniumEncoding(MangledName)) - Demangled = itaniumDemangle(MangledName, nullptr, nullptr, nullptr); -#if 0 - else if (isRustEncoding(MangledName)) - Demangled = rustDemangle(MangledName); - else if (isDLangEncoding(MangledName)) - Demangled = dlangDemangle(MangledName); -#endif - - if (!Demangled) - return false; - - Result = Demangled; - std::free(Demangled); - return true; -} |
