aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm/tools/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/tools/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp')
-rw-r--r--contrib/llvm/tools/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp138
1 files changed, 0 insertions, 138 deletions
diff --git a/contrib/llvm/tools/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp b/contrib/llvm/tools/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index fe42a5ed9214..1ae9418e4d9c 100644
--- a/contrib/llvm/tools/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/contrib/llvm/tools/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -271,144 +271,6 @@ bool CPlusPlusLanguage::ExtractContextAndIdentifier(
return false;
}
-class CPPRuntimeEquivalents {
-public:
- CPPRuntimeEquivalents() {
- m_impl.Append(ConstString("std::basic_string<char, std::char_traits<char>, "
- "std::allocator<char> >")
- .GetStringRef(),
- ConstString("basic_string<char>"));
-
- // these two (with a prefixed std::) occur when c++stdlib string class
- // occurs as a template argument in some STL container
- m_impl.Append(ConstString("std::basic_string<char, std::char_traits<char>, "
- "std::allocator<char> >")
- .GetStringRef(),
- ConstString("std::basic_string<char>"));
-
- m_impl.Sort();
- }
-
- void Add(ConstString &type_name, ConstString &type_equivalent) {
- m_impl.Insert(type_name.GetStringRef(), type_equivalent);
- }
-
- uint32_t FindExactMatches(ConstString &type_name,
- std::vector<ConstString> &equivalents) {
- uint32_t count = 0;
-
- for (ImplData match =
- m_impl.FindFirstValueForName(type_name.GetStringRef());
- match != nullptr; match = m_impl.FindNextValueForName(match)) {
- equivalents.push_back(match->value);
- count++;
- }
-
- return count;
- }
-
- // partial matches can occur when a name with equivalents is a template
- // argument.
- // e.g. we may have "class Foo" be a match for "struct Bar". if we have a
- // typename
- // such as "class Templatized<class Foo, Anything>" we want this to be
- // replaced with
- // "class Templatized<struct Bar, Anything>". Since partial matching is time
- // consuming
- // once we get a partial match, we add it to the exact matches list for faster
- // retrieval
- uint32_t FindPartialMatches(ConstString &type_name,
- std::vector<ConstString> &equivalents) {
- uint32_t count = 0;
-
- llvm::StringRef type_name_cstr = type_name.GetStringRef();
-
- size_t items_count = m_impl.GetSize();
-
- for (size_t item = 0; item < items_count; item++) {
- llvm::StringRef key_cstr = m_impl.GetCStringAtIndex(item);
- if (type_name_cstr.contains(key_cstr)) {
- count += AppendReplacements(type_name_cstr, key_cstr, equivalents);
- }
- }
-
- return count;
- }
-
-private:
- std::string &replace(std::string &target, std::string &pattern,
- std::string &with) {
- size_t pos;
- size_t pattern_len = pattern.size();
-
- while ((pos = target.find(pattern)) != std::string::npos)
- target.replace(pos, pattern_len, with);
-
- return target;
- }
-
- uint32_t AppendReplacements(llvm::StringRef original,
- llvm::StringRef matching_key,
- std::vector<ConstString> &equivalents) {
- std::string matching_key_str(matching_key);
- ConstString original_const(original);
-
- uint32_t count = 0;
-
- for (ImplData match = m_impl.FindFirstValueForName(matching_key);
- match != nullptr; match = m_impl.FindNextValueForName(match)) {
- std::string target(original);
- std::string equiv_class(match->value.AsCString());
-
- replace(target, matching_key_str, equiv_class);
-
- ConstString target_const(target.c_str());
-
-// you will most probably want to leave this off since it might make this map
-// grow indefinitely
-#ifdef ENABLE_CPP_EQUIVALENTS_MAP_TO_GROW
- Add(original_const, target_const);
-#endif
- equivalents.push_back(target_const);
-
- count++;
- }
-
- return count;
- }
-
- typedef UniqueCStringMap<ConstString> Impl;
- typedef const Impl::Entry *ImplData;
- Impl m_impl;
-};
-
-static CPPRuntimeEquivalents &GetEquivalentsMap() {
- static CPPRuntimeEquivalents g_equivalents_map;
- return g_equivalents_map;
-}
-
-uint32_t
-CPlusPlusLanguage::FindEquivalentNames(ConstString type_name,
- std::vector<ConstString> &equivalents) {
- uint32_t count = GetEquivalentsMap().FindExactMatches(type_name, equivalents);
-
- bool might_have_partials =
- (count == 0) // if we have a full name match just use it
- && (strchr(type_name.AsCString(), '<') !=
- nullptr // we should only have partial matches when templates are
- // involved, check that we have
- && strchr(type_name.AsCString(), '>') != nullptr); // angle brackets
- // in the type_name
- // before trying to
- // scan for partial
- // matches
-
- if (might_have_partials)
- count = GetEquivalentsMap().FindPartialMatches(type_name, equivalents);
-
- return count;
-}
-
/// Given a mangled function `mangled`, replace all the primitive function type
/// arguments of `search` with type `replace`.
static ConstString SubsPrimitiveParmItanium(llvm::StringRef mangled,