Skip to content

Commit c24d7bf

Browse files
committed
[lldb] Fix that C++ base name is only calculated when Swift plugin is enabled
In 41c6ab2 I put the C++ GetBasename() call in Module::LookupInfo behind the LLDB_ENABLE_SWIFT as it appeard to be introduced by a downstream Swift change. However our downstream change actually changed ``` basename = cpp_method.GetBasename(); ``` into ``` if (swift) /*swift stuff*/ else if (c++) basename = cpp_method.GetBasename(); ``` By putting both if and the else behind LLDB_ENABLE_SWIFT this actually broke LLDB's ability to set C++ breakpoints by function name when LLDB_ENABLE_SWIFT wasn't set (which in turn broke the TestCPPBreakpointLocations test). This patch moves `#ifdef LLDB_ENABLE_SWIFT` only around the Swift-specific part and leaves the basename calculation enabled independently of Swift. I also removed the unnecessary `else` as we can't have a method that has both a language value of Swift and C++, so those branches are anyway mutually exlusive and comparing the `language` enum value is cheap.
1 parent 7669e9d commit c24d7bf

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lldb/source/Core/Module.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -681,13 +681,11 @@ Module::LookupInfo::LookupInfo(ConstString name,
681681
language == eLanguageTypeSwift) &&
682682
swift_method.IsValid())
683683
basename = swift_method.GetBasename();
684-
else if ((language == eLanguageTypeUnknown ||
685-
Language::LanguageIsCPlusPlus(language) ||
686-
Language::LanguageIsC(language) ||
687-
language == eLanguageTypeObjC_plus_plus) &&
688-
cpp_method.IsValid())
689-
basename = cpp_method.GetBasename();
690684
#endif // LLDB_ENABLE_SWIFT
685+
if ((language == eLanguageTypeUnknown ||
686+
Language::LanguageIsCFamily(language)) &&
687+
cpp_method.IsValid())
688+
basename = cpp_method.GetBasename();
691689

692690
if (basename.empty()) {
693691
if (CPlusPlusLanguage::ExtractContextAndIdentifier(name_cstr, context,

0 commit comments

Comments
 (0)