diff options
author | Stefan Granitz <stefan.graenitz@gmail.com> | 2018-07-25 15:19:04 +0000 |
---|---|---|
committer | Stefan Granitz <stefan.graenitz@gmail.com> | 2018-07-25 15:19:04 +0000 |
commit | 2f842d68df805e26b81373647b4471dd49cef8f4 (patch) | |
tree | c09257b64198f60b1150e742a994762136dd3d22 /lldb/unittests/Core/MangledTest.cpp | |
parent | ee10ce713749a5aa2fe9a3033f1828529d138eeb (diff) | |
download | bcm5719-llvm-2f842d68df805e26b81373647b4471dd49cef8f4.tar.gz bcm5719-llvm-2f842d68df805e26b81373647b4471dd49cef8f4.zip |
Use LLVM's new ItaniumPartialDemangler in LLDB
Summary:
Replace the existing combination of FastDemangle and the fallback to llvm::itaniumDemangle() with LLVM's new ItaniumPartialDemangler. It slightly reduces complexity and slightly improves performance, but doesn't introduce conceptual changes. This patch is preparing for more fundamental improvements on LLDB's demangling approach.
Reviewers: friss, jingham, erik.pilkington, labath, clayborg, mgorny, davide, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: teemperor, JDevlieghere, labath, clayborg, davide, lldb-commits, mgorny, erik.pilkington
Differential Revision: https://reviews.llvm.org/D49612
llvm-svn: 337931
Diffstat (limited to 'lldb/unittests/Core/MangledTest.cpp')
-rw-r--r-- | lldb/unittests/Core/MangledTest.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/lldb/unittests/Core/MangledTest.cpp b/lldb/unittests/Core/MangledTest.cpp new file mode 100644 index 00000000000..7deb901f560 --- /dev/null +++ b/lldb/unittests/Core/MangledTest.cpp @@ -0,0 +1,38 @@ +//===-- MangledTest.cpp -----------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "gtest/gtest.h" + +#include "lldb/Core/Mangled.h" + +using namespace lldb; +using namespace lldb_private; + +TEST(MangledTest, ResultForValidName) { + ConstString MangledName("_ZN1a1b1cIiiiEEvm"); + bool IsMangled = true; + + Mangled TheMangled(MangledName, IsMangled); + const ConstString &TheDemangled = + TheMangled.GetDemangledName(eLanguageTypeC_plus_plus); + + ConstString ExpectedResult("void a::b::c<int, int, int>(unsigned long)"); + EXPECT_STREQ(ExpectedResult.GetCString(), TheDemangled.GetCString()); +} + +TEST(MangledTest, EmptyForInvalidName) { + ConstString MangledName("_ZN1a1b1cmxktpEEvm"); + bool IsMangled = true; + + Mangled TheMangled(MangledName, IsMangled); + const ConstString &TheDemangled = + TheMangled.GetDemangledName(eLanguageTypeC_plus_plus); + + EXPECT_STREQ("", TheDemangled.GetCString()); +} |