33#ifndef LLVM_CLANG_INTERPRETER_VALUE_H
34#define LLVM_CLANG_INTERPRETER_VALUE_H
36#include "llvm/Support/Compiler.h"
64#define REPL_EXTERNAL_VISIBILITY __declspec(dllexport)
65#elif __has_attribute(visibility)
66#if defined(LLVM_BUILD_LLVM_DYLIB) || defined(LLVM_BUILD_SHARED_LIBS)
67#define REPL_EXTERNAL_VISIBILITY __attribute__((visibility("default")))
69#define REPL_EXTERNAL_VISIBILITY
72#define REPL_EXTERNAL_VISIBILITY
75#define REPL_BUILTIN_TYPES \
78 X(signed char, SChar) \
79 X(unsigned char, UChar) \
81 X(unsigned short, UShort) \
83 X(unsigned int, UInt) \
85 X(unsigned long, ULong) \
86 X(long long, LongLong) \
87 X(unsigned long long, ULongLong) \
90 X(long double, LongDouble)
94#define X(type, name) type m_##name;
102#define X(type, name) K_##name,
119 void printType(llvm::raw_ostream &Out)
const;
120 void printData(llvm::raw_ostream &Out)
const;
121 void print(llvm::raw_ostream &Out)
const;
131 bool isValid()
const {
return ValueKind != K_Unspecified; }
132 bool isVoid()
const {
return ValueKind == K_Void; }
133 bool hasValue()
const {
return isValid() && !isVoid(); }
139 void *getPtr()
const;
142#define X(type, name) \
143 void set##name(type Val) { Data.m_##name = Val; } \
144 type get##name() const { return Data.m_##name; }
162 template <
typename T> T
as()
const {
166#define X(type, name) \
167 case Value::K_##name: \
168 return (T)Data.m_##name;
177 if (
V.isPointerOrObjectType())
179 if (!
V.isValid() ||
V.isVoid()) {
188 if (
V.isPointerOrObjectType())
195 void *OpaqueType =
nullptr;
197 Kind ValueKind = K_Unspecified;
198 bool IsManuallyAlloc =
false;
204 return (
void *)as<uintptr_t>();
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
static void print(llvm::raw_ostream &OS, const T &V, ASTContext &, QualType)
#define REPL_EXTERNAL_VISIBILITY
#define REPL_BUILTIN_TYPES
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Provides top-level interfaces for incremental compilation and execution.
A (possibly-)qualified type.
bool isManuallyAlloc() const
bool isPointerOrObjectType() const
REPL_BUILTIN_TYPES T convertTo() const
Get the value with cast.
T as() const
Get to the value with type checking casting the underlying stored value to T.
void setOpaqueType(void *Ty)
YAML serialization mapping.
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
static T * cast(const Value &V)
static T cast(const Value &V)