File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff 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;
Original file line number Diff line number Diff 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+
117134TEST(MangledTest, RecognizeSwiftMangledNames) {
118135 llvm::StringRef valid_swift_mangled_names[] = {
119136 "_TtC4main7MyClass", // Mangled objc class name
You can’t perform that action at this time.
0 commit comments