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 @@ -50,11 +50,12 @@ Mangled::ManglingScheme Mangled::GetManglingScheme(llvm::StringRef const name) {
50
50
return Mangled::eManglingSchemeRustV0;
51
51
52
52
if (name.starts_with (" _D" )) {
53
- // A dlang mangled name begins with `_D`, followed by a numeric length.
53
+ // A dlang mangled name begins with `_D`, followed by a numeric length. One
54
+ // known exception is the symbol `_Dmain`.
54
55
// See `SymbolName` and `LName` in
55
56
// https://dlang.org/spec/abi.html#name_mangling
56
57
llvm::StringRef buf = name.drop_front (2 );
57
- if (!buf.empty () && llvm::isDigit (buf.front ()))
58
+ if (!buf.empty () && ( llvm::isDigit (buf.front ()) || name == " _Dmain " ))
58
59
return Mangled::eManglingSchemeD;
59
60
}
60
61
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, RecognizeSwiftMangledNames) {
You can’t perform that action at this time.
0 commit comments