diff options
Diffstat (limited to 'lldb/source/Core/Mangled.cpp')
| -rw-r--r-- | lldb/source/Core/Mangled.cpp | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/lldb/source/Core/Mangled.cpp b/lldb/source/Core/Mangled.cpp index 3f64a3d630b..545ac51c870 100644 --- a/lldb/source/Core/Mangled.cpp +++ b/lldb/source/Core/Mangled.cpp @@ -16,34 +16,24 @@ #pragma comment(lib, "dbghelp.lib") #endif -#ifdef LLDB_USE_BUILTIN_DEMANGLER -// Provide a fast-path demangler implemented in FastDemangle.cpp until it can -// replace the existing C++ demangler with a complete implementation -#include "lldb/Utility/FastDemangle.h" -#include "llvm/Demangle/Demangle.h" -#else -// FreeBSD9-STABLE requires this to know about size_t in cxxabi. -#include <cstddef> -#include <cxxabi.h> -#endif - #include "lldb/Utility/ConstString.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/Logging.h" #include "lldb/Utility/RegularExpression.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/Timer.h" -#include "lldb/lldb-enumerations.h" // for LanguageType +#include "lldb/lldb-enumerations.h" #include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h" #include "Plugins/Language/ObjC/ObjCLanguage.h" -#include "llvm/ADT/StringRef.h" // for StringRef -#include "llvm/Support/Compiler.h" // for LLVM_PRETT... +#include "llvm/ADT/StringRef.h" +#include "llvm/Demangle/Demangle.h" +#include "llvm/Support/Compiler.h" -#include <mutex> // for mutex, loc... -#include <string> // for string -#include <utility> // for pair +#include <mutex> +#include <string> +#include <utility> #include <stdlib.h> #include <string.h> @@ -295,18 +285,15 @@ Mangled::GetDemangledName(lldb::LanguageType language) const { break; } case eManglingSchemeItanium: { -#ifdef LLDB_USE_BUILTIN_DEMANGLER - if (log) - log->Printf("demangle itanium: %s", mangled_name); - // Try to use the fast-path demangler first for the performance win, - // falling back to the full demangler only when necessary - demangled_name = FastDemangle(mangled_name, m_mangled.GetLength()); - if (!demangled_name) - demangled_name = - llvm::itaniumDemangle(mangled_name, NULL, NULL, NULL); -#else - demangled_name = abi::__cxa_demangle(mangled_name, NULL, NULL, NULL); -#endif + llvm::ItaniumPartialDemangler IPD; + bool demangle_err = IPD.partialDemangle(mangled_name); + if (!demangle_err) { + // Default buffer and size (realloc is used in case it's too small). + size_t demangled_size = 80; + demangled_name = static_cast<char *>(::malloc(demangled_size)); + demangled_name = IPD.finishDemangle(demangled_name, &demangled_size); + } + if (log) { if (demangled_name) log->Printf("demangled itanium: %s -> \"%s\"", mangled_name, |

