Coverage Report

Created: 2022-01-25 06:29

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/include/lldb/DataFormatters/DumpValueObjectOptions.h
Line
Count
Source (jump to first uncovered line)
1
//===-- DumpValueObjectOptions.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
//===----------------------------------------------------------------------===//
8
9
#ifndef LLDB_DATAFORMATTERS_DUMPVALUEOBJECTOPTIONS_H
10
#define LLDB_DATAFORMATTERS_DUMPVALUEOBJECTOPTIONS_H
11
12
#include <string>
13
14
#include "lldb/lldb-private.h"
15
#include "lldb/lldb-public.h"
16
17
#include <functional>
18
#include <string>
19
20
namespace lldb_private {
21
22
class DumpValueObjectOptions {
23
public:
24
  struct PointerDepth {
25
    enum class Mode { Always, Default, Never } m_mode;
26
    uint32_t m_count;
27
28
5.10k
    PointerDepth operator--() const {
29
5.10k
      if (m_count > 0)
30
924
        return PointerDepth{m_mode, m_count - 1};
31
4.17k
      return PointerDepth{m_mode, m_count};
32
5.10k
    }
33
34
    bool CanAllowExpansion() const;
35
  };
36
37
  struct PointerAsArraySettings {
38
    size_t m_element_count = 0;
39
    size_t m_base_element = 0;
40
    size_t m_stride = 0;
41
42
89.4k
    PointerAsArraySettings() = default;
43
44
    PointerAsArraySettings(size_t elem_count, size_t base_elem = 0,
45
                           size_t stride = 1)
46
        : m_element_count(elem_count), m_base_element(base_elem),
47
27.7k
          m_stride(stride) {}
48
49
238k
    operator bool() { return m_element_count > 0; }
50
  };
51
52
  typedef std::function<bool(ConstString, ConstString,
53
                             const DumpValueObjectOptions &, Stream &)>
54
      DeclPrintingHelper;
55
56
0
  static const DumpValueObjectOptions DefaultOptions() {
57
0
    static DumpValueObjectOptions g_default_options;
58
0
59
0
    return g_default_options;
60
0
  }
61
62
  DumpValueObjectOptions();
63
64
  DumpValueObjectOptions(ValueObject &valobj);
65
66
  DumpValueObjectOptions &
67
  SetMaximumPointerDepth(PointerDepth depth = {PointerDepth::Mode::Never, 0});
68
69
  DumpValueObjectOptions &SetMaximumDepth(uint32_t depth = 0);
70
71
  DumpValueObjectOptions &SetDeclPrintingHelper(DeclPrintingHelper helper);
72
73
  DumpValueObjectOptions &SetShowTypes(bool show = false);
74
75
  DumpValueObjectOptions &SetShowLocation(bool show = false);
76
77
  DumpValueObjectOptions &SetUseObjectiveC(bool use = false);
78
79
  DumpValueObjectOptions &SetShowSummary(bool show = true);
80
81
  DumpValueObjectOptions &
82
  SetUseDynamicType(lldb::DynamicValueType dyn = lldb::eNoDynamicValues);
83
84
  DumpValueObjectOptions &SetUseSyntheticValue(bool use_synthetic = true);
85
86
  DumpValueObjectOptions &SetScopeChecked(bool check = true);
87
88
  DumpValueObjectOptions &SetFlatOutput(bool flat = false);
89
90
  DumpValueObjectOptions &SetOmitSummaryDepth(uint32_t depth = 0);
91
92
  DumpValueObjectOptions &SetIgnoreCap(bool ignore = false);
93
94
  DumpValueObjectOptions &SetRawDisplay();
95
96
  DumpValueObjectOptions &SetFormat(lldb::Format format = lldb::eFormatDefault);
97
98
  DumpValueObjectOptions &
99
  SetSummary(lldb::TypeSummaryImplSP summary = lldb::TypeSummaryImplSP());
100
101
  DumpValueObjectOptions &SetRootValueObjectName(const char *name = nullptr);
102
103
  DumpValueObjectOptions &SetHideRootType(bool hide_root_type = false);
104
105
  DumpValueObjectOptions &SetHideName(bool hide_name = false);
106
107
  DumpValueObjectOptions &SetHideValue(bool hide_value = false);
108
109
  DumpValueObjectOptions &SetHidePointerValue(bool hide = false);
110
111
  DumpValueObjectOptions &SetVariableFormatDisplayLanguage(
112
      lldb::LanguageType lang = lldb::eLanguageTypeUnknown);
113
114
  DumpValueObjectOptions &SetRunValidator(bool run = true);
115
116
  DumpValueObjectOptions &SetUseTypeDisplayName(bool dis = false);
117
118
  DumpValueObjectOptions &SetAllowOnelinerMode(bool oneliner = false);
119
120
  DumpValueObjectOptions &SetRevealEmptyAggregates(bool reveal = true);
121
122
  DumpValueObjectOptions &SetElementCount(uint32_t element_count = 0);
123
124
  DumpValueObjectOptions &
125
  SetPointerAsArray(const PointerAsArraySettings &ptr_array);
126
127
  uint32_t m_max_depth = UINT32_MAX;
128
  lldb::DynamicValueType m_use_dynamic = lldb::eNoDynamicValues;
129
  uint32_t m_omit_summary_depth = 0;
130
  lldb::Format m_format = lldb::eFormatDefault;
131
  lldb::TypeSummaryImplSP m_summary_sp;
132
  std::string m_root_valobj_name;
133
  lldb::LanguageType m_varformat_language = lldb::eLanguageTypeUnknown;
134
  PointerDepth m_max_ptr_depth;
135
  DeclPrintingHelper m_decl_printing_helper;
136
  PointerAsArraySettings m_pointer_as_array;
137
  bool m_use_synthetic : 1;
138
  bool m_scope_already_checked : 1;
139
  bool m_flat_output : 1;
140
  bool m_ignore_cap : 1;
141
  bool m_show_types : 1;
142
  bool m_show_location : 1;
143
  bool m_use_objc : 1;
144
  bool m_hide_root_type : 1;
145
  bool m_hide_name : 1;
146
  bool m_hide_value : 1;
147
  bool m_run_validator : 1;
148
  bool m_use_type_display_name : 1;
149
  bool m_allow_oneliner_mode : 1;
150
  bool m_hide_pointer_value : 1;
151
  bool m_reveal_empty_aggregates : 1;
152
};
153
154
} // namespace lldb_private
155
156
#endif // LLDB_DATAFORMATTERS_DUMPVALUEOBJECTOPTIONS_H