aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Expression/IRExecutionUnit.cpp
diff options
context:
space:
mode:
authorAlex Langford <apl@fb.com>2021-09-20 14:39:13 -0700
committerAlex Langford <apl@fb.com>2021-09-29 11:39:09 -0700
commit385b2189cc4446745e1ea4ac803c22b3daef73ec (patch)
treea60df226440d0a323ec2ba29bd99b15f7352223b /lldb/source/Expression/IRExecutionUnit.cpp
parent565d45541f860d72b2e2f12001104edd78f5b0c3 (diff)
downloadllvm-385b2189cc4446745e1ea4ac803c22b3daef73ec.tar.gz
llvm-385b2189cc4446745e1ea4ac803c22b3daef73ec.tar.bz2
llvm-385b2189cc4446745e1ea4ac803c22b3daef73ec.zip
[lldb] Remove Expression's dependency on CPlusPlusLanguagePlugin
This change accomplishes the following: - Moves `IRExecutionUnit::FindBestAlternateMangledName` to `Language`. - Renames `FindBestAlternateMangledName` to `FindBestAlternateFunctionMangledName` - Changes the first parameter of said method from a `ConstString` representing a demangled name to a `Mangled`. - Remove the use of CPlusPlusLanguage from Expression
Diffstat (limited to 'lldb/source/Expression/IRExecutionUnit.cpp')
-rw-r--r--lldb/source/Expression/IRExecutionUnit.cpp55
1 files changed, 4 insertions, 51 deletions
diff --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp
index 39ece8308641..f2d22f7ed9cc 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ b/lldb/source/Expression/IRExecutionUnit.cpp
@@ -26,6 +26,7 @@
#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Target/ExecutionContext.h"
+#include "lldb/Target/Language.h"
#include "lldb/Target/LanguageRuntime.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/DataBufferHeap.h"
@@ -33,7 +34,6 @@
#include "lldb/Utility/LLDBAssert.h"
#include "lldb/Utility/Log.h"
-#include "lldb/../../source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
#include "lldb/../../source/Plugins/ObjectFile/JIT/ObjectFileJIT.h"
using namespace lldb_private;
@@ -652,52 +652,6 @@ uint8_t *IRExecutionUnit::MemoryManager::allocateDataSection(
return return_value;
}
-static ConstString FindBestAlternateMangledName(ConstString demangled,
- const SymbolContext &sym_ctx) {
- CPlusPlusLanguage::MethodName cpp_name(demangled);
- std::string scope_qualified_name = cpp_name.GetScopeQualifiedName();
-
- if (!scope_qualified_name.size())
- return ConstString();
-
- if (!sym_ctx.module_sp)
- return ConstString();
-
- lldb_private::SymbolFile *sym_file = sym_ctx.module_sp->GetSymbolFile();
- if (!sym_file)
- return ConstString();
-
- std::vector<ConstString> alternates;
- sym_file->GetMangledNamesForFunction(scope_qualified_name, alternates);
-
- std::vector<ConstString> param_and_qual_matches;
- std::vector<ConstString> param_matches;
- for (size_t i = 0; i < alternates.size(); i++) {
- ConstString alternate_mangled_name = alternates[i];
- Mangled mangled(alternate_mangled_name);
- ConstString demangled = mangled.GetDemangledName();
-
- CPlusPlusLanguage::MethodName alternate_cpp_name(demangled);
- if (!cpp_name.IsValid())
- continue;
-
- if (alternate_cpp_name.GetArguments() == cpp_name.GetArguments()) {
- if (alternate_cpp_name.GetQualifiers() == cpp_name.GetQualifiers())
- param_and_qual_matches.push_back(alternate_mangled_name);
- else
- param_matches.push_back(alternate_mangled_name);
- }
- }
-
- if (param_and_qual_matches.size())
- return param_and_qual_matches[0]; // It is assumed that there will be only
- // one!
- else if (param_matches.size())
- return param_matches[0]; // Return one of them as a best match
- else
- return ConstString();
-}
-
void IRExecutionUnit::CollectCandidateCNames(std::vector<ConstString> &C_names,
ConstString name) {
if (m_strip_underscore && name.AsCString()[0] == '_')
@@ -712,10 +666,9 @@ void IRExecutionUnit::CollectCandidateCPlusPlusNames(
for (const ConstString &name : C_names) {
Mangled mangled(name);
if (cpp_lang->SymbolNameFitsToLanguage(mangled)) {
- if (ConstString demangled = mangled.GetDemangledName()) {
- if (ConstString best_alternate_mangled_name =
- FindBestAlternateMangledName(demangled, sc))
- CPP_names.push_back(best_alternate_mangled_name);
+ if (ConstString best_alternate =
+ cpp_lang->FindBestAlternateFunctionMangledName(mangled, sc)) {
+ CPP_names.push_back(best_alternate);
}
}