Skip to content

[lldb] Fix Dlang symbol test breakage #94046

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lldb/source/Core/Mangled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@ Mangled::ManglingScheme Mangled::GetManglingScheme(llvm::StringRef const name) {
return Mangled::eManglingSchemeRustV0;

if (name.starts_with("_D")) {
// A dlang mangled name begins with `_D`, followed by a numeric length.
// A dlang mangled name begins with `_D`, followed by a numeric length. One
// known exception is the symbol `_Dmain`.
// See `SymbolName` and `LName` in
// https://dlang.org/spec/abi.html#name_mangling
llvm::StringRef buf = name.drop_front(2);
if (!buf.empty() && llvm::isDigit(buf.front()))
if (!buf.empty() && (llvm::isDigit(buf.front()) || name == "_Dmain"))
return Mangled::eManglingSchemeD;
}

Expand Down
4 changes: 2 additions & 2 deletions lldb/unittests/Core/MangledTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ TEST(MangledTest, ResultForValidDLangName) {
EXPECT_STREQ(expected_result.GetCString(), the_demangled.GetCString());
}

TEST(MangledTest, EmptyForInvalidDLangName) {
TEST(MangledTest, SameForInvalidDLangPrefixedName) {
ConstString mangled_name("_DDD");
Mangled the_mangled(mangled_name);
ConstString the_demangled = the_mangled.GetDemangledName();

EXPECT_STREQ("", the_demangled.GetCString());
EXPECT_STREQ("_DDD", the_demangled.GetCString());
}

TEST(MangledTest, RecognizeSwiftMangledNames) {
Expand Down