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, Char_U) \
80 X(unsigned char, UChar) \
82 X(unsigned short, UShort) \
84 X(unsigned int, UInt) \
86 X(unsigned long, ULong) \
87 X(long long, LongLong) \
88 X(unsigned long long, ULongLong) \
91 X(long double, LongDouble)
95#define X(type, name) type m_##name;
103#define X(type, name) K_##name,
120 void printType(llvm::raw_ostream &Out)
const;
121 void printData(llvm::raw_ostream &Out)
const;
122 void print(llvm::raw_ostream &Out)
const;
132 bool isValid()
const {
return ValueKind != K_Unspecified; }
133 bool isVoid()
const {
return ValueKind == K_Void; }
134 bool hasValue()
const {
return isValid() && !isVoid(); }
140 void *getPtr()
const;
143#define X(type, name) \
144 void set##name(type Val) { Data.m_##name = Val; } \
145 type get##name() const { return Data.m_##name; }
163 template <
typename T>
T as()
const {
167#define X(type, name) \
168 case Value::K_##name: \
169 return (T)Data.m_##name;
178 if (
V.isPointerOrObjectType())
180 if (!
V.isValid() ||
V.isVoid()) {
189 if (
V.isPointerOrObjectType())
196 void *OpaqueType =
nullptr;
198 Kind ValueKind = K_Unspecified;
199 bool IsManuallyAlloc =
false;
205 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 &ASTCtx, QualType Ty)
#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)
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T
Diagnostic wrappers for TextAPI types for error reporting.
__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)