LLDB mainline
FormatterBytecode.h
Go to the documentation of this file.
1//===-- FormatterBytecode.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
11
12namespace lldb_private {
13
14namespace FormatterBytecode {
15
16enum DataType : uint8_t { Any, String, Int, UInt, Object, Type, Selector };
17
18enum OpCodes : uint8_t {
19#define DEFINE_OPCODE(OP, MNEMONIC, NAME) op_##NAME = OP,
20#include "FormatterBytecode.def"
21#undef DEFINE_OPCODE
22};
23
24enum Selectors : uint8_t {
25#define DEFINE_SELECTOR(ID, NAME) sel_##NAME = ID,
26#include "FormatterBytecode.def"
27#undef DEFINE_SELECTOR
28};
29
30enum Signatures : uint8_t {
31#define DEFINE_SIGNATURE(ID, NAME) sig_##NAME = ID,
32#include "FormatterBytecode.def"
33#undef DEFINE_SIGNATURE
34};
35
36using ControlStackElement = llvm::StringRef;
38 std::variant<std::string, uint64_t, int64_t, lldb::ValueObjectSP,
40struct DataStack : public std::vector<DataStackElement> {
41 DataStack() = default;
43 : std::vector<DataStackElement>({initial_value}) {}
44 void Push(DataStackElement el) { push_back(el); }
45 template <typename T> T Pop() {
46 T el = std::get<T>(back());
47 pop_back();
48 return el;
49 }
51 DataStackElement el = back();
52 pop_back();
53 return el;
54 }
55};
56llvm::Error Interpret(std::vector<ControlStackElement> &control,
57 DataStack &data, Selectors sel);
58} // namespace FormatterBytecode
59
63
64} // namespace lldb_private
Generic representation of a type in a programming language.
Definition: CompilerType.h:36
llvm::Error Interpret(std::vector< ControlStackElement > &control, DataStack &data, Selectors sel)
std::variant< std::string, uint64_t, int64_t, lldb::ValueObjectSP, CompilerType, Selectors > DataStackElement
A class that represents a running process on the host machine.
const char * toString(AppleArm64ExceptionClass EC)
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
Definition: lldb-forward.h:484
DataStack(lldb::ValueObjectSP initial_value)