#include "FormatterBytecode.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/ValueObject/ValueObject.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/DataExtractor.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/FormatProviders.h"
#include "llvm/Support/FormatVariadicDetails.h"
#include "FormatterBytecode.def"
Go to the source code of this file.
◆ BINOP
◆ BINOP_CHECKZERO
#define BINOP_CHECKZERO |
( |
|
OP | ) |
BINOP_IMPL(OP, true) |
◆ BINOP_IMPL
#define BINOP_IMPL |
( |
|
OP, |
|
|
|
CHECK_ZERO |
|
) |
| |
Value: { \
TYPE_CHECK(Any, Any); \
auto y = data.PopAny(); \
if (std::holds_alternative<uint64_t>(y)) { \
if (CHECK_ZERO && !std::get<uint64_t>(y)) \
return error(#OP
" by zero"); \
data.Push((uint64_t)(data.Pop<uint64_t>() OP std::get<uint64_t>(y))); \
} else if (std::holds_alternative<int64_t>(y)) { \
if (CHECK_ZERO && !std::get<int64_t>(y)) \
return error(#OP
" by zero"); \
TYPE_CHECK(Int); \
data.Push((int64_t)(data.Pop<int64_t>() OP std::get<int64_t>(y))); \
} else \
return
error(
"unsupported data types"); \
}
static llvm::raw_ostream & error(Stream &strm)
◆ DEFINE_OPCODE
#define DEFINE_OPCODE |
( |
|
OP, |
|
|
|
MNEMONIC, |
|
|
|
NAME |
|
) |
| |
Value: case OP: { \
const char *s = MNEMONIC; \
return s ? s : #NAME; \
}
◆ DEFINE_SELECTOR
#define DEFINE_SELECTOR |
( |
|
ID, |
|
|
|
NAME |
|
) |
| |
◆ DEFINE_SIGNATURE
#define DEFINE_SIGNATURE |
( |
|
ID, |
|
|
|
NAME |
|
) |
| |
◆ POP_VALOBJ
#define POP_VALOBJ |
( |
|
VALOBJ | ) |
|
Value:
if (!VALOBJ) \
return error(
"null object");
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
◆ SHIFTOP
#define SHIFTOP |
( |
|
OP, |
|
|
|
LEFT |
|
) |
| |
Value: { \
uint64_t y = data.Pop<uint64_t>(); \
if (y > 64) \
return error(
"shift out of bounds"); \
if (std::holds_alternative<uint64_t>(data.back())) { \
uint64_t x = data.Pop<uint64_t>(); \
data.Push(x OP y); \
} else if (std::holds_alternative<int64_t>(data.back())) { \
int64_t x = data.Pop<int64_t>(); \
if (x < 0 && LEFT) \
return error(
"left shift of negative value"); \
if (y > 64) \
return error(
"shift out of bounds"); \
data.Push(x OP y); \
} else \
return
error(
"unsupported data types"); \
}
◆ TYPE_CHECK
#define TYPE_CHECK |
( |
|
... | ) |
|
Value: if (
auto error = TypeCheck(data, __VA_ARGS__)) \