Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / source / Plugins / Language / ObjC / NSDictionary.h
blob57dacd6759d29aef25027a85c2f29b20803f4708
1 //===-- NSDictionary.h ------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_SOURCE_PLUGINS_LANGUAGE_OBJC_NSDICTIONARY_H
10 #define LLDB_SOURCE_PLUGINS_LANGUAGE_OBJC_NSDICTIONARY_H
12 #include "lldb/Core/ValueObject.h"
13 #include "lldb/DataFormatters/TypeSummary.h"
14 #include "lldb/DataFormatters/TypeSynthetic.h"
15 #include "lldb/Utility/ConstString.h"
16 #include "lldb/Utility/Stream.h"
18 #include <map>
19 #include <memory>
21 namespace lldb_private {
22 namespace formatters {
23 template <bool name_entries>
24 bool NSDictionarySummaryProvider(ValueObject &valobj, Stream &stream,
25 const TypeSummaryOptions &options);
27 extern template bool
28 NSDictionarySummaryProvider<true>(ValueObject &, Stream &,
29 const TypeSummaryOptions &);
31 extern template bool
32 NSDictionarySummaryProvider<false>(ValueObject &, Stream &,
33 const TypeSummaryOptions &);
35 SyntheticChildrenFrontEnd *
36 NSDictionarySyntheticFrontEndCreator(CXXSyntheticChildren *,
37 lldb::ValueObjectSP);
39 class NSDictionary_Additionals {
40 public:
41 class AdditionalFormatterMatching {
42 public:
43 class Matcher {
44 public:
45 virtual ~Matcher() = default;
46 virtual bool Match(ConstString class_name) = 0;
48 typedef std::unique_ptr<Matcher> UP;
50 class Prefix : public Matcher {
51 public:
52 Prefix(ConstString p);
53 ~Prefix() override = default;
54 bool Match(ConstString class_name) override;
56 private:
57 ConstString m_prefix;
59 class Full : public Matcher {
60 public:
61 Full(ConstString n);
62 ~Full() override = default;
63 bool Match(ConstString class_name) override;
65 private:
66 ConstString m_name;
68 typedef Matcher::UP MatcherUP;
70 MatcherUP GetFullMatch(ConstString n) { return std::make_unique<Full>(n); }
72 MatcherUP GetPrefixMatch(ConstString p) {
73 return std::make_unique<Prefix>(p);
77 template <typename FormatterType>
78 using AdditionalFormatter =
79 std::pair<AdditionalFormatterMatching::MatcherUP, FormatterType>;
81 template <typename FormatterType>
82 using AdditionalFormatters = std::vector<AdditionalFormatter<FormatterType>>;
84 static AdditionalFormatters<CXXFunctionSummaryFormat::Callback> &
85 GetAdditionalSummaries();
87 static AdditionalFormatters<CXXSyntheticChildren::CreateFrontEndCallback> &
88 GetAdditionalSynthetics();
90 } // namespace formatters
91 } // namespace lldb_private
93 #endif // LLDB_SOURCE_PLUGINS_LANGUAGE_OBJC_NSDICTIONARY_H