Update prebuilt Clang to r365631c1 from Android.
The version we had was segfaulting.
Bug: 132420445
Change-Id: Icb45a6fe0b4e2166f7895e669df1157cec9fb4e0
diff --git a/linux-x64/clang/include/lldb/DataFormatters/CXXFunctionPointer.h b/linux-x64/clang/include/lldb/DataFormatters/CXXFunctionPointer.h
new file mode 100644
index 0000000..b541789
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/CXXFunctionPointer.h
@@ -0,0 +1,21 @@
+//===-- CXXFunctionPointer.h ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_CXXFunctionPointer_h_
+#define liblldb_CXXFunctionPointer_h_
+
+#include "lldb/lldb-forward.h"
+
+namespace lldb_private {
+namespace formatters {
+bool CXXFunctionPointerSummaryProvider(ValueObject &valobj, Stream &stream,
+ const TypeSummaryOptions &options);
+} // namespace formatters
+} // namespace lldb_private
+
+#endif // liblldb_CXXFunctionPointer_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/DataVisualization.h b/linux-x64/clang/include/lldb/DataFormatters/DataVisualization.h
new file mode 100644
index 0000000..cdb2eab
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/DataVisualization.h
@@ -0,0 +1,131 @@
+//===-- DataVisualization.h -------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_DataVisualization_h_
+#define lldb_DataVisualization_h_
+
+
+#include "lldb/DataFormatters/FormatClasses.h"
+#include "lldb/DataFormatters/FormatManager.h"
+#include "lldb/Utility/ConstString.h"
+
+namespace lldb_private {
+
+// this class is the high-level front-end of LLDB Data Visualization code in
+// FormatManager.h/cpp is the low-level implementation of this feature clients
+// should refer to this class as the entry-point into the data formatters
+// unless they have a good reason to bypass this and go to the backend
+class DataVisualization {
+public:
+ // use this call to force the FM to consider itself updated even when there
+ // is no apparent reason for that
+ static void ForceUpdate();
+
+ static uint32_t GetCurrentRevision();
+
+ static bool ShouldPrintAsOneLiner(ValueObject &valobj);
+
+ static lldb::TypeFormatImplSP GetFormat(ValueObject &valobj,
+ lldb::DynamicValueType use_dynamic);
+
+ static lldb::TypeFormatImplSP
+ GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ static lldb::TypeSummaryImplSP
+ GetSummaryFormat(ValueObject &valobj, lldb::DynamicValueType use_dynamic);
+
+ static lldb::TypeSummaryImplSP
+ GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ static lldb::TypeFilterImplSP
+ GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ static lldb::ScriptedSyntheticChildrenSP
+ GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ static lldb::SyntheticChildrenSP
+ GetSyntheticChildren(ValueObject &valobj, lldb::DynamicValueType use_dynamic);
+
+ static lldb::TypeValidatorImplSP
+ GetValidator(ValueObject &valobj, lldb::DynamicValueType use_dynamic);
+
+ static lldb::TypeValidatorImplSP
+ GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ static bool
+ AnyMatches(ConstString type_name,
+ TypeCategoryImpl::FormatCategoryItems items =
+ TypeCategoryImpl::ALL_ITEM_TYPES,
+ bool only_enabled = true, const char **matching_category = nullptr,
+ TypeCategoryImpl::FormatCategoryItems *matching_type = nullptr);
+
+ class NamedSummaryFormats {
+ public:
+ static bool GetSummaryFormat(ConstString type,
+ lldb::TypeSummaryImplSP &entry);
+
+ static void Add(ConstString type,
+ const lldb::TypeSummaryImplSP &entry);
+
+ static bool Delete(ConstString type);
+
+ static void Clear();
+
+ static void
+ ForEach(std::function<bool(ConstString, const lldb::TypeSummaryImplSP &)>
+ callback);
+
+ static uint32_t GetCount();
+ };
+
+ class Categories {
+ public:
+ static bool GetCategory(ConstString category,
+ lldb::TypeCategoryImplSP &entry,
+ bool allow_create = true);
+
+ static bool GetCategory(lldb::LanguageType language,
+ lldb::TypeCategoryImplSP &entry);
+
+ static void Add(ConstString category);
+
+ static bool Delete(ConstString category);
+
+ static void Clear();
+
+ static void Clear(ConstString category);
+
+ static void Enable(ConstString category,
+ TypeCategoryMap::Position = TypeCategoryMap::Default);
+
+ static void Enable(lldb::LanguageType lang_type);
+
+ static void Disable(ConstString category);
+
+ static void Disable(lldb::LanguageType lang_type);
+
+ static void Enable(const lldb::TypeCategoryImplSP &category,
+ TypeCategoryMap::Position = TypeCategoryMap::Default);
+
+ static void Disable(const lldb::TypeCategoryImplSP &category);
+
+ static void EnableStar();
+
+ static void DisableStar();
+
+ static void ForEach(TypeCategoryMap::ForEachCallback callback);
+
+ static uint32_t GetCount();
+
+ static lldb::TypeCategoryImplSP GetCategoryAtIndex(size_t);
+ };
+};
+
+} // namespace lldb_private
+
+#endif // lldb_DataVisualization_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/DumpValueObjectOptions.h b/linux-x64/clang/include/lldb/DataFormatters/DumpValueObjectOptions.h
new file mode 100644
index 0000000..c374115
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/DumpValueObjectOptions.h
@@ -0,0 +1,160 @@
+//===-- DumpValueObjectOptions.h --------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_DumpValueObjectOptions_h_
+#define lldb_DumpValueObjectOptions_h_
+
+#include <string>
+
+#include "lldb/lldb-private.h"
+#include "lldb/lldb-public.h"
+
+#include <functional>
+#include <string>
+
+namespace lldb_private {
+
+class DumpValueObjectOptions {
+public:
+ struct PointerDepth {
+ enum class Mode { Always, Default, Never } m_mode;
+ uint32_t m_count;
+
+ PointerDepth operator--() const {
+ if (m_count > 0)
+ return PointerDepth{m_mode, m_count - 1};
+ return PointerDepth{m_mode, m_count};
+ }
+
+ bool CanAllowExpansion() const;
+ };
+
+ struct PointerAsArraySettings {
+ size_t m_element_count;
+ size_t m_base_element;
+ size_t m_stride;
+
+ PointerAsArraySettings()
+ : m_element_count(0), m_base_element(0), m_stride() {}
+
+ PointerAsArraySettings(size_t elem_count, size_t base_elem = 0,
+ size_t stride = 1)
+ : m_element_count(elem_count), m_base_element(base_elem),
+ m_stride(stride) {}
+
+ operator bool() { return m_element_count > 0; }
+ };
+
+ typedef std::function<bool(ConstString, ConstString,
+ const DumpValueObjectOptions &, Stream &)>
+ DeclPrintingHelper;
+
+ static const DumpValueObjectOptions DefaultOptions() {
+ static DumpValueObjectOptions g_default_options;
+
+ return g_default_options;
+ }
+
+ DumpValueObjectOptions();
+
+ DumpValueObjectOptions(const DumpValueObjectOptions &rhs) = default;
+
+ DumpValueObjectOptions(ValueObject &valobj);
+
+ DumpValueObjectOptions &
+ SetMaximumPointerDepth(PointerDepth depth = {PointerDepth::Mode::Never, 0});
+
+ DumpValueObjectOptions &SetMaximumDepth(uint32_t depth = 0);
+
+ DumpValueObjectOptions &SetDeclPrintingHelper(DeclPrintingHelper helper);
+
+ DumpValueObjectOptions &SetShowTypes(bool show = false);
+
+ DumpValueObjectOptions &SetShowLocation(bool show = false);
+
+ DumpValueObjectOptions &SetUseObjectiveC(bool use = false);
+
+ DumpValueObjectOptions &SetShowSummary(bool show = true);
+
+ DumpValueObjectOptions &
+ SetUseDynamicType(lldb::DynamicValueType dyn = lldb::eNoDynamicValues);
+
+ DumpValueObjectOptions &SetUseSyntheticValue(bool use_synthetic = true);
+
+ DumpValueObjectOptions &SetScopeChecked(bool check = true);
+
+ DumpValueObjectOptions &SetFlatOutput(bool flat = false);
+
+ DumpValueObjectOptions &SetOmitSummaryDepth(uint32_t depth = 0);
+
+ DumpValueObjectOptions &SetIgnoreCap(bool ignore = false);
+
+ DumpValueObjectOptions &SetRawDisplay();
+
+ DumpValueObjectOptions &SetFormat(lldb::Format format = lldb::eFormatDefault);
+
+ DumpValueObjectOptions &
+ SetSummary(lldb::TypeSummaryImplSP summary = lldb::TypeSummaryImplSP());
+
+ DumpValueObjectOptions &SetRootValueObjectName(const char *name = nullptr);
+
+ DumpValueObjectOptions &SetHideRootType(bool hide_root_type = false);
+
+ DumpValueObjectOptions &SetHideName(bool hide_name = false);
+
+ DumpValueObjectOptions &SetHideValue(bool hide_value = false);
+
+ DumpValueObjectOptions &SetHidePointerValue(bool hide = false);
+
+ DumpValueObjectOptions &SetVariableFormatDisplayLanguage(
+ lldb::LanguageType lang = lldb::eLanguageTypeUnknown);
+
+ DumpValueObjectOptions &SetRunValidator(bool run = true);
+
+ DumpValueObjectOptions &SetUseTypeDisplayName(bool dis = false);
+
+ DumpValueObjectOptions &SetAllowOnelinerMode(bool oneliner = false);
+
+ DumpValueObjectOptions &SetRevealEmptyAggregates(bool reveal = true);
+
+ DumpValueObjectOptions &SetElementCount(uint32_t element_count = 0);
+
+ DumpValueObjectOptions &
+ SetPointerAsArray(const PointerAsArraySettings &ptr_array);
+
+public:
+ uint32_t m_max_depth = UINT32_MAX;
+ lldb::DynamicValueType m_use_dynamic = lldb::eNoDynamicValues;
+ uint32_t m_omit_summary_depth = 0;
+ lldb::Format m_format = lldb::eFormatDefault;
+ lldb::TypeSummaryImplSP m_summary_sp;
+ std::string m_root_valobj_name;
+ lldb::LanguageType m_varformat_language = lldb::eLanguageTypeUnknown;
+ PointerDepth m_max_ptr_depth;
+ DeclPrintingHelper m_decl_printing_helper;
+ PointerAsArraySettings m_pointer_as_array;
+ bool m_use_synthetic : 1;
+ bool m_scope_already_checked : 1;
+ bool m_flat_output : 1;
+ bool m_ignore_cap : 1;
+ bool m_show_types : 1;
+ bool m_show_location : 1;
+ bool m_use_objc : 1;
+ bool m_hide_root_type : 1;
+ bool m_hide_name : 1;
+ bool m_hide_value : 1;
+ bool m_run_validator : 1;
+ bool m_use_type_display_name : 1;
+ bool m_allow_oneliner_mode : 1;
+ bool m_hide_pointer_value : 1;
+ bool m_reveal_empty_aggregates : 1;
+};
+
+} // namespace lldb_private
+
+#endif // lldb_DumpValueObjectOptions_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/FormatCache.h b/linux-x64/clang/include/lldb/DataFormatters/FormatCache.h
new file mode 100644
index 0000000..7a6774b
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/FormatCache.h
@@ -0,0 +1,107 @@
+//===-- FormatCache.h ---------------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_FormatCache_h_
+#define lldb_FormatCache_h_
+
+#include <map>
+#include <mutex>
+
+#include "lldb/Utility/ConstString.h"
+#include "lldb/lldb-public.h"
+
+namespace lldb_private {
+class FormatCache {
+private:
+ struct Entry {
+ private:
+ bool m_format_cached : 1;
+ bool m_summary_cached : 1;
+ bool m_synthetic_cached : 1;
+ bool m_validator_cached : 1;
+
+ lldb::TypeFormatImplSP m_format_sp;
+ lldb::TypeSummaryImplSP m_summary_sp;
+ lldb::SyntheticChildrenSP m_synthetic_sp;
+ lldb::TypeValidatorImplSP m_validator_sp;
+
+ public:
+ Entry();
+ Entry(lldb::TypeFormatImplSP);
+ Entry(lldb::TypeSummaryImplSP);
+ Entry(lldb::SyntheticChildrenSP);
+ Entry(lldb::TypeValidatorImplSP);
+ Entry(lldb::TypeFormatImplSP, lldb::TypeSummaryImplSP,
+ lldb::SyntheticChildrenSP, lldb::TypeValidatorImplSP);
+
+ bool IsFormatCached();
+
+ bool IsSummaryCached();
+
+ bool IsSyntheticCached();
+
+ bool IsValidatorCached();
+
+ lldb::TypeFormatImplSP GetFormat();
+
+ lldb::TypeSummaryImplSP GetSummary();
+
+ lldb::SyntheticChildrenSP GetSynthetic();
+
+ lldb::TypeValidatorImplSP GetValidator();
+
+ void SetFormat(lldb::TypeFormatImplSP);
+
+ void SetSummary(lldb::TypeSummaryImplSP);
+
+ void SetSynthetic(lldb::SyntheticChildrenSP);
+
+ void SetValidator(lldb::TypeValidatorImplSP);
+ };
+ typedef std::map<ConstString, Entry> CacheMap;
+ CacheMap m_map;
+ std::recursive_mutex m_mutex;
+
+ uint64_t m_cache_hits;
+ uint64_t m_cache_misses;
+
+ Entry &GetEntry(ConstString type);
+
+public:
+ FormatCache();
+
+ bool GetFormat(ConstString type, lldb::TypeFormatImplSP &format_sp);
+
+ bool GetSummary(ConstString type, lldb::TypeSummaryImplSP &summary_sp);
+
+ bool GetSynthetic(ConstString type,
+ lldb::SyntheticChildrenSP &synthetic_sp);
+
+ bool GetValidator(ConstString type,
+ lldb::TypeValidatorImplSP &summary_sp);
+
+ void SetFormat(ConstString type, lldb::TypeFormatImplSP &format_sp);
+
+ void SetSummary(ConstString type, lldb::TypeSummaryImplSP &summary_sp);
+
+ void SetSynthetic(ConstString type,
+ lldb::SyntheticChildrenSP &synthetic_sp);
+
+ void SetValidator(ConstString type,
+ lldb::TypeValidatorImplSP &synthetic_sp);
+
+ void Clear();
+
+ uint64_t GetCacheHits() { return m_cache_hits; }
+
+ uint64_t GetCacheMisses() { return m_cache_misses; }
+};
+} // namespace lldb_private
+
+#endif // lldb_FormatCache_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/FormatClasses.h b/linux-x64/clang/include/lldb/DataFormatters/FormatClasses.h
new file mode 100644
index 0000000..5144bc6
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/FormatClasses.h
@@ -0,0 +1,165 @@
+//===-- FormatClasses.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_FormatClasses_h_
+#define lldb_FormatClasses_h_
+
+#include <functional>
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "lldb/DataFormatters/TypeFormat.h"
+#include "lldb/DataFormatters/TypeSummary.h"
+#include "lldb/DataFormatters/TypeSynthetic.h"
+#include "lldb/DataFormatters/TypeValidator.h"
+#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Symbol/Type.h"
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-public.h"
+
+namespace lldb_private {
+
+class HardcodedFormatters {
+public:
+ template <typename FormatterType>
+ using HardcodedFormatterFinder =
+ std::function<typename FormatterType::SharedPointer(
+ lldb_private::ValueObject &, lldb::DynamicValueType,
+ FormatManager &)>;
+
+ template <typename FormatterType>
+ using HardcodedFormatterFinders =
+ std::vector<HardcodedFormatterFinder<FormatterType>>;
+
+ typedef HardcodedFormatterFinders<TypeFormatImpl> HardcodedFormatFinder;
+ typedef HardcodedFormatterFinders<TypeSummaryImpl> HardcodedSummaryFinder;
+ typedef HardcodedFormatterFinders<SyntheticChildren> HardcodedSyntheticFinder;
+ typedef HardcodedFormatterFinders<TypeValidatorImpl> HardcodedValidatorFinder;
+};
+
+class FormattersMatchCandidate {
+public:
+ FormattersMatchCandidate(ConstString name, uint32_t reason, bool strip_ptr,
+ bool strip_ref, bool strip_tydef)
+ : m_type_name(name), m_reason(reason), m_stripped_pointer(strip_ptr),
+ m_stripped_reference(strip_ref), m_stripped_typedef(strip_tydef) {}
+
+ ~FormattersMatchCandidate() = default;
+
+ ConstString GetTypeName() const { return m_type_name; }
+
+ uint32_t GetReason() const { return m_reason; }
+
+ bool DidStripPointer() const { return m_stripped_pointer; }
+
+ bool DidStripReference() const { return m_stripped_reference; }
+
+ bool DidStripTypedef() const { return m_stripped_typedef; }
+
+ template <class Formatter>
+ bool IsMatch(const std::shared_ptr<Formatter> &formatter_sp) const {
+ if (!formatter_sp)
+ return false;
+ if (formatter_sp->Cascades() == false && DidStripTypedef())
+ return false;
+ if (formatter_sp->SkipsPointers() && DidStripPointer())
+ return false;
+ if (formatter_sp->SkipsReferences() && DidStripReference())
+ return false;
+ return true;
+ }
+
+private:
+ ConstString m_type_name;
+ uint32_t m_reason;
+ bool m_stripped_pointer;
+ bool m_stripped_reference;
+ bool m_stripped_typedef;
+};
+
+typedef std::vector<FormattersMatchCandidate> FormattersMatchVector;
+typedef std::vector<lldb::LanguageType> CandidateLanguagesVector;
+
+class FormattersMatchData {
+public:
+ FormattersMatchData(ValueObject &, lldb::DynamicValueType);
+
+ FormattersMatchVector GetMatchesVector();
+
+ ConstString GetTypeForCache();
+
+ CandidateLanguagesVector GetCandidateLanguages();
+
+ ValueObject &GetValueObject();
+
+ lldb::DynamicValueType GetDynamicValueType();
+
+private:
+ ValueObject &m_valobj;
+ lldb::DynamicValueType m_dynamic_value_type;
+ std::pair<FormattersMatchVector, bool> m_formatters_match_vector;
+ ConstString m_type_for_cache;
+ CandidateLanguagesVector m_candidate_languages;
+};
+
+class TypeNameSpecifierImpl {
+public:
+ TypeNameSpecifierImpl() : m_is_regex(false), m_type() {}
+
+ TypeNameSpecifierImpl(llvm::StringRef name, bool is_regex)
+ : m_is_regex(is_regex), m_type() {
+ m_type.m_type_name = name;
+ }
+
+ // if constructing with a given type, is_regex cannot be true since we are
+ // giving an exact type to match
+ TypeNameSpecifierImpl(lldb::TypeSP type) : m_is_regex(false), m_type() {
+ if (type) {
+ m_type.m_type_name = type->GetName().GetStringRef();
+ m_type.m_compiler_type = type->GetForwardCompilerType();
+ }
+ }
+
+ TypeNameSpecifierImpl(CompilerType type) : m_is_regex(false), m_type() {
+ if (type.IsValid()) {
+ m_type.m_type_name.assign(type.GetConstTypeName().GetCString());
+ m_type.m_compiler_type = type;
+ }
+ }
+
+ const char *GetName() {
+ if (m_type.m_type_name.size())
+ return m_type.m_type_name.c_str();
+ return nullptr;
+ }
+
+ CompilerType GetCompilerType() {
+ if (m_type.m_compiler_type.IsValid())
+ return m_type.m_compiler_type;
+ return CompilerType();
+ }
+
+ bool IsRegex() { return m_is_regex; }
+
+private:
+ bool m_is_regex;
+ // TODO: Replace this with TypeAndOrName.
+ struct TypeOrName {
+ std::string m_type_name;
+ CompilerType m_compiler_type;
+ };
+ TypeOrName m_type;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(TypeNameSpecifierImpl);
+};
+
+} // namespace lldb_private
+
+#endif // lldb_FormatClasses_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/FormatManager.h b/linux-x64/clang/include/lldb/DataFormatters/FormatManager.h
new file mode 100644
index 0000000..afaafda
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/FormatManager.h
@@ -0,0 +1,249 @@
+//===-- FormatManager.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_FormatManager_h_
+#define lldb_FormatManager_h_
+
+#include <atomic>
+#include <initializer_list>
+#include <map>
+#include <mutex>
+#include <vector>
+
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-public.h"
+
+#include "lldb/DataFormatters/FormatCache.h"
+#include "lldb/DataFormatters/FormatClasses.h"
+#include "lldb/DataFormatters/FormattersContainer.h"
+#include "lldb/DataFormatters/LanguageCategory.h"
+#include "lldb/DataFormatters/TypeCategory.h"
+#include "lldb/DataFormatters/TypeCategoryMap.h"
+
+namespace lldb_private {
+
+// this file (and its. cpp) contain the low-level implementation of LLDB Data
+// Visualization class DataVisualization is the high-level front-end of this
+// feature clients should refer to that class as the entry-point into the data
+// formatters unless they have a good reason to bypass it and prefer to use
+// this file's objects directly
+
+class FormatManager : public IFormatChangeListener {
+ typedef FormatMap<ConstString, TypeSummaryImpl> NamedSummariesMap;
+ typedef TypeCategoryMap::MapType::iterator CategoryMapIterator;
+
+public:
+ typedef std::map<lldb::LanguageType, LanguageCategory::UniquePointer>
+ LanguageCategories;
+
+ FormatManager();
+
+ ~FormatManager() override = default;
+
+ NamedSummariesMap &GetNamedSummaryContainer() {
+ return m_named_summaries_map;
+ }
+
+ void
+ EnableCategory(ConstString category_name,
+ TypeCategoryMap::Position pos = TypeCategoryMap::Default) {
+ EnableCategory(category_name, pos,
+ std::initializer_list<lldb::LanguageType>());
+ }
+
+ void EnableCategory(ConstString category_name,
+ TypeCategoryMap::Position pos, lldb::LanguageType lang) {
+ std::initializer_list<lldb::LanguageType> langs = {lang};
+ EnableCategory(category_name, pos, langs);
+ }
+
+ void EnableCategory(ConstString category_name,
+ TypeCategoryMap::Position pos = TypeCategoryMap::Default,
+ std::initializer_list<lldb::LanguageType> langs = {}) {
+ TypeCategoryMap::ValueSP category_sp;
+ if (m_categories_map.Get(category_name, category_sp) && category_sp) {
+ m_categories_map.Enable(category_sp, pos);
+ for (const lldb::LanguageType lang : langs)
+ category_sp->AddLanguage(lang);
+ }
+ }
+
+ void DisableCategory(ConstString category_name) {
+ m_categories_map.Disable(category_name);
+ }
+
+ void
+ EnableCategory(const lldb::TypeCategoryImplSP &category,
+ TypeCategoryMap::Position pos = TypeCategoryMap::Default) {
+ m_categories_map.Enable(category, pos);
+ }
+
+ void DisableCategory(const lldb::TypeCategoryImplSP &category) {
+ m_categories_map.Disable(category);
+ }
+
+ void EnableAllCategories();
+
+ void DisableAllCategories();
+
+ bool DeleteCategory(ConstString category_name) {
+ return m_categories_map.Delete(category_name);
+ }
+
+ void ClearCategories() { return m_categories_map.Clear(); }
+
+ uint32_t GetCategoriesCount() { return m_categories_map.GetCount(); }
+
+ lldb::TypeCategoryImplSP GetCategoryAtIndex(size_t index) {
+ return m_categories_map.GetAtIndex(index);
+ }
+
+ void ForEachCategory(TypeCategoryMap::ForEachCallback callback);
+
+ lldb::TypeCategoryImplSP GetCategory(const char *category_name = nullptr,
+ bool can_create = true) {
+ if (!category_name)
+ return GetCategory(m_default_category_name);
+ return GetCategory(ConstString(category_name));
+ }
+
+ lldb::TypeCategoryImplSP GetCategory(ConstString category_name,
+ bool can_create = true);
+
+ lldb::TypeFormatImplSP
+ GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ lldb::TypeSummaryImplSP
+ GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ lldb::TypeFilterImplSP
+ GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ lldb::ScriptedSyntheticChildrenSP
+ GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ lldb::TypeValidatorImplSP
+ GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ lldb::TypeFormatImplSP GetFormat(ValueObject &valobj,
+ lldb::DynamicValueType use_dynamic);
+
+ lldb::TypeSummaryImplSP GetSummaryFormat(ValueObject &valobj,
+ lldb::DynamicValueType use_dynamic);
+
+ lldb::SyntheticChildrenSP
+ GetSyntheticChildren(ValueObject &valobj, lldb::DynamicValueType use_dynamic);
+
+ lldb::TypeValidatorImplSP GetValidator(ValueObject &valobj,
+ lldb::DynamicValueType use_dynamic);
+
+ bool
+ AnyMatches(ConstString type_name,
+ TypeCategoryImpl::FormatCategoryItems items =
+ TypeCategoryImpl::ALL_ITEM_TYPES,
+ bool only_enabled = true, const char **matching_category = nullptr,
+ TypeCategoryImpl::FormatCategoryItems *matching_type = nullptr) {
+ return m_categories_map.AnyMatches(type_name, items, only_enabled,
+ matching_category, matching_type);
+ }
+
+ static bool GetFormatFromCString(const char *format_cstr,
+ bool partial_match_ok, lldb::Format &format);
+
+ static char GetFormatAsFormatChar(lldb::Format format);
+
+ static const char *GetFormatAsCString(lldb::Format format);
+
+ // if the user tries to add formatters for, say, "struct Foo" those will not
+ // match any type because of the way we strip qualifiers from typenames this
+ // method looks for the case where the user is adding a
+ // "class","struct","enum" or "union" Foo and strips the unnecessary
+ // qualifier
+ static ConstString GetValidTypeName(ConstString type);
+
+ // when DataExtractor dumps a vectorOfT, it uses a predefined format for each
+ // item this method returns it, or eFormatInvalid if vector_format is not a
+ // vectorOf
+ static lldb::Format GetSingleItemFormat(lldb::Format vector_format);
+
+ // this returns true if the ValueObjectPrinter is *highly encouraged* to
+ // actually represent this ValueObject in one-liner format If this object has
+ // a summary formatter, however, we should not try and do one-lining, just
+ // let the summary do the right thing
+ bool ShouldPrintAsOneLiner(ValueObject &valobj);
+
+ void Changed() override;
+
+ uint32_t GetCurrentRevision() override { return m_last_revision; }
+
+ static FormattersMatchVector
+ GetPossibleMatches(ValueObject &valobj, lldb::DynamicValueType use_dynamic) {
+ FormattersMatchVector matches;
+ GetPossibleMatches(valobj, valobj.GetCompilerType(),
+ lldb_private::eFormatterChoiceCriterionDirectChoice,
+ use_dynamic, matches, false, false, false, true);
+ return matches;
+ }
+
+ static ConstString GetTypeForCache(ValueObject &, lldb::DynamicValueType);
+
+ LanguageCategory *GetCategoryForLanguage(lldb::LanguageType lang_type);
+
+ static std::vector<lldb::LanguageType>
+ GetCandidateLanguages(lldb::LanguageType lang_type);
+
+private:
+ static std::vector<lldb::LanguageType>
+ GetCandidateLanguages(ValueObject &valobj);
+
+ static void GetPossibleMatches(ValueObject &valobj,
+ CompilerType compiler_type, uint32_t reason,
+ lldb::DynamicValueType use_dynamic,
+ FormattersMatchVector &entries,
+ bool did_strip_ptr, bool did_strip_ref,
+ bool did_strip_typedef,
+ bool root_level = false);
+
+ std::atomic<uint32_t> m_last_revision;
+ FormatCache m_format_cache;
+ std::recursive_mutex m_language_categories_mutex;
+ LanguageCategories m_language_categories_map;
+ NamedSummariesMap m_named_summaries_map;
+ TypeCategoryMap m_categories_map;
+
+ ConstString m_default_category_name;
+ ConstString m_system_category_name;
+ ConstString m_vectortypes_category_name;
+
+ lldb::TypeFormatImplSP GetHardcodedFormat(FormattersMatchData &);
+
+ lldb::TypeSummaryImplSP GetHardcodedSummaryFormat(FormattersMatchData &);
+
+ lldb::SyntheticChildrenSP
+ GetHardcodedSyntheticChildren(FormattersMatchData &);
+
+ lldb::TypeValidatorImplSP GetHardcodedValidator(FormattersMatchData &);
+
+ TypeCategoryMap &GetCategories() { return m_categories_map; }
+
+ // These functions are meant to initialize formatters that are very low-
+ // level/global in nature and do not naturally belong in any language. The
+ // intent is that most formatters go in language-specific categories.
+ // Eventually, the runtimes should also be allowed to vend their own
+ // formatters, and then one could put formatters that depend on specific
+ // library load events in the language runtimes, on an as-needed basis
+ void LoadSystemFormatters();
+
+ void LoadVectorFormatters();
+
+ friend class FormattersMatchData;
+};
+
+} // namespace lldb_private
+
+#endif // lldb_FormatManager_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/FormattersContainer.h b/linux-x64/clang/include/lldb/DataFormatters/FormattersContainer.h
new file mode 100644
index 0000000..9d7d373
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/FormattersContainer.h
@@ -0,0 +1,343 @@
+//===-- FormattersContainer.h -----------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_FormattersContainer_h_
+#define lldb_FormattersContainer_h_
+
+#include <functional>
+#include <map>
+#include <memory>
+#include <mutex>
+#include <string>
+
+#include "lldb/lldb-public.h"
+
+#include "lldb/Core/ValueObject.h"
+#include "lldb/DataFormatters/FormatClasses.h"
+#include "lldb/DataFormatters/TypeFormat.h"
+#include "lldb/DataFormatters/TypeSummary.h"
+#include "lldb/DataFormatters/TypeSynthetic.h"
+#include "lldb/DataFormatters/TypeValidator.h"
+#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Utility/RegularExpression.h"
+#include "lldb/Utility/StringLexer.h"
+
+namespace lldb_private {
+
+class IFormatChangeListener {
+public:
+ virtual ~IFormatChangeListener() = default;
+
+ virtual void Changed() = 0;
+
+ virtual uint32_t GetCurrentRevision() = 0;
+};
+
+// if the user tries to add formatters for, say, "struct Foo" those will not
+// match any type because of the way we strip qualifiers from typenames this
+// method looks for the case where the user is adding a "class","struct","enum"
+// or "union" Foo and strips the unnecessary qualifier
+static inline ConstString GetValidTypeName_Impl(ConstString type) {
+ if (type.IsEmpty())
+ return type;
+
+ std::string type_cstr(type.AsCString());
+ lldb_utility::StringLexer type_lexer(type_cstr);
+
+ type_lexer.AdvanceIf("class ");
+ type_lexer.AdvanceIf("enum ");
+ type_lexer.AdvanceIf("struct ");
+ type_lexer.AdvanceIf("union ");
+
+ while (type_lexer.NextIf({' ', '\t', '\v', '\f'}).first)
+ ;
+
+ return ConstString(type_lexer.GetUnlexed());
+}
+
+template <typename KeyType, typename ValueType> class FormattersContainer;
+
+template <typename KeyType, typename ValueType> class FormatMap {
+public:
+ typedef typename ValueType::SharedPointer ValueSP;
+ typedef std::map<KeyType, ValueSP> MapType;
+ typedef typename MapType::iterator MapIterator;
+ typedef std::function<bool(KeyType, const ValueSP &)> ForEachCallback;
+
+ FormatMap(IFormatChangeListener *lst)
+ : m_map(), m_map_mutex(), listener(lst) {}
+
+ void Add(KeyType name, const ValueSP &entry) {
+ if (listener)
+ entry->GetRevision() = listener->GetCurrentRevision();
+ else
+ entry->GetRevision() = 0;
+
+ std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+ m_map[name] = entry;
+ if (listener)
+ listener->Changed();
+ }
+
+ bool Delete(KeyType name) {
+ std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+ MapIterator iter = m_map.find(name);
+ if (iter == m_map.end())
+ return false;
+ m_map.erase(name);
+ if (listener)
+ listener->Changed();
+ return true;
+ }
+
+ void Clear() {
+ std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+ m_map.clear();
+ if (listener)
+ listener->Changed();
+ }
+
+ bool Get(KeyType name, ValueSP &entry) {
+ std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+ MapIterator iter = m_map.find(name);
+ if (iter == m_map.end())
+ return false;
+ entry = iter->second;
+ return true;
+ }
+
+ void ForEach(ForEachCallback callback) {
+ if (callback) {
+ std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+ MapIterator pos, end = m_map.end();
+ for (pos = m_map.begin(); pos != end; pos++) {
+ KeyType type = pos->first;
+ if (!callback(type, pos->second))
+ break;
+ }
+ }
+ }
+
+ uint32_t GetCount() { return m_map.size(); }
+
+ ValueSP GetValueAtIndex(size_t index) {
+ std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+ MapIterator iter = m_map.begin();
+ MapIterator end = m_map.end();
+ while (index > 0) {
+ iter++;
+ index--;
+ if (end == iter)
+ return ValueSP();
+ }
+ return iter->second;
+ }
+
+ KeyType GetKeyAtIndex(size_t index) {
+ std::lock_guard<std::recursive_mutex> guard(m_map_mutex);
+ MapIterator iter = m_map.begin();
+ MapIterator end = m_map.end();
+ while (index > 0) {
+ iter++;
+ index--;
+ if (end == iter)
+ return KeyType();
+ }
+ return iter->first;
+ }
+
+protected:
+ MapType m_map;
+ std::recursive_mutex m_map_mutex;
+ IFormatChangeListener *listener;
+
+ MapType &map() { return m_map; }
+
+ std::recursive_mutex &mutex() { return m_map_mutex; }
+
+ friend class FormattersContainer<KeyType, ValueType>;
+ friend class FormatManager;
+};
+
+template <typename KeyType, typename ValueType> class FormattersContainer {
+protected:
+ typedef FormatMap<KeyType, ValueType> BackEndType;
+
+public:
+ typedef typename BackEndType::MapType MapType;
+ typedef typename MapType::iterator MapIterator;
+ typedef typename MapType::key_type MapKeyType;
+ typedef typename MapType::mapped_type MapValueType;
+ typedef typename BackEndType::ForEachCallback ForEachCallback;
+ typedef typename std::shared_ptr<FormattersContainer<KeyType, ValueType>>
+ SharedPointer;
+
+ friend class TypeCategoryImpl;
+
+ FormattersContainer(std::string name, IFormatChangeListener *lst)
+ : m_format_map(lst), m_name(name) {}
+
+ void Add(const MapKeyType &type, const MapValueType &entry) {
+ Add_Impl(type, entry, static_cast<KeyType *>(nullptr));
+ }
+
+ bool Delete(ConstString type) {
+ return Delete_Impl(type, static_cast<KeyType *>(nullptr));
+ }
+
+ bool Get(ValueObject &valobj, MapValueType &entry,
+ lldb::DynamicValueType use_dynamic, uint32_t *why = nullptr) {
+ uint32_t value = lldb_private::eFormatterChoiceCriterionDirectChoice;
+ CompilerType ast_type(valobj.GetCompilerType());
+ bool ret = Get(valobj, ast_type, entry, use_dynamic, value);
+ if (ret)
+ entry = MapValueType(entry);
+ else
+ entry = MapValueType();
+ if (why)
+ *why = value;
+ return ret;
+ }
+
+ bool Get(ConstString type, MapValueType &entry) {
+ return Get_Impl(type, entry, static_cast<KeyType *>(nullptr));
+ }
+
+ bool GetExact(ConstString type, MapValueType &entry) {
+ return GetExact_Impl(type, entry, static_cast<KeyType *>(nullptr));
+ }
+
+ MapValueType GetAtIndex(size_t index) {
+ return m_format_map.GetValueAtIndex(index);
+ }
+
+ lldb::TypeNameSpecifierImplSP GetTypeNameSpecifierAtIndex(size_t index) {
+ return GetTypeNameSpecifierAtIndex_Impl(index,
+ static_cast<KeyType *>(nullptr));
+ }
+
+ void Clear() { m_format_map.Clear(); }
+
+ void ForEach(ForEachCallback callback) { m_format_map.ForEach(callback); }
+
+ uint32_t GetCount() { return m_format_map.GetCount(); }
+
+protected:
+ BackEndType m_format_map;
+ std::string m_name;
+
+ DISALLOW_COPY_AND_ASSIGN(FormattersContainer);
+
+ void Add_Impl(const MapKeyType &type, const MapValueType &entry,
+ lldb::RegularExpressionSP *dummy) {
+ m_format_map.Add(type, entry);
+ }
+
+ void Add_Impl(ConstString type, const MapValueType &entry,
+ ConstString *dummy) {
+ m_format_map.Add(GetValidTypeName_Impl(type), entry);
+ }
+
+ bool Delete_Impl(ConstString type, ConstString *dummy) {
+ return m_format_map.Delete(type);
+ }
+
+ bool Delete_Impl(ConstString type, lldb::RegularExpressionSP *dummy) {
+ std::lock_guard<std::recursive_mutex> guard(m_format_map.mutex());
+ MapIterator pos, end = m_format_map.map().end();
+ for (pos = m_format_map.map().begin(); pos != end; pos++) {
+ lldb::RegularExpressionSP regex = pos->first;
+ if (type.GetStringRef() == regex->GetText()) {
+ m_format_map.map().erase(pos);
+ if (m_format_map.listener)
+ m_format_map.listener->Changed();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ bool Get_Impl(ConstString type, MapValueType &entry, ConstString *dummy) {
+ return m_format_map.Get(type, entry);
+ }
+
+ bool GetExact_Impl(ConstString type, MapValueType &entry,
+ ConstString *dummy) {
+ return Get_Impl(type, entry, static_cast<KeyType *>(nullptr));
+ }
+
+ lldb::TypeNameSpecifierImplSP
+ GetTypeNameSpecifierAtIndex_Impl(size_t index, ConstString *dummy) {
+ ConstString key = m_format_map.GetKeyAtIndex(index);
+ if (key)
+ return lldb::TypeNameSpecifierImplSP(
+ new TypeNameSpecifierImpl(key.AsCString(), false));
+ else
+ return lldb::TypeNameSpecifierImplSP();
+ }
+
+ lldb::TypeNameSpecifierImplSP
+ GetTypeNameSpecifierAtIndex_Impl(size_t index,
+ lldb::RegularExpressionSP *dummy) {
+ lldb::RegularExpressionSP regex = m_format_map.GetKeyAtIndex(index);
+ if (regex.get() == nullptr)
+ return lldb::TypeNameSpecifierImplSP();
+ return lldb::TypeNameSpecifierImplSP(
+ new TypeNameSpecifierImpl(regex->GetText().str().c_str(), true));
+ }
+
+ bool Get_Impl(ConstString key, MapValueType &value,
+ lldb::RegularExpressionSP *dummy) {
+ llvm::StringRef key_str = key.GetStringRef();
+ std::lock_guard<std::recursive_mutex> guard(m_format_map.mutex());
+ MapIterator pos, end = m_format_map.map().end();
+ for (pos = m_format_map.map().begin(); pos != end; pos++) {
+ lldb::RegularExpressionSP regex = pos->first;
+ if (regex->Execute(key_str)) {
+ value = pos->second;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ bool GetExact_Impl(ConstString key, MapValueType &value,
+ lldb::RegularExpressionSP *dummy) {
+ std::lock_guard<std::recursive_mutex> guard(m_format_map.mutex());
+ MapIterator pos, end = m_format_map.map().end();
+ for (pos = m_format_map.map().begin(); pos != end; pos++) {
+ lldb::RegularExpressionSP regex = pos->first;
+ if (regex->GetText() == key.GetStringRef()) {
+ value = pos->second;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ bool Get(const FormattersMatchVector &candidates, MapValueType &entry,
+ uint32_t *reason) {
+ for (const FormattersMatchCandidate &candidate : candidates) {
+ if (Get(candidate.GetTypeName(), entry)) {
+ if (candidate.IsMatch(entry) == false) {
+ entry.reset();
+ continue;
+ } else {
+ if (reason)
+ *reason = candidate.GetReason();
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+};
+
+} // namespace lldb_private
+
+#endif // lldb_FormattersContainer_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/FormattersHelpers.h b/linux-x64/clang/include/lldb/DataFormatters/FormattersHelpers.h
new file mode 100644
index 0000000..79bd376
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/FormattersHelpers.h
@@ -0,0 +1,187 @@
+//===-- FormattersHelpers.h --------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_FormattersHelpers_h_
+#define lldb_FormattersHelpers_h_
+
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-forward.h"
+
+#include "lldb/DataFormatters/TypeCategory.h"
+#include "lldb/DataFormatters/TypeFormat.h"
+#include "lldb/DataFormatters/TypeSummary.h"
+#include "lldb/DataFormatters/TypeSynthetic.h"
+
+namespace lldb_private {
+namespace formatters {
+void AddFormat(TypeCategoryImpl::SharedPointer category_sp, lldb::Format format,
+ ConstString type_name, TypeFormatImpl::Flags flags,
+ bool regex = false);
+
+void AddSummary(TypeCategoryImpl::SharedPointer category_sp,
+ lldb::TypeSummaryImplSP summary_sp, ConstString type_name,
+ bool regex = false);
+
+void AddStringSummary(TypeCategoryImpl::SharedPointer category_sp,
+ const char *string, ConstString type_name,
+ TypeSummaryImpl::Flags flags, bool regex = false);
+
+void AddOneLineSummary(TypeCategoryImpl::SharedPointer category_sp,
+ ConstString type_name, TypeSummaryImpl::Flags flags,
+ bool regex = false);
+
+void AddCXXSummary(TypeCategoryImpl::SharedPointer category_sp,
+ CXXFunctionSummaryFormat::Callback funct,
+ const char *description, ConstString type_name,
+ TypeSummaryImpl::Flags flags, bool regex = false);
+
+void AddCXXSynthetic(TypeCategoryImpl::SharedPointer category_sp,
+ CXXSyntheticChildren::CreateFrontEndCallback generator,
+ const char *description, ConstString type_name,
+ ScriptedSyntheticChildren::Flags flags,
+ bool regex = false);
+
+void AddFilter(TypeCategoryImpl::SharedPointer category_sp,
+ std::vector<std::string> children, const char *description,
+ ConstString type_name, ScriptedSyntheticChildren::Flags flags,
+ bool regex = false);
+
+size_t ExtractIndexFromString(const char *item_name);
+
+lldb::addr_t GetArrayAddressOrPointerValue(ValueObject &valobj);
+
+time_t GetOSXEpoch();
+
+struct InferiorSizedWord {
+
+ InferiorSizedWord(const InferiorSizedWord &word) : ptr_size(word.ptr_size) {
+ if (ptr_size == 4)
+ thirty_two = word.thirty_two;
+ else
+ sixty_four = word.sixty_four;
+ }
+
+ InferiorSizedWord operator=(const InferiorSizedWord &word) {
+ ptr_size = word.ptr_size;
+ if (ptr_size == 4)
+ thirty_two = word.thirty_two;
+ else
+ sixty_four = word.sixty_four;
+ return *this;
+ }
+
+ InferiorSizedWord(uint64_t val, Process &process)
+ : ptr_size(process.GetAddressByteSize()) {
+ if (ptr_size == 4)
+ thirty_two = (uint32_t)val;
+ else if (ptr_size == 8)
+ sixty_four = val;
+ else
+ assert(false && "new pointer size is unknown");
+ }
+
+ bool IsNegative() const {
+ if (ptr_size == 4)
+ return ((int32_t)thirty_two) < 0;
+ else
+ return ((int64_t)sixty_four) < 0;
+ }
+
+ bool IsZero() const {
+ if (ptr_size == 4)
+ return thirty_two == 0;
+ else
+ return sixty_four == 0;
+ }
+
+ static InferiorSizedWord GetMaximum(Process &process) {
+ if (process.GetAddressByteSize() == 4)
+ return InferiorSizedWord(UINT32_MAX, 4);
+ else
+ return InferiorSizedWord(UINT64_MAX, 8);
+ }
+
+ InferiorSizedWord operator>>(int rhs) const {
+ if (ptr_size == 4)
+ return InferiorSizedWord(thirty_two >> rhs, 4);
+ return InferiorSizedWord(sixty_four >> rhs, 8);
+ }
+
+ InferiorSizedWord operator<<(int rhs) const {
+ if (ptr_size == 4)
+ return InferiorSizedWord(thirty_two << rhs, 4);
+ return InferiorSizedWord(sixty_four << rhs, 8);
+ }
+
+ InferiorSizedWord operator&(const InferiorSizedWord &word) const {
+ if (ptr_size != word.ptr_size)
+ return InferiorSizedWord(0, ptr_size);
+ if (ptr_size == 4)
+ return InferiorSizedWord(thirty_two & word.thirty_two, 4);
+ return InferiorSizedWord(sixty_four & word.sixty_four, 8);
+ }
+
+ InferiorSizedWord operator&(int x) const {
+ if (ptr_size == 4)
+ return InferiorSizedWord(thirty_two & x, 4);
+ return InferiorSizedWord(sixty_four & x, 8);
+ }
+
+ size_t GetBitSize() const { return ptr_size << 3; }
+
+ size_t GetByteSize() const { return ptr_size; }
+
+ uint64_t GetValue() const {
+ if (ptr_size == 4)
+ return (uint64_t)thirty_two;
+ return sixty_four;
+ }
+
+ InferiorSizedWord SignExtend() const {
+ if (ptr_size == 4)
+ return InferiorSizedWord((int32_t)thirty_two, 4);
+ return InferiorSizedWord((int64_t)sixty_four, 8);
+ }
+
+ uint8_t *CopyToBuffer(uint8_t *buffer) const {
+ if (ptr_size == 4) {
+ memcpy(buffer, &thirty_two, 4);
+ return buffer + 4;
+ } else {
+ memcpy(buffer, &sixty_four, 8);
+ return buffer + 8;
+ }
+ }
+
+ DataExtractor
+ GetAsData(lldb::ByteOrder byte_order = lldb::eByteOrderInvalid) const {
+ if (ptr_size == 4)
+ return DataExtractor(&thirty_two, 4, byte_order, 4);
+ else
+ return DataExtractor(&sixty_four, 8, byte_order, 8);
+ }
+
+private:
+ InferiorSizedWord(uint64_t val, size_t psz) : ptr_size(psz) {
+ if (ptr_size == 4)
+ thirty_two = (uint32_t)val;
+ else
+ sixty_four = val;
+ }
+
+ size_t ptr_size;
+ union {
+ uint32_t thirty_two;
+ uint64_t sixty_four;
+ };
+};
+} // namespace formatters
+} // namespace lldb_private
+
+#endif // lldb_FormattersHelpers_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/LanguageCategory.h b/linux-x64/clang/include/lldb/DataFormatters/LanguageCategory.h
new file mode 100644
index 0000000..f109d46
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/LanguageCategory.h
@@ -0,0 +1,75 @@
+//===-- LanguageCategory.h----------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_LanguageCategory_h_
+#define lldb_LanguageCategory_h_
+
+
+#include "lldb/DataFormatters/FormatCache.h"
+#include "lldb/DataFormatters/FormatClasses.h"
+#include "lldb/lldb-public.h"
+
+#include <memory>
+
+namespace lldb_private {
+
+class LanguageCategory {
+public:
+ typedef std::unique_ptr<LanguageCategory> UniquePointer;
+
+ LanguageCategory(lldb::LanguageType lang_type);
+
+ bool Get(FormattersMatchData &match_data, lldb::TypeFormatImplSP &format_sp);
+
+ bool Get(FormattersMatchData &match_data, lldb::TypeSummaryImplSP &format_sp);
+
+ bool Get(FormattersMatchData &match_data,
+ lldb::SyntheticChildrenSP &format_sp);
+
+ bool Get(FormattersMatchData &match_data,
+ lldb::TypeValidatorImplSP &format_sp);
+
+ bool GetHardcoded(FormatManager &fmt_mgr, FormattersMatchData &match_data,
+ lldb::TypeFormatImplSP &format_sp);
+
+ bool GetHardcoded(FormatManager &fmt_mgr, FormattersMatchData &match_data,
+ lldb::TypeSummaryImplSP &format_sp);
+
+ bool GetHardcoded(FormatManager &fmt_mgr, FormattersMatchData &match_data,
+ lldb::SyntheticChildrenSP &format_sp);
+
+ bool GetHardcoded(FormatManager &fmt_mgr, FormattersMatchData &match_data,
+ lldb::TypeValidatorImplSP &format_sp);
+
+ lldb::TypeCategoryImplSP GetCategory() const;
+
+ FormatCache &GetFormatCache();
+
+ void Enable();
+
+ void Disable();
+
+ bool IsEnabled();
+
+private:
+ lldb::TypeCategoryImplSP m_category_sp;
+
+ HardcodedFormatters::HardcodedFormatFinder m_hardcoded_formats;
+ HardcodedFormatters::HardcodedSummaryFinder m_hardcoded_summaries;
+ HardcodedFormatters::HardcodedSyntheticFinder m_hardcoded_synthetics;
+ HardcodedFormatters::HardcodedValidatorFinder m_hardcoded_validators;
+
+ lldb_private::FormatCache m_format_cache;
+
+ bool m_enabled;
+};
+
+} // namespace lldb_private
+
+#endif // lldb_LanguageCategory_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/StringPrinter.h b/linux-x64/clang/include/lldb/DataFormatters/StringPrinter.h
new file mode 100644
index 0000000..41d5edd
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/StringPrinter.h
@@ -0,0 +1,342 @@
+//===-- StringPrinter.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_StringPrinter_h_
+#define liblldb_StringPrinter_h_
+
+#include <functional>
+#include <string>
+
+#include "lldb/lldb-forward.h"
+
+#include "lldb/Utility/DataExtractor.h"
+
+namespace lldb_private {
+namespace formatters {
+class StringPrinter {
+public:
+ enum class StringElementType { ASCII, UTF8, UTF16, UTF32 };
+
+ enum class GetPrintableElementType { ASCII, UTF8 };
+
+ class ReadStringAndDumpToStreamOptions {
+ public:
+ ReadStringAndDumpToStreamOptions()
+ : m_location(0), m_process_sp(), m_stream(nullptr), m_prefix_token(),
+ m_suffix_token(), m_quote('"'), m_source_size(0),
+ m_needs_zero_termination(true), m_escape_non_printables(true),
+ m_ignore_max_length(false), m_zero_is_terminator(true),
+ m_language_type(lldb::eLanguageTypeUnknown) {}
+
+ ReadStringAndDumpToStreamOptions(ValueObject &valobj);
+
+ ReadStringAndDumpToStreamOptions &SetLocation(uint64_t l) {
+ m_location = l;
+ return *this;
+ }
+
+ uint64_t GetLocation() const { return m_location; }
+
+ ReadStringAndDumpToStreamOptions &SetProcessSP(lldb::ProcessSP p) {
+ m_process_sp = p;
+ return *this;
+ }
+
+ lldb::ProcessSP GetProcessSP() const { return m_process_sp; }
+
+ ReadStringAndDumpToStreamOptions &SetStream(Stream *s) {
+ m_stream = s;
+ return *this;
+ }
+
+ Stream *GetStream() const { return m_stream; }
+
+ ReadStringAndDumpToStreamOptions &SetPrefixToken(const std::string &p) {
+ m_prefix_token = p;
+ return *this;
+ }
+
+ ReadStringAndDumpToStreamOptions &SetPrefixToken(std::nullptr_t) {
+ m_prefix_token.clear();
+ return *this;
+ }
+
+ const char *GetPrefixToken() const { return m_prefix_token.c_str(); }
+
+ ReadStringAndDumpToStreamOptions &SetSuffixToken(const std::string &p) {
+ m_suffix_token = p;
+ return *this;
+ }
+
+ ReadStringAndDumpToStreamOptions &SetSuffixToken(std::nullptr_t) {
+ m_suffix_token.clear();
+ return *this;
+ }
+
+ const char *GetSuffixToken() const { return m_suffix_token.c_str(); }
+
+ ReadStringAndDumpToStreamOptions &SetQuote(char q) {
+ m_quote = q;
+ return *this;
+ }
+
+ char GetQuote() const { return m_quote; }
+
+ ReadStringAndDumpToStreamOptions &SetSourceSize(uint32_t s) {
+ m_source_size = s;
+ return *this;
+ }
+
+ uint32_t GetSourceSize() const { return m_source_size; }
+
+ ReadStringAndDumpToStreamOptions &SetNeedsZeroTermination(bool z) {
+ m_needs_zero_termination = z;
+ return *this;
+ }
+
+ bool GetNeedsZeroTermination() const { return m_needs_zero_termination; }
+
+ ReadStringAndDumpToStreamOptions &SetBinaryZeroIsTerminator(bool e) {
+ m_zero_is_terminator = e;
+ return *this;
+ }
+
+ bool GetBinaryZeroIsTerminator() const { return m_zero_is_terminator; }
+
+ ReadStringAndDumpToStreamOptions &SetEscapeNonPrintables(bool e) {
+ m_escape_non_printables = e;
+ return *this;
+ }
+
+ bool GetEscapeNonPrintables() const { return m_escape_non_printables; }
+
+ ReadStringAndDumpToStreamOptions &SetIgnoreMaxLength(bool e) {
+ m_ignore_max_length = e;
+ return *this;
+ }
+
+ bool GetIgnoreMaxLength() const { return m_ignore_max_length; }
+
+ ReadStringAndDumpToStreamOptions &SetLanguage(lldb::LanguageType l) {
+ m_language_type = l;
+ return *this;
+ }
+
+ lldb::LanguageType GetLanguage() const
+
+ {
+ return m_language_type;
+ }
+
+ private:
+ uint64_t m_location;
+ lldb::ProcessSP m_process_sp;
+ Stream *m_stream;
+ std::string m_prefix_token;
+ std::string m_suffix_token;
+ char m_quote;
+ uint32_t m_source_size;
+ bool m_needs_zero_termination;
+ bool m_escape_non_printables;
+ bool m_ignore_max_length;
+ bool m_zero_is_terminator;
+ lldb::LanguageType m_language_type;
+ };
+
+ class ReadBufferAndDumpToStreamOptions {
+ public:
+ ReadBufferAndDumpToStreamOptions()
+ : m_data(), m_stream(nullptr), m_prefix_token(), m_suffix_token(),
+ m_quote('"'), m_source_size(0), m_escape_non_printables(true),
+ m_zero_is_terminator(true), m_is_truncated(false),
+ m_language_type(lldb::eLanguageTypeUnknown) {}
+
+ ReadBufferAndDumpToStreamOptions(ValueObject &valobj);
+
+ ReadBufferAndDumpToStreamOptions(
+ const ReadStringAndDumpToStreamOptions &options);
+
+ ReadBufferAndDumpToStreamOptions &SetData(DataExtractor d) {
+ m_data = d;
+ return *this;
+ }
+
+ lldb_private::DataExtractor GetData() const { return m_data; }
+
+ ReadBufferAndDumpToStreamOptions &SetStream(Stream *s) {
+ m_stream = s;
+ return *this;
+ }
+
+ Stream *GetStream() const { return m_stream; }
+
+ ReadBufferAndDumpToStreamOptions &SetPrefixToken(const std::string &p) {
+ m_prefix_token = p;
+ return *this;
+ }
+
+ ReadBufferAndDumpToStreamOptions &SetPrefixToken(std::nullptr_t) {
+ m_prefix_token.clear();
+ return *this;
+ }
+
+ const char *GetPrefixToken() const { return m_prefix_token.c_str(); }
+
+ ReadBufferAndDumpToStreamOptions &SetSuffixToken(const std::string &p) {
+ m_suffix_token = p;
+ return *this;
+ }
+
+ ReadBufferAndDumpToStreamOptions &SetSuffixToken(std::nullptr_t) {
+ m_suffix_token.clear();
+ return *this;
+ }
+
+ const char *GetSuffixToken() const { return m_suffix_token.c_str(); }
+
+ ReadBufferAndDumpToStreamOptions &SetQuote(char q) {
+ m_quote = q;
+ return *this;
+ }
+
+ char GetQuote() const { return m_quote; }
+
+ ReadBufferAndDumpToStreamOptions &SetSourceSize(uint32_t s) {
+ m_source_size = s;
+ return *this;
+ }
+
+ uint32_t GetSourceSize() const { return m_source_size; }
+
+ ReadBufferAndDumpToStreamOptions &SetEscapeNonPrintables(bool e) {
+ m_escape_non_printables = e;
+ return *this;
+ }
+
+ bool GetEscapeNonPrintables() const { return m_escape_non_printables; }
+
+ ReadBufferAndDumpToStreamOptions &SetBinaryZeroIsTerminator(bool e) {
+ m_zero_is_terminator = e;
+ return *this;
+ }
+
+ bool GetBinaryZeroIsTerminator() const { return m_zero_is_terminator; }
+
+ ReadBufferAndDumpToStreamOptions &SetIsTruncated(bool t) {
+ m_is_truncated = t;
+ return *this;
+ }
+
+ bool GetIsTruncated() const { return m_is_truncated; }
+
+ ReadBufferAndDumpToStreamOptions &SetLanguage(lldb::LanguageType l) {
+ m_language_type = l;
+ return *this;
+ }
+
+ lldb::LanguageType GetLanguage() const
+
+ {
+ return m_language_type;
+ }
+
+ private:
+ DataExtractor m_data;
+ Stream *m_stream;
+ std::string m_prefix_token;
+ std::string m_suffix_token;
+ char m_quote;
+ uint32_t m_source_size;
+ bool m_escape_non_printables;
+ bool m_zero_is_terminator;
+ bool m_is_truncated;
+ lldb::LanguageType m_language_type;
+ };
+
+ // I can't use a std::unique_ptr for this because the Deleter is a template
+ // argument there
+ // and I want the same type to represent both pointers I want to free and
+ // pointers I don't need to free - which is what this class essentially is
+ // It's very specialized to the needs of this file, and not suggested for
+ // general use
+ template <typename T = uint8_t, typename U = char, typename S = size_t>
+ struct StringPrinterBufferPointer {
+ public:
+ typedef std::function<void(const T *)> Deleter;
+
+ StringPrinterBufferPointer(std::nullptr_t ptr)
+ : m_data(nullptr), m_size(0), m_deleter() {}
+
+ StringPrinterBufferPointer(const T *bytes, S size,
+ Deleter deleter = nullptr)
+ : m_data(bytes), m_size(size), m_deleter(deleter) {}
+
+ StringPrinterBufferPointer(const U *bytes, S size,
+ Deleter deleter = nullptr)
+ : m_data(reinterpret_cast<const T *>(bytes)), m_size(size),
+ m_deleter(deleter) {}
+
+ StringPrinterBufferPointer(StringPrinterBufferPointer &&rhs)
+ : m_data(rhs.m_data), m_size(rhs.m_size), m_deleter(rhs.m_deleter) {
+ rhs.m_data = nullptr;
+ }
+
+ StringPrinterBufferPointer(const StringPrinterBufferPointer &rhs)
+ : m_data(rhs.m_data), m_size(rhs.m_size), m_deleter(rhs.m_deleter) {
+ rhs.m_data = nullptr; // this is why m_data has to be mutable
+ }
+
+ ~StringPrinterBufferPointer() {
+ if (m_data && m_deleter)
+ m_deleter(m_data);
+ m_data = nullptr;
+ }
+
+ const T *GetBytes() const { return m_data; }
+
+ const S GetSize() const { return m_size; }
+
+ StringPrinterBufferPointer &
+ operator=(const StringPrinterBufferPointer &rhs) {
+ if (m_data && m_deleter)
+ m_deleter(m_data);
+ m_data = rhs.m_data;
+ m_size = rhs.m_size;
+ m_deleter = rhs.m_deleter;
+ rhs.m_data = nullptr;
+ return *this;
+ }
+
+ private:
+ mutable const T *m_data;
+ size_t m_size;
+ Deleter m_deleter;
+ };
+
+ typedef std::function<StringPrinter::StringPrinterBufferPointer<
+ uint8_t, char, size_t>(uint8_t *, uint8_t *, uint8_t *&)>
+ EscapingHelper;
+ typedef std::function<EscapingHelper(GetPrintableElementType)>
+ EscapingHelperGenerator;
+
+ static EscapingHelper
+ GetDefaultEscapingHelper(GetPrintableElementType elem_type);
+
+ template <StringElementType element_type>
+ static bool
+ ReadStringAndDumpToStream(const ReadStringAndDumpToStreamOptions &options);
+
+ template <StringElementType element_type>
+ static bool
+ ReadBufferAndDumpToStream(const ReadBufferAndDumpToStreamOptions &options);
+};
+
+} // namespace formatters
+} // namespace lldb_private
+
+#endif // liblldb_StringPrinter_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/TypeCategory.h b/linux-x64/clang/include/lldb/DataFormatters/TypeCategory.h
new file mode 100644
index 0000000..bdb393a
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/TypeCategory.h
@@ -0,0 +1,427 @@
+//===-- TypeCategory.h ------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_TypeCategory_h_
+#define lldb_TypeCategory_h_
+
+#include <initializer_list>
+#include <memory>
+#include <mutex>
+#include <string>
+#include <vector>
+
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-public.h"
+
+#include "lldb/DataFormatters/FormatClasses.h"
+#include "lldb/DataFormatters/FormattersContainer.h"
+
+namespace lldb_private {
+
+template <typename FormatterImpl> class FormatterContainerPair {
+public:
+ typedef FormattersContainer<ConstString, FormatterImpl> ExactMatchContainer;
+ typedef FormattersContainer<lldb::RegularExpressionSP, FormatterImpl>
+ RegexMatchContainer;
+
+ typedef typename ExactMatchContainer::MapType ExactMatchMap;
+ typedef typename RegexMatchContainer::MapType RegexMatchMap;
+
+ typedef typename ExactMatchContainer::MapValueType MapValueType;
+
+ typedef typename ExactMatchContainer::SharedPointer ExactMatchContainerSP;
+ typedef typename RegexMatchContainer::SharedPointer RegexMatchContainerSP;
+
+ typedef
+ typename ExactMatchContainer::ForEachCallback ExactMatchForEachCallback;
+ typedef
+ typename RegexMatchContainer::ForEachCallback RegexMatchForEachCallback;
+
+ FormatterContainerPair(const char *exact_name, const char *regex_name,
+ IFormatChangeListener *clist)
+ : m_exact_sp(new ExactMatchContainer(std::string(exact_name), clist)),
+ m_regex_sp(new RegexMatchContainer(std::string(regex_name), clist)) {}
+
+ ~FormatterContainerPair() = default;
+
+ ExactMatchContainerSP GetExactMatch() const { return m_exact_sp; }
+
+ RegexMatchContainerSP GetRegexMatch() const { return m_regex_sp; }
+
+ uint32_t GetCount() {
+ return GetExactMatch()->GetCount() + GetRegexMatch()->GetCount();
+ }
+
+private:
+ ExactMatchContainerSP m_exact_sp;
+ RegexMatchContainerSP m_regex_sp;
+};
+
+class TypeCategoryImpl {
+private:
+ typedef FormatterContainerPair<TypeFormatImpl> FormatContainer;
+ typedef FormatterContainerPair<TypeSummaryImpl> SummaryContainer;
+ typedef FormatterContainerPair<TypeFilterImpl> FilterContainer;
+ typedef FormatterContainerPair<TypeValidatorImpl> ValidatorContainer;
+ typedef FormatterContainerPair<SyntheticChildren> SynthContainer;
+
+public:
+ typedef uint16_t FormatCategoryItems;
+ static const uint16_t ALL_ITEM_TYPES = UINT16_MAX;
+
+ typedef FormatContainer::ExactMatchContainerSP FormatContainerSP;
+ typedef FormatContainer::RegexMatchContainerSP RegexFormatContainerSP;
+
+ typedef SummaryContainer::ExactMatchContainerSP SummaryContainerSP;
+ typedef SummaryContainer::RegexMatchContainerSP RegexSummaryContainerSP;
+
+ typedef FilterContainer::ExactMatchContainerSP FilterContainerSP;
+ typedef FilterContainer::RegexMatchContainerSP RegexFilterContainerSP;
+
+ typedef SynthContainer::ExactMatchContainerSP SynthContainerSP;
+ typedef SynthContainer::RegexMatchContainerSP RegexSynthContainerSP;
+
+ typedef ValidatorContainer::ExactMatchContainerSP ValidatorContainerSP;
+ typedef ValidatorContainer::RegexMatchContainerSP RegexValidatorContainerSP;
+
+ template <typename T> class ForEachCallbacks {
+ public:
+ ForEachCallbacks() = default;
+ ~ForEachCallbacks() = default;
+
+ template <typename U = TypeFormatImpl>
+ typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
+ SetExact(FormatContainer::ExactMatchForEachCallback callback) {
+ m_format_exact = callback;
+ return *this;
+ }
+ template <typename U = TypeFormatImpl>
+ typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
+ SetWithRegex(FormatContainer::RegexMatchForEachCallback callback) {
+ m_format_regex = callback;
+ return *this;
+ }
+
+ template <typename U = TypeSummaryImpl>
+ typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
+ SetExact(SummaryContainer::ExactMatchForEachCallback callback) {
+ m_summary_exact = callback;
+ return *this;
+ }
+ template <typename U = TypeSummaryImpl>
+ typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
+ SetWithRegex(SummaryContainer::RegexMatchForEachCallback callback) {
+ m_summary_regex = callback;
+ return *this;
+ }
+
+ template <typename U = TypeFilterImpl>
+ typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
+ SetExact(FilterContainer::ExactMatchForEachCallback callback) {
+ m_filter_exact = callback;
+ return *this;
+ }
+ template <typename U = TypeFilterImpl>
+ typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
+ SetWithRegex(FilterContainer::RegexMatchForEachCallback callback) {
+ m_filter_regex = callback;
+ return *this;
+ }
+
+ template <typename U = SyntheticChildren>
+ typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
+ SetExact(SynthContainer::ExactMatchForEachCallback callback) {
+ m_synth_exact = callback;
+ return *this;
+ }
+ template <typename U = SyntheticChildren>
+ typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
+ SetWithRegex(SynthContainer::RegexMatchForEachCallback callback) {
+ m_synth_regex = callback;
+ return *this;
+ }
+ template <typename U = TypeValidatorImpl>
+ typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
+ SetExact(ValidatorContainer::ExactMatchForEachCallback callback) {
+ m_validator_exact = callback;
+ return *this;
+ }
+ template <typename U = TypeValidatorImpl>
+ typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type
+ SetWithRegex(ValidatorContainer::RegexMatchForEachCallback callback) {
+ m_validator_regex = callback;
+ return *this;
+ }
+
+ FormatContainer::ExactMatchForEachCallback GetFormatExactCallback() const {
+ return m_format_exact;
+ }
+ FormatContainer::RegexMatchForEachCallback GetFormatRegexCallback() const {
+ return m_format_regex;
+ }
+
+ SummaryContainer::ExactMatchForEachCallback
+ GetSummaryExactCallback() const {
+ return m_summary_exact;
+ }
+ SummaryContainer::RegexMatchForEachCallback
+ GetSummaryRegexCallback() const {
+ return m_summary_regex;
+ }
+
+ FilterContainer::ExactMatchForEachCallback GetFilterExactCallback() const {
+ return m_filter_exact;
+ }
+ FilterContainer::RegexMatchForEachCallback GetFilterRegexCallback() const {
+ return m_filter_regex;
+ }
+
+ SynthContainer::ExactMatchForEachCallback GetSynthExactCallback() const {
+ return m_synth_exact;
+ }
+ SynthContainer::RegexMatchForEachCallback GetSynthRegexCallback() const {
+ return m_synth_regex;
+ }
+
+ ValidatorContainer::ExactMatchForEachCallback
+ GetValidatorExactCallback() const {
+ return m_validator_exact;
+ }
+ ValidatorContainer::RegexMatchForEachCallback
+ GetValidatorRegexCallback() const {
+ return m_validator_regex;
+ }
+
+ private:
+ FormatContainer::ExactMatchForEachCallback m_format_exact;
+ FormatContainer::RegexMatchForEachCallback m_format_regex;
+
+ SummaryContainer::ExactMatchForEachCallback m_summary_exact;
+ SummaryContainer::RegexMatchForEachCallback m_summary_regex;
+
+ FilterContainer::ExactMatchForEachCallback m_filter_exact;
+ FilterContainer::RegexMatchForEachCallback m_filter_regex;
+
+ SynthContainer::ExactMatchForEachCallback m_synth_exact;
+ SynthContainer::RegexMatchForEachCallback m_synth_regex;
+
+ ValidatorContainer::ExactMatchForEachCallback m_validator_exact;
+ ValidatorContainer::RegexMatchForEachCallback m_validator_regex;
+ };
+
+ TypeCategoryImpl(IFormatChangeListener *clist, ConstString name,
+ std::initializer_list<lldb::LanguageType> langs = {});
+
+ template <typename T> void ForEach(const ForEachCallbacks<T> &foreach) {
+ GetTypeFormatsContainer()->ForEach(foreach.GetFormatExactCallback());
+ GetRegexTypeFormatsContainer()->ForEach(foreach.GetFormatRegexCallback());
+
+ GetTypeSummariesContainer()->ForEach(foreach.GetSummaryExactCallback());
+ GetRegexTypeSummariesContainer()->ForEach(
+ foreach.GetSummaryRegexCallback());
+
+ GetTypeFiltersContainer()->ForEach(foreach.GetFilterExactCallback());
+ GetRegexTypeFiltersContainer()->ForEach(foreach.GetFilterRegexCallback());
+
+ GetTypeSyntheticsContainer()->ForEach(foreach.GetSynthExactCallback());
+ GetRegexTypeSyntheticsContainer()->ForEach(foreach.GetSynthRegexCallback());
+
+ GetTypeValidatorsContainer()->ForEach(foreach.GetValidatorExactCallback());
+ GetRegexTypeValidatorsContainer()->ForEach(
+ foreach.GetValidatorRegexCallback());
+ }
+
+ FormatContainerSP GetTypeFormatsContainer() {
+ return m_format_cont.GetExactMatch();
+ }
+
+ RegexFormatContainerSP GetRegexTypeFormatsContainer() {
+ return m_format_cont.GetRegexMatch();
+ }
+
+ FormatContainer &GetFormatContainer() { return m_format_cont; }
+
+ SummaryContainerSP GetTypeSummariesContainer() {
+ return m_summary_cont.GetExactMatch();
+ }
+
+ RegexSummaryContainerSP GetRegexTypeSummariesContainer() {
+ return m_summary_cont.GetRegexMatch();
+ }
+
+ SummaryContainer &GetSummaryContainer() { return m_summary_cont; }
+
+ FilterContainerSP GetTypeFiltersContainer() {
+ return m_filter_cont.GetExactMatch();
+ }
+
+ RegexFilterContainerSP GetRegexTypeFiltersContainer() {
+ return m_filter_cont.GetRegexMatch();
+ }
+
+ FilterContainer &GetFilterContainer() { return m_filter_cont; }
+
+ FormatContainer::MapValueType
+ GetFormatForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ SummaryContainer::MapValueType
+ GetSummaryForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ FilterContainer::MapValueType
+ GetFilterForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ SynthContainer::MapValueType
+ GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ ValidatorContainer::MapValueType
+ GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp);
+
+ lldb::TypeNameSpecifierImplSP
+ GetTypeNameSpecifierForFormatAtIndex(size_t index);
+
+ lldb::TypeNameSpecifierImplSP
+ GetTypeNameSpecifierForSummaryAtIndex(size_t index);
+
+ FormatContainer::MapValueType GetFormatAtIndex(size_t index);
+
+ SummaryContainer::MapValueType GetSummaryAtIndex(size_t index);
+
+ FilterContainer::MapValueType GetFilterAtIndex(size_t index);
+
+ lldb::TypeNameSpecifierImplSP
+ GetTypeNameSpecifierForFilterAtIndex(size_t index);
+
+ SynthContainerSP GetTypeSyntheticsContainer() {
+ return m_synth_cont.GetExactMatch();
+ }
+
+ RegexSynthContainerSP GetRegexTypeSyntheticsContainer() {
+ return m_synth_cont.GetRegexMatch();
+ }
+
+ SynthContainer &GetSyntheticsContainer() { return m_synth_cont; }
+
+ SynthContainer::MapValueType GetSyntheticAtIndex(size_t index);
+
+ lldb::TypeNameSpecifierImplSP
+ GetTypeNameSpecifierForSyntheticAtIndex(size_t index);
+
+ ValidatorContainerSP GetTypeValidatorsContainer() {
+ return m_validator_cont.GetExactMatch();
+ }
+
+ RegexValidatorContainerSP GetRegexTypeValidatorsContainer() {
+ return m_validator_cont.GetRegexMatch();
+ }
+
+ ValidatorContainer::MapValueType GetValidatorAtIndex(size_t index);
+
+ lldb::TypeNameSpecifierImplSP
+ GetTypeNameSpecifierForValidatorAtIndex(size_t index);
+
+ bool IsEnabled() const { return m_enabled; }
+
+ uint32_t GetEnabledPosition() {
+ if (!m_enabled)
+ return UINT32_MAX;
+ else
+ return m_enabled_position;
+ }
+
+ bool Get(ValueObject &valobj, const FormattersMatchVector &candidates,
+ lldb::TypeFormatImplSP &entry, uint32_t *reason = nullptr);
+
+ bool Get(ValueObject &valobj, const FormattersMatchVector &candidates,
+ lldb::TypeSummaryImplSP &entry, uint32_t *reason = nullptr);
+
+ bool Get(ValueObject &valobj, const FormattersMatchVector &candidates,
+ lldb::SyntheticChildrenSP &entry, uint32_t *reason = nullptr);
+
+ bool Get(ValueObject &valobj, const FormattersMatchVector &candidates,
+ lldb::TypeValidatorImplSP &entry, uint32_t *reason = nullptr);
+
+ void Clear(FormatCategoryItems items = ALL_ITEM_TYPES);
+
+ bool Delete(ConstString name, FormatCategoryItems items = ALL_ITEM_TYPES);
+
+ uint32_t GetCount(FormatCategoryItems items = ALL_ITEM_TYPES);
+
+ const char *GetName() { return m_name.GetCString(); }
+
+ size_t GetNumLanguages();
+
+ lldb::LanguageType GetLanguageAtIndex(size_t idx);
+
+ void AddLanguage(lldb::LanguageType lang);
+
+ bool HasLanguage(lldb::LanguageType lang);
+
+ std::string GetDescription();
+
+ bool AnyMatches(ConstString type_name,
+ FormatCategoryItems items = ALL_ITEM_TYPES,
+ bool only_enabled = true,
+ const char **matching_category = nullptr,
+ FormatCategoryItems *matching_type = nullptr);
+
+ typedef std::shared_ptr<TypeCategoryImpl> SharedPointer;
+
+private:
+ FormatContainer m_format_cont;
+ SummaryContainer m_summary_cont;
+ FilterContainer m_filter_cont;
+ SynthContainer m_synth_cont;
+ ValidatorContainer m_validator_cont;
+
+ bool m_enabled;
+
+ IFormatChangeListener *m_change_listener;
+
+ std::recursive_mutex m_mutex;
+
+ ConstString m_name;
+
+ std::vector<lldb::LanguageType> m_languages;
+
+ uint32_t m_enabled_position;
+
+ void Enable(bool value, uint32_t position);
+
+ void Disable() { Enable(false, UINT32_MAX); }
+
+ bool IsApplicable(ValueObject &valobj);
+
+ uint32_t GetLastEnabledPosition() { return m_enabled_position; }
+
+ void SetEnabledPosition(uint32_t p) { m_enabled_position = p; }
+
+ friend class FormatManager;
+ friend class LanguageCategory;
+ friend class TypeCategoryMap;
+
+ friend class FormattersContainer<ConstString, TypeFormatImpl>;
+ friend class FormattersContainer<lldb::RegularExpressionSP, TypeFormatImpl>;
+
+ friend class FormattersContainer<ConstString, TypeSummaryImpl>;
+ friend class FormattersContainer<lldb::RegularExpressionSP, TypeSummaryImpl>;
+
+ friend class FormattersContainer<ConstString, TypeFilterImpl>;
+ friend class FormattersContainer<lldb::RegularExpressionSP, TypeFilterImpl>;
+
+ friend class FormattersContainer<ConstString, ScriptedSyntheticChildren>;
+ friend class FormattersContainer<lldb::RegularExpressionSP,
+ ScriptedSyntheticChildren>;
+
+ friend class FormattersContainer<ConstString, TypeValidatorImpl>;
+ friend class FormattersContainer<lldb::RegularExpressionSP,
+ TypeValidatorImpl>;
+};
+
+} // namespace lldb_private
+
+#endif // lldb_TypeCategory_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/TypeCategoryMap.h b/linux-x64/clang/include/lldb/DataFormatters/TypeCategoryMap.h
new file mode 100644
index 0000000..753b58c
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/TypeCategoryMap.h
@@ -0,0 +1,118 @@
+//===-- TypeCategoryMap.h ---------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_TypeCategoryMap_h_
+#define lldb_TypeCategoryMap_h_
+
+#include <functional>
+#include <list>
+#include <map>
+#include <mutex>
+
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-public.h"
+
+#include "lldb/DataFormatters/FormattersContainer.h"
+#include "lldb/DataFormatters/TypeCategory.h"
+
+namespace lldb_private {
+class TypeCategoryMap {
+private:
+ typedef ConstString KeyType;
+ typedef TypeCategoryImpl ValueType;
+ typedef ValueType::SharedPointer ValueSP;
+ typedef std::list<lldb::TypeCategoryImplSP> ActiveCategoriesList;
+ typedef ActiveCategoriesList::iterator ActiveCategoriesIterator;
+
+public:
+ typedef std::map<KeyType, ValueSP> MapType;
+ typedef MapType::iterator MapIterator;
+ typedef std::function<bool(const ValueSP &)> ForEachCallback;
+
+ typedef uint32_t Position;
+
+ static const Position First = 0;
+ static const Position Default = 1;
+ static const Position Last = UINT32_MAX;
+
+ TypeCategoryMap(IFormatChangeListener *lst);
+
+ void Add(KeyType name, const ValueSP &entry);
+
+ bool Delete(KeyType name);
+
+ bool Enable(KeyType category_name, Position pos = Default);
+
+ bool Disable(KeyType category_name);
+
+ bool Enable(ValueSP category, Position pos = Default);
+
+ bool Disable(ValueSP category);
+
+ void EnableAllCategories();
+
+ void DisableAllCategories();
+
+ void Clear();
+
+ bool Get(KeyType name, ValueSP &entry);
+
+ bool Get(uint32_t pos, ValueSP &entry);
+
+ void ForEach(ForEachCallback callback);
+
+ lldb::TypeCategoryImplSP GetAtIndex(uint32_t);
+
+ bool
+ AnyMatches(ConstString type_name,
+ TypeCategoryImpl::FormatCategoryItems items =
+ TypeCategoryImpl::ALL_ITEM_TYPES,
+ bool only_enabled = true, const char **matching_category = nullptr,
+ TypeCategoryImpl::FormatCategoryItems *matching_type = nullptr);
+
+ uint32_t GetCount() { return m_map.size(); }
+
+ lldb::TypeFormatImplSP GetFormat(FormattersMatchData &match_data);
+
+ lldb::TypeSummaryImplSP GetSummaryFormat(FormattersMatchData &match_data);
+
+ lldb::SyntheticChildrenSP
+ GetSyntheticChildren(FormattersMatchData &match_data);
+
+ lldb::TypeValidatorImplSP GetValidator(FormattersMatchData &match_data);
+
+private:
+ class delete_matching_categories {
+ lldb::TypeCategoryImplSP ptr;
+
+ public:
+ delete_matching_categories(lldb::TypeCategoryImplSP p) : ptr(p) {}
+
+ bool operator()(const lldb::TypeCategoryImplSP &other) {
+ return ptr.get() == other.get();
+ }
+ };
+
+ std::recursive_mutex m_map_mutex;
+ IFormatChangeListener *listener;
+
+ MapType m_map;
+ ActiveCategoriesList m_active_categories;
+
+ MapType &map() { return m_map; }
+
+ ActiveCategoriesList &active_list() { return m_active_categories; }
+
+ std::recursive_mutex &mutex() { return m_map_mutex; }
+
+ friend class FormattersContainer<KeyType, ValueType>;
+ friend class FormatManager;
+};
+} // namespace lldb_private
+
+#endif // lldb_TypeCategoryMap_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/TypeFormat.h b/linux-x64/clang/include/lldb/DataFormatters/TypeFormat.h
new file mode 100644
index 0000000..77e8c0e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/TypeFormat.h
@@ -0,0 +1,217 @@
+//===-- TypeFormat.h ----------------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_TypeFormat_h_
+#define lldb_TypeFormat_h_
+
+
+#include <functional>
+#include <string>
+#include <unordered_map>
+
+
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-public.h"
+
+#include "lldb/Core/ValueObject.h"
+
+namespace lldb_private {
+class TypeFormatImpl {
+public:
+ class Flags {
+ public:
+ Flags() : m_flags(lldb::eTypeOptionCascade) {}
+
+ Flags(const Flags &other) : m_flags(other.m_flags) {}
+
+ Flags(uint32_t value) : m_flags(value) {}
+
+ Flags &operator=(const Flags &rhs) {
+ if (&rhs != this)
+ m_flags = rhs.m_flags;
+
+ return *this;
+ }
+
+ Flags &operator=(const uint32_t &rhs) {
+ m_flags = rhs;
+ return *this;
+ }
+
+ Flags &Clear() {
+ m_flags = 0;
+ return *this;
+ }
+
+ bool GetCascades() const {
+ return (m_flags & lldb::eTypeOptionCascade) == lldb::eTypeOptionCascade;
+ }
+
+ Flags &SetCascades(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionCascade;
+ else
+ m_flags &= ~lldb::eTypeOptionCascade;
+ return *this;
+ }
+
+ bool GetSkipPointers() const {
+ return (m_flags & lldb::eTypeOptionSkipPointers) ==
+ lldb::eTypeOptionSkipPointers;
+ }
+
+ Flags &SetSkipPointers(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionSkipPointers;
+ else
+ m_flags &= ~lldb::eTypeOptionSkipPointers;
+ return *this;
+ }
+
+ bool GetSkipReferences() const {
+ return (m_flags & lldb::eTypeOptionSkipReferences) ==
+ lldb::eTypeOptionSkipReferences;
+ }
+
+ Flags &SetSkipReferences(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionSkipReferences;
+ else
+ m_flags &= ~lldb::eTypeOptionSkipReferences;
+ return *this;
+ }
+
+ bool GetNonCacheable() const {
+ return (m_flags & lldb::eTypeOptionNonCacheable) ==
+ lldb::eTypeOptionNonCacheable;
+ }
+
+ Flags &SetNonCacheable(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionNonCacheable;
+ else
+ m_flags &= ~lldb::eTypeOptionNonCacheable;
+ return *this;
+ }
+
+ uint32_t GetValue() { return m_flags; }
+
+ void SetValue(uint32_t value) { m_flags = value; }
+
+ private:
+ uint32_t m_flags;
+ };
+
+ TypeFormatImpl(const Flags &flags = Flags());
+
+ typedef std::shared_ptr<TypeFormatImpl> SharedPointer;
+
+ virtual ~TypeFormatImpl();
+
+ bool Cascades() const { return m_flags.GetCascades(); }
+
+ bool SkipsPointers() const { return m_flags.GetSkipPointers(); }
+
+ bool SkipsReferences() const { return m_flags.GetSkipReferences(); }
+
+ bool NonCacheable() const { return m_flags.GetNonCacheable(); }
+
+ void SetCascades(bool value) { m_flags.SetCascades(value); }
+
+ void SetSkipsPointers(bool value) { m_flags.SetSkipPointers(value); }
+
+ void SetSkipsReferences(bool value) { m_flags.SetSkipReferences(value); }
+
+ void SetNonCacheable(bool value) { m_flags.SetNonCacheable(value); }
+
+ uint32_t GetOptions() { return m_flags.GetValue(); }
+
+ void SetOptions(uint32_t value) { m_flags.SetValue(value); }
+
+ uint32_t &GetRevision() { return m_my_revision; }
+
+ enum class Type { eTypeUnknown, eTypeFormat, eTypeEnum };
+
+ virtual Type GetType() { return Type::eTypeUnknown; }
+
+ // we are using a ValueObject* instead of a ValueObjectSP because we do not
+ // need to hold on to this for extended periods of time and we trust the
+ // ValueObject to stay around for as long as it is required for us to
+ // generate its value
+ virtual bool FormatObject(ValueObject *valobj, std::string &dest) const = 0;
+
+ virtual std::string GetDescription() = 0;
+
+protected:
+ Flags m_flags;
+ uint32_t m_my_revision;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(TypeFormatImpl);
+};
+
+class TypeFormatImpl_Format : public TypeFormatImpl {
+public:
+ TypeFormatImpl_Format(lldb::Format f = lldb::eFormatInvalid,
+ const TypeFormatImpl::Flags &flags = Flags());
+
+ typedef std::shared_ptr<TypeFormatImpl_Format> SharedPointer;
+
+ ~TypeFormatImpl_Format() override;
+
+ lldb::Format GetFormat() const { return m_format; }
+
+ void SetFormat(lldb::Format fmt) { m_format = fmt; }
+
+ TypeFormatImpl::Type GetType() override {
+ return TypeFormatImpl::Type::eTypeFormat;
+ }
+
+ bool FormatObject(ValueObject *valobj, std::string &dest) const override;
+
+ std::string GetDescription() override;
+
+protected:
+ lldb::Format m_format;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(TypeFormatImpl_Format);
+};
+
+class TypeFormatImpl_EnumType : public TypeFormatImpl {
+public:
+ TypeFormatImpl_EnumType(ConstString type_name = ConstString(""),
+ const TypeFormatImpl::Flags &flags = Flags());
+
+ typedef std::shared_ptr<TypeFormatImpl_EnumType> SharedPointer;
+
+ ~TypeFormatImpl_EnumType() override;
+
+ ConstString GetTypeName() { return m_enum_type; }
+
+ void SetTypeName(ConstString enum_type) { m_enum_type = enum_type; }
+
+ TypeFormatImpl::Type GetType() override {
+ return TypeFormatImpl::Type::eTypeEnum;
+ }
+
+ bool FormatObject(ValueObject *valobj, std::string &dest) const override;
+
+ std::string GetDescription() override;
+
+protected:
+ ConstString m_enum_type;
+ mutable std::unordered_map<void *, CompilerType> m_types;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(TypeFormatImpl_EnumType);
+};
+} // namespace lldb_private
+
+#endif // lldb_TypeFormat_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/TypeSummary.h b/linux-x64/clang/include/lldb/DataFormatters/TypeSummary.h
new file mode 100644
index 0000000..9c97b36
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/TypeSummary.h
@@ -0,0 +1,394 @@
+//===-- TypeSummary.h -------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_TypeSummary_h_
+#define lldb_TypeSummary_h_
+
+#include <stdint.h>
+
+#include <functional>
+#include <memory>
+#include <string>
+
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-public.h"
+
+#include "lldb/Core/FormatEntity.h"
+#include "lldb/Utility/Status.h"
+#include "lldb/Utility/StructuredData.h"
+
+namespace lldb_private {
+class TypeSummaryOptions {
+public:
+ TypeSummaryOptions();
+
+ ~TypeSummaryOptions() = default;
+
+ lldb::LanguageType GetLanguage() const;
+
+ lldb::TypeSummaryCapping GetCapping() const;
+
+ TypeSummaryOptions &SetLanguage(lldb::LanguageType);
+
+ TypeSummaryOptions &SetCapping(lldb::TypeSummaryCapping);
+
+private:
+ lldb::LanguageType m_lang;
+ lldb::TypeSummaryCapping m_capping;
+};
+
+class TypeSummaryImpl {
+public:
+ enum class Kind { eSummaryString, eScript, eCallback, eInternal };
+
+ virtual ~TypeSummaryImpl() = default;
+
+ Kind GetKind() const { return m_kind; }
+
+ class Flags {
+ public:
+ Flags() : m_flags(lldb::eTypeOptionCascade) {}
+
+ Flags(const Flags &other) : m_flags(other.m_flags) {}
+
+ Flags(uint32_t value) : m_flags(value) {}
+
+ Flags &operator=(const Flags &rhs) {
+ if (&rhs != this)
+ m_flags = rhs.m_flags;
+
+ return *this;
+ }
+
+ Flags &operator=(const uint32_t &rhs) {
+ m_flags = rhs;
+ return *this;
+ }
+
+ Flags &Clear() {
+ m_flags = 0;
+ return *this;
+ }
+
+ bool GetCascades() const {
+ return (m_flags & lldb::eTypeOptionCascade) == lldb::eTypeOptionCascade;
+ }
+
+ Flags &SetCascades(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionCascade;
+ else
+ m_flags &= ~lldb::eTypeOptionCascade;
+ return *this;
+ }
+
+ bool GetSkipPointers() const {
+ return (m_flags & lldb::eTypeOptionSkipPointers) ==
+ lldb::eTypeOptionSkipPointers;
+ }
+
+ Flags &SetSkipPointers(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionSkipPointers;
+ else
+ m_flags &= ~lldb::eTypeOptionSkipPointers;
+ return *this;
+ }
+
+ bool GetSkipReferences() const {
+ return (m_flags & lldb::eTypeOptionSkipReferences) ==
+ lldb::eTypeOptionSkipReferences;
+ }
+
+ Flags &SetSkipReferences(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionSkipReferences;
+ else
+ m_flags &= ~lldb::eTypeOptionSkipReferences;
+ return *this;
+ }
+
+ bool GetDontShowChildren() const {
+ return (m_flags & lldb::eTypeOptionHideChildren) ==
+ lldb::eTypeOptionHideChildren;
+ }
+
+ Flags &SetDontShowChildren(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionHideChildren;
+ else
+ m_flags &= ~lldb::eTypeOptionHideChildren;
+ return *this;
+ }
+
+ bool GetHideEmptyAggregates() const {
+ return (m_flags & lldb::eTypeOptionHideEmptyAggregates) ==
+ lldb::eTypeOptionHideEmptyAggregates;
+ }
+
+ Flags &SetHideEmptyAggregates(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionHideEmptyAggregates;
+ else
+ m_flags &= ~lldb::eTypeOptionHideEmptyAggregates;
+ return *this;
+ }
+
+ bool GetDontShowValue() const {
+ return (m_flags & lldb::eTypeOptionHideValue) ==
+ lldb::eTypeOptionHideValue;
+ }
+
+ Flags &SetDontShowValue(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionHideValue;
+ else
+ m_flags &= ~lldb::eTypeOptionHideValue;
+ return *this;
+ }
+
+ bool GetShowMembersOneLiner() const {
+ return (m_flags & lldb::eTypeOptionShowOneLiner) ==
+ lldb::eTypeOptionShowOneLiner;
+ }
+
+ Flags &SetShowMembersOneLiner(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionShowOneLiner;
+ else
+ m_flags &= ~lldb::eTypeOptionShowOneLiner;
+ return *this;
+ }
+
+ bool GetHideItemNames() const {
+ return (m_flags & lldb::eTypeOptionHideNames) ==
+ lldb::eTypeOptionHideNames;
+ }
+
+ Flags &SetHideItemNames(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionHideNames;
+ else
+ m_flags &= ~lldb::eTypeOptionHideNames;
+ return *this;
+ }
+
+ bool GetNonCacheable() const {
+ return (m_flags & lldb::eTypeOptionNonCacheable) ==
+ lldb::eTypeOptionNonCacheable;
+ }
+
+ Flags &SetNonCacheable(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionNonCacheable;
+ else
+ m_flags &= ~lldb::eTypeOptionNonCacheable;
+ return *this;
+ }
+
+ uint32_t GetValue() { return m_flags; }
+
+ void SetValue(uint32_t value) { m_flags = value; }
+
+ private:
+ uint32_t m_flags;
+ };
+
+ bool Cascades() const { return m_flags.GetCascades(); }
+
+ bool SkipsPointers() const { return m_flags.GetSkipPointers(); }
+
+ bool SkipsReferences() const { return m_flags.GetSkipReferences(); }
+
+ bool NonCacheable() const { return m_flags.GetNonCacheable(); }
+
+ virtual bool DoesPrintChildren(ValueObject *valobj) const {
+ return !m_flags.GetDontShowChildren();
+ }
+
+ virtual bool DoesPrintEmptyAggregates() const {
+ return !m_flags.GetHideEmptyAggregates();
+ }
+
+ virtual bool DoesPrintValue(ValueObject *valobj) const {
+ return !m_flags.GetDontShowValue();
+ }
+
+ bool IsOneLiner() const { return m_flags.GetShowMembersOneLiner(); }
+
+ virtual bool HideNames(ValueObject *valobj) const {
+ return m_flags.GetHideItemNames();
+ }
+
+ void SetCascades(bool value) { m_flags.SetCascades(value); }
+
+ void SetSkipsPointers(bool value) { m_flags.SetSkipPointers(value); }
+
+ void SetSkipsReferences(bool value) { m_flags.SetSkipReferences(value); }
+
+ virtual void SetDoesPrintChildren(bool value) {
+ m_flags.SetDontShowChildren(!value);
+ }
+
+ virtual void SetDoesPrintValue(bool value) {
+ m_flags.SetDontShowValue(!value);
+ }
+
+ void SetIsOneLiner(bool value) { m_flags.SetShowMembersOneLiner(value); }
+
+ virtual void SetHideNames(bool value) { m_flags.SetHideItemNames(value); }
+
+ virtual void SetNonCacheable(bool value) { m_flags.SetNonCacheable(value); }
+
+ uint32_t GetOptions() { return m_flags.GetValue(); }
+
+ void SetOptions(uint32_t value) { m_flags.SetValue(value); }
+
+ // we are using a ValueObject* instead of a ValueObjectSP because we do not
+ // need to hold on to this for extended periods of time and we trust the
+ // ValueObject to stay around for as long as it is required for us to
+ // generate its summary
+ virtual bool FormatObject(ValueObject *valobj, std::string &dest,
+ const TypeSummaryOptions &options) = 0;
+
+ virtual std::string GetDescription() = 0;
+
+ uint32_t &GetRevision() { return m_my_revision; }
+
+ typedef std::shared_ptr<TypeSummaryImpl> SharedPointer;
+
+protected:
+ uint32_t m_my_revision;
+ Flags m_flags;
+
+ TypeSummaryImpl(Kind kind, const TypeSummaryImpl::Flags &flags);
+
+private:
+ Kind m_kind;
+ DISALLOW_COPY_AND_ASSIGN(TypeSummaryImpl);
+};
+
+// simple string-based summaries, using ${var to show data
+struct StringSummaryFormat : public TypeSummaryImpl {
+ std::string m_format_str;
+ FormatEntity::Entry m_format;
+ Status m_error;
+
+ StringSummaryFormat(const TypeSummaryImpl::Flags &flags, const char *f);
+
+ ~StringSummaryFormat() override = default;
+
+ const char *GetSummaryString() const { return m_format_str.c_str(); }
+
+ void SetSummaryString(const char *f);
+
+ bool FormatObject(ValueObject *valobj, std::string &dest,
+ const TypeSummaryOptions &options) override;
+
+ std::string GetDescription() override;
+
+ static bool classof(const TypeSummaryImpl *S) {
+ return S->GetKind() == Kind::eSummaryString;
+ }
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(StringSummaryFormat);
+};
+
+// summaries implemented via a C++ function
+struct CXXFunctionSummaryFormat : public TypeSummaryImpl {
+ // we should convert these to SBValue and SBStream if we ever cross the
+ // boundary towards the external world
+ typedef std::function<bool(ValueObject &, Stream &,
+ const TypeSummaryOptions &)>
+ Callback;
+
+ Callback m_impl;
+ std::string m_description;
+
+ CXXFunctionSummaryFormat(const TypeSummaryImpl::Flags &flags, Callback impl,
+ const char *description);
+
+ ~CXXFunctionSummaryFormat() override = default;
+
+ Callback GetBackendFunction() const { return m_impl; }
+
+ const char *GetTextualInfo() const { return m_description.c_str(); }
+
+ void SetBackendFunction(Callback cb_func) { m_impl = cb_func; }
+
+ void SetTextualInfo(const char *descr) {
+ if (descr)
+ m_description.assign(descr);
+ else
+ m_description.clear();
+ }
+
+ bool FormatObject(ValueObject *valobj, std::string &dest,
+ const TypeSummaryOptions &options) override;
+
+ std::string GetDescription() override;
+
+ static bool classof(const TypeSummaryImpl *S) {
+ return S->GetKind() == Kind::eCallback;
+ }
+
+ typedef std::shared_ptr<CXXFunctionSummaryFormat> SharedPointer;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(CXXFunctionSummaryFormat);
+};
+
+// Python-based summaries, running script code to show data
+struct ScriptSummaryFormat : public TypeSummaryImpl {
+ std::string m_function_name;
+ std::string m_python_script;
+ StructuredData::ObjectSP m_script_function_sp;
+
+ ScriptSummaryFormat(const TypeSummaryImpl::Flags &flags,
+ const char *function_name,
+ const char *python_script = nullptr);
+
+ ~ScriptSummaryFormat() override = default;
+
+ const char *GetFunctionName() const { return m_function_name.c_str(); }
+
+ const char *GetPythonScript() const { return m_python_script.c_str(); }
+
+ void SetFunctionName(const char *function_name) {
+ if (function_name)
+ m_function_name.assign(function_name);
+ else
+ m_function_name.clear();
+ m_python_script.clear();
+ }
+
+ void SetPythonScript(const char *script) {
+ if (script)
+ m_python_script.assign(script);
+ else
+ m_python_script.clear();
+ }
+
+ bool FormatObject(ValueObject *valobj, std::string &dest,
+ const TypeSummaryOptions &options) override;
+
+ std::string GetDescription() override;
+
+ static bool classof(const TypeSummaryImpl *S) {
+ return S->GetKind() == Kind::eScript;
+ }
+
+ typedef std::shared_ptr<ScriptSummaryFormat> SharedPointer;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(ScriptSummaryFormat);
+};
+} // namespace lldb_private
+
+#endif // lldb_TypeSummary_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/TypeSynthetic.h b/linux-x64/clang/include/lldb/DataFormatters/TypeSynthetic.h
new file mode 100644
index 0000000..93443cf
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/TypeSynthetic.h
@@ -0,0 +1,455 @@
+//===-- TypeSynthetic.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_TypeSynthetic_h_
+#define lldb_TypeSynthetic_h_
+
+#include <stdint.h>
+
+#include <functional>
+#include <initializer_list>
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-public.h"
+
+#include "lldb/Core/ValueObject.h"
+#include "lldb/Utility/StructuredData.h"
+
+namespace lldb_private {
+class SyntheticChildrenFrontEnd {
+protected:
+ ValueObject &m_backend;
+
+ void SetValid(bool valid) { m_valid = valid; }
+
+ bool IsValid() { return m_valid; }
+
+public:
+ SyntheticChildrenFrontEnd(ValueObject &backend)
+ : m_backend(backend), m_valid(true) {}
+
+ virtual ~SyntheticChildrenFrontEnd() = default;
+
+ virtual size_t CalculateNumChildren() = 0;
+
+ virtual size_t CalculateNumChildren(uint32_t max) {
+ auto count = CalculateNumChildren();
+ return count <= max ? count : max;
+ }
+
+ virtual lldb::ValueObjectSP GetChildAtIndex(size_t idx) = 0;
+
+ virtual size_t GetIndexOfChildWithName(ConstString name) = 0;
+
+ // this function is assumed to always succeed and it if fails, the front-end
+ // should know to deal with it in the correct way (most probably, by refusing
+ // to return any children) the return value of Update() should actually be
+ // interpreted as "ValueObjectSyntheticFilter cache is good/bad" if =true,
+ // ValueObjectSyntheticFilter is allowed to use the children it fetched
+ // previously and cached if =false, ValueObjectSyntheticFilter must throw
+ // away its cache, and query again for children
+ virtual bool Update() = 0;
+
+ // if this function returns false, then CalculateNumChildren() MUST return 0
+ // since UI frontends might validly decide not to inquire for children given
+ // a false return value from this call if it returns true, then
+ // CalculateNumChildren() can return any number >= 0 (0 being valid) it
+ // should if at all possible be more efficient than CalculateNumChildren()
+ virtual bool MightHaveChildren() = 0;
+
+ // if this function returns a non-null ValueObject, then the returned
+ // ValueObject will stand for this ValueObject whenever a "value" request is
+ // made to this ValueObject
+ virtual lldb::ValueObjectSP GetSyntheticValue() { return nullptr; }
+
+ // if this function returns a non-empty ConstString, then clients are
+ // expected to use the return as the name of the type of this ValueObject for
+ // display purposes
+ virtual ConstString GetSyntheticTypeName() { return ConstString(); }
+
+ typedef std::shared_ptr<SyntheticChildrenFrontEnd> SharedPointer;
+ typedef std::unique_ptr<SyntheticChildrenFrontEnd> AutoPointer;
+
+protected:
+ lldb::ValueObjectSP
+ CreateValueObjectFromExpression(llvm::StringRef name,
+ llvm::StringRef expression,
+ const ExecutionContext &exe_ctx);
+
+ lldb::ValueObjectSP
+ CreateValueObjectFromAddress(llvm::StringRef name, uint64_t address,
+ const ExecutionContext &exe_ctx,
+ CompilerType type);
+
+ lldb::ValueObjectSP CreateValueObjectFromData(llvm::StringRef name,
+ const DataExtractor &data,
+ const ExecutionContext &exe_ctx,
+ CompilerType type);
+
+private:
+ bool m_valid;
+ DISALLOW_COPY_AND_ASSIGN(SyntheticChildrenFrontEnd);
+};
+
+class SyntheticValueProviderFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+ SyntheticValueProviderFrontEnd(ValueObject &backend)
+ : SyntheticChildrenFrontEnd(backend) {}
+
+ ~SyntheticValueProviderFrontEnd() override = default;
+
+ size_t CalculateNumChildren() override { return 0; }
+
+ lldb::ValueObjectSP GetChildAtIndex(size_t idx) override { return nullptr; }
+
+ size_t GetIndexOfChildWithName(ConstString name) override {
+ return UINT32_MAX;
+ }
+
+ bool Update() override { return false; }
+
+ bool MightHaveChildren() override { return false; }
+
+ lldb::ValueObjectSP GetSyntheticValue() override = 0;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(SyntheticValueProviderFrontEnd);
+};
+
+class SyntheticChildren {
+public:
+ class Flags {
+ public:
+ Flags() : m_flags(lldb::eTypeOptionCascade) {}
+
+ Flags(const Flags &other) : m_flags(other.m_flags) {}
+
+ Flags(uint32_t value) : m_flags(value) {}
+
+ Flags &operator=(const Flags &rhs) {
+ if (&rhs != this)
+ m_flags = rhs.m_flags;
+
+ return *this;
+ }
+
+ Flags &operator=(const uint32_t &rhs) {
+ m_flags = rhs;
+ return *this;
+ }
+
+ Flags &Clear() {
+ m_flags = 0;
+ return *this;
+ }
+
+ bool GetCascades() const {
+ return (m_flags & lldb::eTypeOptionCascade) == lldb::eTypeOptionCascade;
+ }
+
+ Flags &SetCascades(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionCascade;
+ else
+ m_flags &= ~lldb::eTypeOptionCascade;
+ return *this;
+ }
+
+ bool GetSkipPointers() const {
+ return (m_flags & lldb::eTypeOptionSkipPointers) ==
+ lldb::eTypeOptionSkipPointers;
+ }
+
+ Flags &SetSkipPointers(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionSkipPointers;
+ else
+ m_flags &= ~lldb::eTypeOptionSkipPointers;
+ return *this;
+ }
+
+ bool GetSkipReferences() const {
+ return (m_flags & lldb::eTypeOptionSkipReferences) ==
+ lldb::eTypeOptionSkipReferences;
+ }
+
+ Flags &SetSkipReferences(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionSkipReferences;
+ else
+ m_flags &= ~lldb::eTypeOptionSkipReferences;
+ return *this;
+ }
+
+ bool GetNonCacheable() const {
+ return (m_flags & lldb::eTypeOptionNonCacheable) ==
+ lldb::eTypeOptionNonCacheable;
+ }
+
+ Flags &SetNonCacheable(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionNonCacheable;
+ else
+ m_flags &= ~lldb::eTypeOptionNonCacheable;
+ return *this;
+ }
+
+ bool GetFrontEndWantsDereference() const {
+ return (m_flags & lldb::eTypeOptionFrontEndWantsDereference) ==
+ lldb::eTypeOptionFrontEndWantsDereference;
+ }
+
+ Flags &SetFrontEndWantsDereference(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionFrontEndWantsDereference;
+ else
+ m_flags &= ~lldb::eTypeOptionFrontEndWantsDereference;
+ return *this;
+ }
+
+ uint32_t GetValue() { return m_flags; }
+
+ void SetValue(uint32_t value) { m_flags = value; }
+
+ private:
+ uint32_t m_flags;
+ };
+
+ SyntheticChildren(const Flags &flags) : m_flags(flags) {}
+
+ virtual ~SyntheticChildren() = default;
+
+ bool Cascades() const { return m_flags.GetCascades(); }
+
+ bool SkipsPointers() const { return m_flags.GetSkipPointers(); }
+
+ bool SkipsReferences() const { return m_flags.GetSkipReferences(); }
+
+ bool NonCacheable() const { return m_flags.GetNonCacheable(); }
+
+ bool WantsDereference() const { return m_flags.GetFrontEndWantsDereference();}
+
+ void SetCascades(bool value) { m_flags.SetCascades(value); }
+
+ void SetSkipsPointers(bool value) { m_flags.SetSkipPointers(value); }
+
+ void SetSkipsReferences(bool value) { m_flags.SetSkipReferences(value); }
+
+ void SetNonCacheable(bool value) { m_flags.SetNonCacheable(value); }
+
+ uint32_t GetOptions() { return m_flags.GetValue(); }
+
+ void SetOptions(uint32_t value) { m_flags.SetValue(value); }
+
+ virtual bool IsScripted() = 0;
+
+ virtual std::string GetDescription() = 0;
+
+ virtual SyntheticChildrenFrontEnd::AutoPointer
+ GetFrontEnd(ValueObject &backend) = 0;
+
+ typedef std::shared_ptr<SyntheticChildren> SharedPointer;
+
+ uint32_t &GetRevision() { return m_my_revision; }
+
+protected:
+ uint32_t m_my_revision;
+ Flags m_flags;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(SyntheticChildren);
+};
+
+class TypeFilterImpl : public SyntheticChildren {
+ std::vector<std::string> m_expression_paths;
+
+public:
+ TypeFilterImpl(const SyntheticChildren::Flags &flags)
+ : SyntheticChildren(flags), m_expression_paths() {}
+
+ TypeFilterImpl(const SyntheticChildren::Flags &flags,
+ const std::initializer_list<const char *> items)
+ : SyntheticChildren(flags), m_expression_paths() {
+ for (auto path : items)
+ AddExpressionPath(path);
+ }
+
+ void AddExpressionPath(const char *path) {
+ AddExpressionPath(std::string(path));
+ }
+
+ void Clear() { m_expression_paths.clear(); }
+
+ size_t GetCount() const { return m_expression_paths.size(); }
+
+ const char *GetExpressionPathAtIndex(size_t i) const {
+ return m_expression_paths[i].c_str();
+ }
+
+ bool SetExpressionPathAtIndex(size_t i, const char *path) {
+ return SetExpressionPathAtIndex(i, std::string(path));
+ }
+
+ void AddExpressionPath(const std::string &path);
+
+ bool SetExpressionPathAtIndex(size_t i, const std::string &path);
+
+ bool IsScripted() override { return false; }
+
+ std::string GetDescription() override;
+
+ class FrontEnd : public SyntheticChildrenFrontEnd {
+ public:
+ FrontEnd(TypeFilterImpl *flt, ValueObject &backend)
+ : SyntheticChildrenFrontEnd(backend), filter(flt) {}
+
+ ~FrontEnd() override = default;
+
+ size_t CalculateNumChildren() override { return filter->GetCount(); }
+
+ lldb::ValueObjectSP GetChildAtIndex(size_t idx) override {
+ if (idx >= filter->GetCount())
+ return lldb::ValueObjectSP();
+ return m_backend.GetSyntheticExpressionPathChild(
+ filter->GetExpressionPathAtIndex(idx), true);
+ }
+
+ bool Update() override { return false; }
+
+ bool MightHaveChildren() override { return filter->GetCount() > 0; }
+
+ size_t GetIndexOfChildWithName(ConstString name) override;
+
+ typedef std::shared_ptr<SyntheticChildrenFrontEnd> SharedPointer;
+
+ private:
+ TypeFilterImpl *filter;
+
+ DISALLOW_COPY_AND_ASSIGN(FrontEnd);
+ };
+
+ SyntheticChildrenFrontEnd::AutoPointer
+ GetFrontEnd(ValueObject &backend) override {
+ return SyntheticChildrenFrontEnd::AutoPointer(new FrontEnd(this, backend));
+ }
+
+ typedef std::shared_ptr<TypeFilterImpl> SharedPointer;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(TypeFilterImpl);
+};
+
+class CXXSyntheticChildren : public SyntheticChildren {
+public:
+ typedef std::function<SyntheticChildrenFrontEnd *(CXXSyntheticChildren *,
+ lldb::ValueObjectSP)>
+ CreateFrontEndCallback;
+ CXXSyntheticChildren(const SyntheticChildren::Flags &flags,
+ const char *description, CreateFrontEndCallback callback)
+ : SyntheticChildren(flags), m_create_callback(callback),
+ m_description(description ? description : "") {}
+
+ bool IsScripted() override { return false; }
+
+ std::string GetDescription() override;
+
+ SyntheticChildrenFrontEnd::AutoPointer
+ GetFrontEnd(ValueObject &backend) override {
+ return SyntheticChildrenFrontEnd::AutoPointer(
+ m_create_callback(this, backend.GetSP()));
+ }
+
+protected:
+ CreateFrontEndCallback m_create_callback;
+ std::string m_description;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(CXXSyntheticChildren);
+};
+
+class ScriptedSyntheticChildren : public SyntheticChildren {
+ std::string m_python_class;
+ std::string m_python_code;
+
+public:
+ ScriptedSyntheticChildren(const SyntheticChildren::Flags &flags,
+ const char *pclass, const char *pcode = nullptr)
+ : SyntheticChildren(flags), m_python_class(), m_python_code() {
+ if (pclass)
+ m_python_class = pclass;
+ if (pcode)
+ m_python_code = pcode;
+ }
+
+ const char *GetPythonClassName() { return m_python_class.c_str(); }
+
+ const char *GetPythonCode() { return m_python_code.c_str(); }
+
+ void SetPythonClassName(const char *fname) {
+ m_python_class.assign(fname);
+ m_python_code.clear();
+ }
+
+ void SetPythonCode(const char *script) { m_python_code.assign(script); }
+
+ std::string GetDescription() override;
+
+ bool IsScripted() override { return true; }
+
+ class FrontEnd : public SyntheticChildrenFrontEnd {
+ public:
+ FrontEnd(std::string pclass, ValueObject &backend);
+
+ ~FrontEnd() override;
+
+ bool IsValid();
+
+ size_t CalculateNumChildren() override;
+
+ size_t CalculateNumChildren(uint32_t max) override;
+
+ lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+ bool Update() override;
+
+ bool MightHaveChildren() override;
+
+ size_t GetIndexOfChildWithName(ConstString name) override;
+
+ lldb::ValueObjectSP GetSyntheticValue() override;
+
+ ConstString GetSyntheticTypeName() override;
+
+ typedef std::shared_ptr<SyntheticChildrenFrontEnd> SharedPointer;
+
+ private:
+ std::string m_python_class;
+ StructuredData::ObjectSP m_wrapper_sp;
+ ScriptInterpreter *m_interpreter;
+
+ DISALLOW_COPY_AND_ASSIGN(FrontEnd);
+ };
+
+ SyntheticChildrenFrontEnd::AutoPointer
+ GetFrontEnd(ValueObject &backend) override {
+ auto synth_ptr = SyntheticChildrenFrontEnd::AutoPointer(
+ new FrontEnd(m_python_class, backend));
+ if (synth_ptr && ((FrontEnd *)synth_ptr.get())->IsValid())
+ return synth_ptr;
+ return nullptr;
+ }
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(ScriptedSyntheticChildren);
+};
+} // namespace lldb_private
+
+#endif // lldb_TypeSynthetic_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/TypeValidator.h b/linux-x64/clang/include/lldb/DataFormatters/TypeValidator.h
new file mode 100644
index 0000000..531812e
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/TypeValidator.h
@@ -0,0 +1,201 @@
+//===-- TypeValidator.h ------------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_TypeValidator_h_
+#define lldb_TypeValidator_h_
+
+
+#include <functional>
+#include <string>
+
+
+#include "lldb/lldb-enumerations.h"
+#include "lldb/lldb-private-enumerations.h"
+#include "lldb/lldb-public.h"
+
+namespace lldb_private {
+
+class TypeValidatorImpl {
+public:
+ class Flags {
+ public:
+ Flags() : m_flags(lldb::eTypeOptionCascade) {}
+
+ Flags(const Flags &other) : m_flags(other.m_flags) {}
+
+ Flags(uint32_t value) : m_flags(value) {}
+
+ Flags &operator=(const Flags &rhs) {
+ if (&rhs != this)
+ m_flags = rhs.m_flags;
+
+ return *this;
+ }
+
+ Flags &operator=(const uint32_t &rhs) {
+ m_flags = rhs;
+ return *this;
+ }
+
+ Flags &Clear() {
+ m_flags = 0;
+ return *this;
+ }
+
+ bool GetCascades() const {
+ return (m_flags & lldb::eTypeOptionCascade) == lldb::eTypeOptionCascade;
+ }
+
+ Flags &SetCascades(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionCascade;
+ else
+ m_flags &= ~lldb::eTypeOptionCascade;
+ return *this;
+ }
+
+ bool GetSkipPointers() const {
+ return (m_flags & lldb::eTypeOptionSkipPointers) ==
+ lldb::eTypeOptionSkipPointers;
+ }
+
+ Flags &SetSkipPointers(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionSkipPointers;
+ else
+ m_flags &= ~lldb::eTypeOptionSkipPointers;
+ return *this;
+ }
+
+ bool GetSkipReferences() const {
+ return (m_flags & lldb::eTypeOptionSkipReferences) ==
+ lldb::eTypeOptionSkipReferences;
+ }
+
+ Flags &SetSkipReferences(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionSkipReferences;
+ else
+ m_flags &= ~lldb::eTypeOptionSkipReferences;
+ return *this;
+ }
+
+ bool GetNonCacheable() const {
+ return (m_flags & lldb::eTypeOptionNonCacheable) ==
+ lldb::eTypeOptionNonCacheable;
+ }
+
+ Flags &SetNonCacheable(bool value = true) {
+ if (value)
+ m_flags |= lldb::eTypeOptionNonCacheable;
+ else
+ m_flags &= ~lldb::eTypeOptionNonCacheable;
+ return *this;
+ }
+
+ uint32_t GetValue() { return m_flags; }
+
+ void SetValue(uint32_t value) { m_flags = value; }
+
+ private:
+ uint32_t m_flags;
+ };
+
+ TypeValidatorImpl(const Flags &flags = Flags());
+
+ typedef std::shared_ptr<TypeValidatorImpl> SharedPointer;
+
+ virtual ~TypeValidatorImpl();
+
+ bool Cascades() const { return m_flags.GetCascades(); }
+ bool SkipsPointers() const { return m_flags.GetSkipPointers(); }
+ bool SkipsReferences() const { return m_flags.GetSkipReferences(); }
+ bool NonCacheable() const { return m_flags.GetNonCacheable(); }
+
+ void SetCascades(bool value) { m_flags.SetCascades(value); }
+
+ void SetSkipsPointers(bool value) { m_flags.SetSkipPointers(value); }
+
+ void SetSkipsReferences(bool value) { m_flags.SetSkipReferences(value); }
+
+ void SetNonCacheable(bool value) { m_flags.SetNonCacheable(value); }
+
+ uint32_t GetOptions() { return m_flags.GetValue(); }
+
+ void SetOptions(uint32_t value) { m_flags.SetValue(value); }
+
+ uint32_t &GetRevision() { return m_my_revision; }
+
+ enum class Type { eTypeUnknown, eTypeCXX };
+
+ struct ValidationResult {
+ TypeValidatorResult m_result;
+ std::string m_message;
+ };
+
+ virtual Type GetType() { return Type::eTypeUnknown; }
+
+ // we are using a ValueObject* instead of a ValueObjectSP because we do not
+ // need to hold on to this for extended periods of time and we trust the
+ // ValueObject to stay around for as long as it is required for us to
+ // generate its value
+ virtual ValidationResult FormatObject(ValueObject *valobj) const = 0;
+
+ virtual std::string GetDescription() = 0;
+
+ static ValidationResult Success();
+
+ static ValidationResult Failure(std::string message);
+
+protected:
+ Flags m_flags;
+ uint32_t m_my_revision;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(TypeValidatorImpl);
+};
+
+class TypeValidatorImpl_CXX : public TypeValidatorImpl {
+public:
+ typedef std::function<TypeValidatorImpl::ValidationResult(
+ ValueObject *valobj)>
+ ValidatorFunction;
+
+ TypeValidatorImpl_CXX(ValidatorFunction f, std::string d,
+ const TypeValidatorImpl::Flags &flags = Flags());
+
+ typedef std::shared_ptr<TypeValidatorImpl_CXX> SharedPointer;
+
+ ~TypeValidatorImpl_CXX() override;
+
+ ValidatorFunction GetValidatorFunction() const {
+ return m_validator_function;
+ }
+
+ void SetValidatorFunction(ValidatorFunction f) { m_validator_function = f; }
+
+ TypeValidatorImpl::Type GetType() override {
+ return TypeValidatorImpl::Type::eTypeCXX;
+ }
+
+ ValidationResult FormatObject(ValueObject *valobj) const override;
+
+ std::string GetDescription() override;
+
+protected:
+ std::string m_description;
+ ValidatorFunction m_validator_function;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(TypeValidatorImpl_CXX);
+};
+
+} // namespace lldb_private
+
+#endif // lldb_TypeValidator_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/ValueObjectPrinter.h b/linux-x64/clang/include/lldb/DataFormatters/ValueObjectPrinter.h
new file mode 100644
index 0000000..41adc2d
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/ValueObjectPrinter.h
@@ -0,0 +1,157 @@
+//===-- ValueObjectPrinter.h ---------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_ValueObjectPrinter_h_
+#define lldb_ValueObjectPrinter_h_
+
+
+#include "lldb/lldb-private.h"
+#include "lldb/lldb-public.h"
+
+#include "lldb/Utility/Flags.h"
+
+#include "lldb/DataFormatters/DumpValueObjectOptions.h"
+#include "lldb/Symbol/CompilerType.h"
+
+namespace lldb_private {
+
+class ValueObjectPrinter {
+public:
+ ValueObjectPrinter(ValueObject *valobj, Stream *s);
+
+ ValueObjectPrinter(ValueObject *valobj, Stream *s,
+ const DumpValueObjectOptions &options);
+
+ ~ValueObjectPrinter() {}
+
+ bool PrintValueObject();
+
+protected:
+ typedef std::set<uint64_t> InstancePointersSet;
+ typedef std::shared_ptr<InstancePointersSet> InstancePointersSetSP;
+
+ InstancePointersSetSP m_printed_instance_pointers;
+
+ // only this class (and subclasses, if any) should ever be concerned with the
+ // depth mechanism
+ ValueObjectPrinter(ValueObject *valobj, Stream *s,
+ const DumpValueObjectOptions &options,
+ const DumpValueObjectOptions::PointerDepth &ptr_depth,
+ uint32_t curr_depth,
+ InstancePointersSetSP printed_instance_pointers);
+
+ // we should actually be using delegating constructors here but some versions
+ // of GCC still have trouble with those
+ void Init(ValueObject *valobj, Stream *s,
+ const DumpValueObjectOptions &options,
+ const DumpValueObjectOptions::PointerDepth &ptr_depth,
+ uint32_t curr_depth,
+ InstancePointersSetSP printed_instance_pointers);
+
+ bool GetMostSpecializedValue();
+
+ const char *GetDescriptionForDisplay();
+
+ const char *GetRootNameForDisplay(const char *if_fail = nullptr);
+
+ bool ShouldPrintValueObject();
+
+ bool ShouldPrintValidation();
+
+ bool IsNil();
+
+ bool IsUninitialized();
+
+ bool IsPtr();
+
+ bool IsRef();
+
+ bool IsInstancePointer();
+
+ bool IsAggregate();
+
+ bool PrintValidationMarkerIfNeeded();
+
+ bool PrintValidationErrorIfNeeded();
+
+ bool PrintLocationIfNeeded();
+
+ void PrintDecl();
+
+ bool CheckScopeIfNeeded();
+
+ bool ShouldPrintEmptyBrackets(bool value_printed, bool summary_printed);
+
+ TypeSummaryImpl *GetSummaryFormatter(bool null_if_omitted = true);
+
+ void GetValueSummaryError(std::string &value, std::string &summary,
+ std::string &error);
+
+ bool PrintValueAndSummaryIfNeeded(bool &value_printed, bool &summary_printed);
+
+ bool PrintObjectDescriptionIfNeeded(bool value_printed, bool summary_printed);
+
+ bool
+ ShouldPrintChildren(bool is_failed_description,
+ DumpValueObjectOptions::PointerDepth &curr_ptr_depth);
+
+ bool ShouldExpandEmptyAggregates();
+
+ ValueObject *GetValueObjectForChildrenGeneration();
+
+ void PrintChildrenPreamble();
+
+ void PrintChildrenPostamble(bool print_dotdotdot);
+
+ lldb::ValueObjectSP GenerateChild(ValueObject *synth_valobj, size_t idx);
+
+ void PrintChild(lldb::ValueObjectSP child_sp,
+ const DumpValueObjectOptions::PointerDepth &curr_ptr_depth);
+
+ uint32_t GetMaxNumChildrenToPrint(bool &print_dotdotdot);
+
+ void
+ PrintChildren(bool value_printed, bool summary_printed,
+ const DumpValueObjectOptions::PointerDepth &curr_ptr_depth);
+
+ void PrintChildrenIfNeeded(bool value_printed, bool summary_printed);
+
+ bool PrintChildrenOneLiner(bool hide_names);
+
+private:
+ ValueObject *m_orig_valobj;
+ ValueObject *m_valobj;
+ Stream *m_stream;
+ DumpValueObjectOptions m_options;
+ Flags m_type_flags;
+ CompilerType m_compiler_type;
+ DumpValueObjectOptions::PointerDepth m_ptr_depth;
+ uint32_t m_curr_depth;
+ LazyBool m_should_print;
+ LazyBool m_is_nil;
+ LazyBool m_is_uninit;
+ LazyBool m_is_ptr;
+ LazyBool m_is_ref;
+ LazyBool m_is_aggregate;
+ LazyBool m_is_instance_ptr;
+ std::pair<TypeSummaryImpl *, bool> m_summary_formatter;
+ std::string m_value;
+ std::string m_summary;
+ std::string m_error;
+ bool m_val_summary_ok;
+ std::pair<TypeValidatorResult, std::string> m_validation;
+
+ friend struct StringSummaryFormat;
+
+ DISALLOW_COPY_AND_ASSIGN(ValueObjectPrinter);
+};
+
+} // namespace lldb_private
+
+#endif // lldb_ValueObjectPrinter_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/VectorIterator.h b/linux-x64/clang/include/lldb/DataFormatters/VectorIterator.h
new file mode 100644
index 0000000..cde4be4
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/VectorIterator.h
@@ -0,0 +1,45 @@
+//===-- VectorIterator.h ----------------------------------------------*- C++
+//-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_VectorIterator_h_
+#define liblldb_VectorIterator_h_
+
+#include "lldb/lldb-forward.h"
+
+#include "lldb/DataFormatters/TypeSynthetic.h"
+#include "lldb/Target/ExecutionContext.h"
+#include "lldb/Utility/ConstString.h"
+
+namespace lldb_private {
+namespace formatters {
+class VectorIteratorSyntheticFrontEnd : public SyntheticChildrenFrontEnd {
+public:
+ VectorIteratorSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp,
+ ConstString item_name);
+
+ size_t CalculateNumChildren() override;
+
+ lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
+
+ bool Update() override;
+
+ bool MightHaveChildren() override;
+
+ size_t GetIndexOfChildWithName(ConstString name) override;
+
+private:
+ ExecutionContextRef m_exe_ctx_ref;
+ ConstString m_item_name;
+ lldb::ValueObjectSP m_item_sp;
+};
+
+} // namespace formatters
+} // namespace lldb_private
+
+#endif // liblldb_CF_h_
diff --git a/linux-x64/clang/include/lldb/DataFormatters/VectorType.h b/linux-x64/clang/include/lldb/DataFormatters/VectorType.h
new file mode 100644
index 0000000..b757f75
--- /dev/null
+++ b/linux-x64/clang/include/lldb/DataFormatters/VectorType.h
@@ -0,0 +1,24 @@
+//===-- VectorType.h ------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_VectorType_h_
+#define liblldb_VectorType_h_
+
+#include "lldb/lldb-forward.h"
+
+namespace lldb_private {
+namespace formatters {
+bool VectorTypeSummaryProvider(ValueObject &, Stream &,
+ const TypeSummaryOptions &);
+
+SyntheticChildrenFrontEnd *
+VectorTypeSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP);
+} // namespace formatters
+} // namespace lldb_private
+
+#endif // liblldb_VectorType_h_