Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ CPlusPlusLanguage::GetFunctionNameInfo(ConstString name) const {

bool CPlusPlusLanguage::SymbolNameFitsToLanguage(Mangled mangled) const {
const char *mangled_name = mangled.GetMangledName().GetCString();
return mangled_name && Mangled::IsMangledName(mangled_name);
return mangled_name && Mangled::GetManglingScheme(mangled_name) ==
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm what about MS ABI?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I could check if it's Itanium of MSVC?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I suppose that should work. It's all best effort I guess, cause non-C++ languages may choose to mangle with the Itanium ABI. But yea your changes make sense

Mangled::eManglingSchemeItanium;
}

ConstString CPlusPlusLanguage::GetDemangledFunctionNameWithoutArguments(
Expand Down
13 changes: 13 additions & 0 deletions lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,3 +397,16 @@ TEST(CPlusPlusLanguage, CPlusPlusNameParser) {
// Don't crash.
CPlusPlusNameParser((const char *)nullptr);
}

TEST(CPlusPlusLanguage, DoesNotMatchCxx) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you're adding this here, can you add a case where we do match C++? Using Itanium and MS ABI examples?

// Test that a symbol name that is NOT C++ does not match C++.

SubsystemRAII<CPlusPlusLanguage> lang;
Language *CPlusPlusLang =
Language::FindPlugin(lldb::eLanguageTypeC_plus_plus);

EXPECT_TRUE(CPlusPlusLang != nullptr);

Mangled swiftSymbol("$sS");
EXPECT_FALSE(CPlusPlusLang->SymbolNameFitsToLanguage(swiftSymbol));
}
Loading