From 4504bba7d0a060f564a9a0137d989005db0fe1b4 Mon Sep 17 00:00:00 2001 From: Christopher Ferris Date: Thu, 1 Jun 2017 17:37:09 -0700 Subject: [PATCH] Fix handling of _ZLXX. Mangled names of the form _ZLXX, where XX is a number is now properly demangled. Test: Ran new unit tests. Change-Id: I89fbb36d2294c46da428c75bd1a2f39f69ac4b43 --- demangle/DemangleTest.cpp | 8 ++++++++ demangle/Demangler.cpp | 2 ++ 2 files changed, 10 insertions(+) diff --git a/demangle/DemangleTest.cpp b/demangle/DemangleTest.cpp index 5e17362d9..f56a9be3c 100644 --- a/demangle/DemangleTest.cpp +++ b/demangle/DemangleTest.cpp @@ -196,6 +196,14 @@ TEST(DemangleTest, FunctionStartsWithNumber) { ASSERT_EQ("value(one, signed char)", demangler.Parse("_Z5value3onea")); } +TEST(DemangleTest, FunctionStartsWithLPlusNumber) { + Demangler demangler; + + ASSERT_EQ("value(char, int)", demangler.Parse("_ZL5valueci")); + ASSERT_EQ("abcdefjklmn(signed char)", demangler.Parse("_ZL11abcdefjklmna")); + ASSERT_EQ("value(one, signed char)", demangler.Parse("_ZL5value3onea")); +} + TEST(DemangleTest, StdTypes) { Demangler demangler; diff --git a/demangle/Demangler.cpp b/demangle/Demangler.cpp index 1b7406dd3..c0a96aae5 100644 --- a/demangle/Demangler.cpp +++ b/demangle/Demangler.cpp @@ -698,6 +698,8 @@ const char* Demangler::FindFunctionName(const char* name) { if (std::isdigit(*name)) { name = GetStringFromLength(name, &function_name_); + } else if (*name == 'L' && std::isdigit(name[1])) { + name = GetStringFromLength(name + 1, &function_name_); } else { name = AppendOperatorString(name); function_name_ = cur_state_.str;