-
Notifications
You must be signed in to change notification settings - Fork 15.5k
[lldb] Fix CXX's SymbolNameFitsToLanguage matching other languages #153685
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -397,3 +397,33 @@ TEST(CPlusPlusLanguage, CPlusPlusNameParser) { | |
| // Don't crash. | ||
| CPlusPlusNameParser((const char *)nullptr); | ||
| } | ||
|
|
||
| TEST(CPlusPlusLanguage, DoesNotMatchCxx) { | ||
| // 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)); | ||
| } | ||
|
|
||
| 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"); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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)); | ||
| } | ||
There was a problem hiding this comment.
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?