Skip to content
Merged
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
17 changes: 17 additions & 0 deletions lldb/unittests/Language/CPlusPlus/CPlusPlusLanguageTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,3 +410,20 @@ TEST(CPlusPlusLanguage, DoesNotMatchCxx) {
Mangled swiftSymbol("$sS");
EXPECT_FALSE(CPlusPlusLang->SymbolNameFitsToLanguage(swiftSymbol));
}

TEST(CPlusPlusLanguage, MatchesCxx) {
// Test that a symbol name that is C++ does match C++ (both Itanium and MSVC).

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

EXPECT_TRUE(CPlusPlusLang != nullptr);

Mangled itaniumSymbol("_ZFoo");
Copy link
Member

Choose a reason for hiding this comment

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

Not that it matters much, but should we make these actually demangle-able symbols?

Some minimal ones are:

_Z3Foo
___Z3Bar_block_invoke
?x@@3AH

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah only saw your comment after merging. I'll make them real symbols.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here #153857

EXPECT_TRUE(CPlusPlusLang->SymbolNameFitsToLanguage(itaniumSymbol));
Mangled itaniumExtensionSymbol("___ZBar");
EXPECT_TRUE(CPlusPlusLang->SymbolNameFitsToLanguage(itaniumExtensionSymbol));
Mangled msvcSymbol("?Baz");
EXPECT_TRUE(CPlusPlusLang->SymbolNameFitsToLanguage(msvcSymbol));
}
Loading