Skip to content

Commit 4c0aa2c

Browse files
committed
[LLDB] Handle i686 mingw32 mangling prefix
1 parent 0aba5bf commit 4c0aa2c

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

lldb/source/Core/Mangled.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ Mangled::ManglingScheme Mangled::GetManglingScheme(llvm::StringRef const name) {
6363
if (name.starts_with("_Z"))
6464
return Mangled::eManglingSchemeItanium;
6565

66+
// __Z is used on i686 mingw32
67+
if (name.starts_with("__Z"))
68+
return Mangled::eManglingSchemeItanium;
69+
6670
// ___Z is a clang extension of block invocations
6771
if (name.starts_with("___Z"))
6872
return Mangled::eManglingSchemeItanium;

lldb/unittests/Core/MangledTest.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,23 @@ TEST(MangledTest, SameForInvalidDLangPrefixedName) {
114114
EXPECT_STREQ("_DDD", the_demangled.GetCString());
115115
}
116116

117+
TEST(MangledTest, ResultForValidMingw32Name) {
118+
ConstString mangled_name("__Z7recursei");
119+
Mangled the_mangled(mangled_name);
120+
ConstString the_demangled = the_mangled.GetDemangledName();
121+
122+
ConstString expected_result("recurse(int)");
123+
EXPECT_STREQ(expected_result.GetCString(), the_demangled.GetCString());
124+
}
125+
126+
TEST(MangledTest, EmptyForInvalidMingw32Name) {
127+
ConstString mangled_name("__Zzrecursei");
128+
Mangled the_mangled(mangled_name);
129+
ConstString the_demangled = the_mangled.GetDemangledName();
130+
131+
EXPECT_STREQ("", the_demangled.GetCString());
132+
}
133+
117134
TEST(MangledTest, RecognizeSwiftMangledNames) {
118135
llvm::StringRef valid_swift_mangled_names[] = {
119136
"_TtC4main7MyClass", // Mangled objc class name

0 commit comments

Comments
 (0)