File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -59,11 +59,12 @@ Mangled::ManglingScheme Mangled::GetManglingScheme(llvm::StringRef const name) {
59
59
return Mangled::eManglingSchemeRustV0;
60
60
61
61
if (name.startswith (" _D" )) {
62
- // A dlang mangled name begins with `_D`, followed by a numeric length.
62
+ // A dlang mangled name begins with `_D`, followed by a numeric length. One
63
+ // known exception is the symbol `_Dmain`.
63
64
// See `SymbolName` and `LName` in
64
65
// https://dlang.org/spec/abi.html#name_mangling
65
66
llvm::StringRef buf = name.drop_front (2 );
66
- if (!buf.empty () && llvm::isDigit (buf.front ()))
67
+ if (!buf.empty () && ( llvm::isDigit (buf.front ()) || name == " _Dmain " ))
67
68
return Mangled::eManglingSchemeD;
68
69
}
69
70
Original file line number Diff line number Diff line change @@ -81,12 +81,12 @@ TEST(MangledTest, ResultForValidDLangName) {
81
81
EXPECT_STREQ (expected_result.GetCString (), the_demangled.GetCString ());
82
82
}
83
83
84
- TEST (MangledTest, EmptyForInvalidDLangName ) {
84
+ TEST (MangledTest, SameForInvalidDLangPrefixedName ) {
85
85
ConstString mangled_name (" _DDD" );
86
86
Mangled the_mangled (mangled_name);
87
87
ConstString the_demangled = the_mangled.GetDemangledName ();
88
88
89
- EXPECT_STREQ (" " , the_demangled.GetCString ());
89
+ EXPECT_STREQ (" _DDD " , the_demangled.GetCString ());
90
90
}
91
91
92
92
TEST (MangledTest, BoolConversionOperator) {
You can’t perform that action at this time.
0 commit comments