[Lldb-commits] [PATCH] D109928: [lldb] Remove IRExecutionUnit::CollectFallbackNames
Alex Langford via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Sep 22 11:04:14 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG43552651319e: [lldb] Remove IRExecutionUnit::CollectFallbackNames (authored by bulbazord).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109928/new/
https://reviews.llvm.org/D109928
Files:
lldb/include/lldb/Expression/IRExecutionUnit.h
lldb/source/Expression/IRExecutionUnit.cpp
Index: lldb/source/Expression/IRExecutionUnit.cpp
===================================================================
--- lldb/source/Expression/IRExecutionUnit.cpp
+++ lldb/source/Expression/IRExecutionUnit.cpp
@@ -708,51 +708,27 @@
void IRExecutionUnit::CollectCandidateCPlusPlusNames(
std::vector<ConstString> &CPP_names,
const std::vector<ConstString> &C_names, const SymbolContext &sc) {
- for (const ConstString &name : C_names) {
- if (CPlusPlusLanguage::IsCPPMangledName(name.GetCString())) {
+ if (auto *cpp_lang = Language::FindPlugin(lldb::eLanguageTypeC_plus_plus)) {
+ for (const ConstString &name : C_names) {
Mangled mangled(name);
- ConstString demangled = mangled.GetDemangledName();
-
- if (demangled) {
- ConstString best_alternate_mangled_name =
- FindBestAlternateMangledName(demangled, sc);
-
- if (best_alternate_mangled_name) {
- CPP_names.push_back(best_alternate_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 (auto *cpp_lang = Language::FindPlugin(lldb::eLanguageTypeC_plus_plus)) {
std::vector<ConstString> alternates =
cpp_lang->GenerateAlternateFunctionManglings(name);
CPP_names.insert(CPP_names.end(), alternates.begin(), alternates.end());
- }
- }
-}
-
-void IRExecutionUnit::CollectFallbackNames(
- std::vector<ConstString> &fallback_names,
- const std::vector<ConstString> &C_names) {
- // As a last-ditch fallback, try the base name for C++ names. It's terrible,
- // but the DWARF doesn't always encode "extern C" correctly.
- for (const ConstString &name : C_names) {
- if (!CPlusPlusLanguage::IsCPPMangledName(name.GetCString()))
- continue;
-
- Mangled mangled_name(name);
- ConstString demangled_name = mangled_name.GetDemangledName();
- if (demangled_name.IsEmpty())
- continue;
-
- const char *demangled_cstr = demangled_name.AsCString();
- const char *lparen_loc = strchr(demangled_cstr, '(');
- if (!lparen_loc)
- continue;
-
- llvm::StringRef base_name(demangled_cstr, lparen_loc - demangled_cstr);
- fallback_names.push_back(ConstString(base_name));
+ // As a last-ditch fallback, try the base name for C++ names. It's
+ // terrible, but the DWARF doesn't always encode "extern C" correctly.
+ ConstString basename =
+ cpp_lang->GetDemangledFunctionNameWithoutArguments(mangled);
+ CPP_names.push_back(basename);
+ }
}
}
@@ -950,14 +926,6 @@
CollectCandidateCPlusPlusNames(candidate_CPlusPlus_names, candidate_C_names,
m_sym_ctx);
ret = FindInSymbols(candidate_CPlusPlus_names, m_sym_ctx, missing_weak);
- if (ret != LLDB_INVALID_ADDRESS)
- return ret;
-
- std::vector<ConstString> candidate_fallback_names;
-
- CollectFallbackNames(candidate_fallback_names, candidate_C_names);
- ret = FindInSymbols(candidate_fallback_names, m_sym_ctx, missing_weak);
-
return ret;
}
Index: lldb/include/lldb/Expression/IRExecutionUnit.h
===================================================================
--- lldb/include/lldb/Expression/IRExecutionUnit.h
+++ lldb/include/lldb/Expression/IRExecutionUnit.h
@@ -221,9 +221,6 @@
const std::vector<ConstString> &C_names,
const SymbolContext &sc);
- void CollectFallbackNames(std::vector<ConstString> &fallback_names,
- const std::vector<ConstString> &C_names);
-
lldb::addr_t FindInSymbols(const std::vector<ConstString> &names,
const lldb_private::SymbolContext &sc,
bool &symbol_was_missing_weak);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109928.374299.patch
Type: text/x-patch
Size: 4010 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210922/b89ca039/attachment-0001.bin>
More information about the lldb-commits
mailing list