LLDB mainline
RegisterType.h
Go to the documentation of this file.
1//===------------------------------------------------------------*- 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_UTILITY_REGISTERTYPE_H
10#define LLDB_UTILITY_REGISTERTYPE_H
11
12#include <string>
13#include <unordered_set>
14#include <vector>
15
16namespace lldb_private {
17
18class Stream;
19class Log;
20
22public:
27
28 RegisterTypeKind getKind() const { return m_kind; }
29
30 RegisterType(RegisterTypeKind kind, std::string id)
31 : m_kind(kind), m_id(std::move(id)) {}
32
33 /// Output XML that describes this type, to be inserted into a target XML
34 /// file. Reserved characters like "<" are replaced with their XML safe
35 /// equivalents like "&gt;".
36 void ToXML(Stream &strm,
37 std::unordered_set<const RegisterType *> &previously_emitted,
38 const RegisterType *user = nullptr) const;
39
40 virtual ~RegisterType() = default;
41
42 /// Output the register type as an XML element. That is, "<foo ...>" until the
43 /// closing </foo>, including any child types in between. For example the
44 /// flags in a register flag set.
45 virtual void ToXMLElement(Stream &strm,
46 const RegisterType *user = nullptr) const = 0;
47
48 const std::string &GetID() const { return m_id; }
49
50 void SetDependencies(std::vector<const RegisterType *> dependencies) {
51 m_dependencies = dependencies;
52 }
53
54private:
56 const std::string m_id;
57 std::vector<const RegisterType *> m_dependencies;
58};
59
60} // namespace lldb_private
61
62#endif // LLDB_UTILITY_REGISTERTYPE_H
void ToXML(Stream &strm, std::unordered_set< const RegisterType * > &previously_emitted, const RegisterType *user=nullptr) const
Output XML that describes this type, to be inserted into a target XML file.
virtual ~RegisterType()=default
RegisterTypeKind getKind() const
virtual void ToXMLElement(Stream &strm, const RegisterType *user=nullptr) const =0
Output the register type as an XML element.
const std::string & GetID() const
const RegisterTypeKind m_kind
std::vector< const RegisterType * > m_dependencies
void SetDependencies(std::vector< const RegisterType * > dependencies)
const std::string m_id
RegisterType(RegisterTypeKind kind, std::string id)
A stream class that can stream formatted output to a file.
Definition Stream.h:28
A class that represents a running process on the host machine.