Skip to content
Open
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
52 changes: 31 additions & 21 deletions lldb/source/Core/Module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,11 @@ Module::LookupInfo::LookupInfo(ConstString name,
if (language != eLanguageTypeUnknown)
lang_types.push_back(language);
else
lang_types = {eLanguageTypeObjC, eLanguageTypeC_plus_plus};
lang_types = {eLanguageTypeObjC, eLanguageTypeC_plus_plus,
#ifdef LLDB_ENABLE_SWIFT
eLanguageTypeSwift
#endif
};

for (LanguageType lang_type : lang_types) {
if (Language *lang = Language::FindPlugin(lang_type))
Expand Down Expand Up @@ -729,27 +733,33 @@ bool Module::LookupInfo::NameMatchesLookupInfo(
if (m_name == function_name)
return true;

// If function_name is mangled, we'll need to demangle it.
// In the pathologial case where the function name "looks" mangled but is
// actually demangled (e.g. a method named _Zonk), this operation should be
// relatively inexpensive since no demangling is actually occuring. See
// Mangled::SetValue for more context.
const bool function_name_may_be_mangled =
Mangled::GetManglingScheme(function_name) != Mangled::eManglingSchemeNone;
ConstString demangled_function_name = function_name;
if (function_name_may_be_mangled) {
Mangled mangled_function_name(function_name);
demangled_function_name = mangled_function_name.GetDemangledName();
}

// If the symbol has a language, then let the language make the match.
// Otherwise just check that the demangled function name contains the
// demangled user-provided name.
if (Language *language = Language::FindPlugin(language_type))
return language->DemangledNameContainsPath(m_name, demangled_function_name);
// If function_name or m_name is mangled, we'll need to demangle it and
// compare with its counterpart. In the pathological case where the function
// name "looks" mangled but is actually demangled (e.g. a method named _Zonk),
// this operation should be relatively inexpensive since no demangling is
// actually occuring. See Mangled::SetValue for more context.
auto match_maybe_mangled_name = [&](ConstString maybe_mangled_name, ConstString function_name) {
const bool function_name_may_be_mangled =
Mangled::GetManglingScheme(maybe_mangled_name) !=
Mangled::eManglingSchemeNone;
ConstString demangled_function_name = maybe_mangled_name;
if (function_name_may_be_mangled) {
Mangled mangled_function_name(maybe_mangled_name);
demangled_function_name = mangled_function_name.GetDemangledName();
}

llvm::StringRef function_name_ref = demangled_function_name;
return function_name_ref.contains(m_name);
// If the symbol has a language, then let the language make the match.
// Otherwise just check that the demangled function name contains the
// demangled user-provided name.
if (Language *language = Language::FindPlugin(language_type))
return language->DemangledNameContainsPath(function_name,
demangled_function_name);
llvm::StringRef function_name_ref = demangled_function_name;
return function_name_ref.contains(m_name);
};

return match_maybe_mangled_name(function_name, m_name) ||
match_maybe_mangled_name(m_name, function_name);
}

void Module::LookupInfo::Prune(SymbolContextList &sc_list,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class TestCrossDSOTailCalls(TestBase):
@skipIf(compiler="clang", compiler_version=["<", "10.0"])
@skipIf(dwarf_version=["<", "4"])
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr26265")
@expectedFailureAll(archs=['arm', 'aarch64'], bugnumber="llvm.org/PR44561")
def test_cross_dso_tail_calls(self):
self.build()
exe = self.getBuildArtifact("a.out")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class TestCrossObjectTailCalls(TestBase):
@skipIf(compiler="clang", compiler_version=["<", "10.0"])
@skipIf(dwarf_version=["<", "4"])
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr26265")
@expectedFailureAll(archs=['arm', 'aarch64'], bugnumber="llvm.org/PR44561")
def test_cross_object_tail_calls(self):
self.build()
exe = self.getBuildArtifact("a.out")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@
Tests that we can break on a partial name of a Swift function
Effectively tests our chopper of Swift demangled names
"""
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbutil as lldbutil

@skipIf(bugnumber = "rdar://159531198")
class SwiftPartialBreakTest(TestBase):
@swiftTest
def test_swift_partial_break(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def execute_command(command):
(exit_status, output) = subprocess.getstatusoutput(command)
return exit_status

@skipIf(bugnumber = "rdar://159531216")
class TestUnitTests(TestBase):
@swiftTest
@skipIf(debug_info=no_match(["dsym"]), bugnumber="This test is building a dSYM")
Expand Down