9#ifndef LLDB_DATAFORMATTERS_FORMATTERSCONTAINER_H
10#define LLDB_DATAFORMATTERS_FORMATTERSCONTAINER_H
61 llvm::StringRef type_lexer(type.
AsCString());
63 type_lexer.consume_front(
"class ");
64 type_lexer.consume_front(
"enum ");
65 type_lexer.consume_front(
"struct ");
66 type_lexer.consume_front(
"union ");
67 type_lexer = type_lexer.ltrim();
95 return m_name == type_name ||
108 std::make_shared<TypeImpl>(candidate_type.
GetType()));
139 typedef typename std::shared_ptr<ValueType>
ValueSP;
140 typedef std::vector<std::pair<TypeMatcher, ValueSP>>
MapType;
143 typedef typename std::shared_ptr<FormattersContainer<ValueType>>
152 entry->GetRevision() =
listener->GetCurrentRevision();
154 entry->GetRevision() = 0;
156 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
158 m_map.emplace_back(std::move(matcher), std::move(entry));
164 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
165 for (
auto iter =
m_map.begin(); iter !=
m_map.end(); ++iter)
166 if (iter->first.CreatedBySameMatchString(matcher)) {
177 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
178 for (
auto &formatter : llvm::reverse(
m_map)) {
179 if (formatter.first.Matches(candidate)) {
180 entry = formatter.second;
191 if (
Get(candidate, entry)) {
192 if (candidate.IsMatch(entry))
202 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
203 for (
const auto &pos :
m_map)
204 if (pos.first.CreatedBySameMatchString(matcher)) {
212 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
213 if (index >=
m_map.size())
215 return m_map[index].second;
219 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
220 if (index >=
m_map.size())
223 return std::make_shared<TypeNameSpecifierImpl>(
229 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
237 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
238 for (
const auto &pos :
m_map) {
240 if (!callback(type, pos.second))
247 std::lock_guard<std::recursive_mutex> guard(
m_map_mutex);
static llvm::StringRef GetName(XcodeSDK::Type type)
"lldb/Utility/ArgCompletionRequest.h"
void TryCompleteCurrentArg(llvm::StringRef completion, llvm::StringRef description="")
Adds a possible completion string if the completion would complete the current argument.
A uniqued constant string class.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
bool IsEmpty() const
Test for empty string.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
virtual bool FormatterCallbackFunction(const char *function_name, lldb::TypeImplSP type_impl_sp)
Class for matching type names.
ConstString GetMatchString() const
Returns the underlying match string for this TypeMatcher.
TypeMatcher(lldb::TypeNameSpecifierImplSP type_specifier)
Creates a matcher using the matching type and string from the given type name specifier.
TypeMatcher(ConstString type_name)
Creates a matcher that accepts any type with exactly the given type name.
lldb::FormatterMatchType m_match_type
Indicates what kind of matching strategy should be used:
RegularExpression m_type_name_regex
lldb::FormatterMatchType GetMatchType() const
static ConstString StripTypeName(ConstString type)
bool CreatedBySameMatchString(TypeMatcher other) const
Returns true if this TypeMatcher and the given one were most created by the same match string.
TypeMatcher(RegularExpression regex)
Creates a matcher that accepts any type matching the given regex.
ConstString m_name
Type name for exact match, or name of the python callback if m_match_type is eFormatterMatchCallback.
bool Matches(FormattersMatchCandidate candidate_type) const
True iff this matches the given type.
A class that represents a running process on the host machine.
std::vector< FormattersMatchCandidate > FormattersMatchVector
std::shared_ptr< lldb_private::TypeNameSpecifierImpl > TypeNameSpecifierImplSP
FormatterMatchType
Type of match to be performed when looking for a formatter for a data type.
@ eFormatterMatchCallback