1 //===-- ClangExpressionVariable.cpp -----------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "ClangExpressionVariable.h"
11 
12 #include "clang/AST/ASTContext.h"
13 #include "lldb/Core/ConstString.h"
14 #include "lldb/Core/DataExtractor.h"
15 #include "lldb/Core/Stream.h"
16 #include "lldb/Core/Value.h"
17 #include "lldb/Core/ValueObjectConstResult.h"
18 #include "lldb/Target/ExecutionContext.h"
19 #include "lldb/Target/Process.h"
20 
21 using namespace lldb_private;
22 using namespace clang;
23 
24 const char *g_clang_expression_variable_kind_name = "ClangExpressionVariable";
25 
26 ClangExpressionVariable::ClangExpressionVariable(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, uint32_t addr_byte_size) :
27     ExpressionVariable(LLVMCastKind::eKindClang),
28     m_parser_vars(),
29     m_jit_vars ()
30 {
31     m_flags = EVNone;
32     m_frozen_sp = ValueObjectConstResult::Create (exe_scope, byte_order, addr_byte_size);
33 }
34 
35 ClangExpressionVariable::ClangExpressionVariable (ExecutionContextScope *exe_scope,
36                                                   Value &value,
37                                                   const ConstString &name,
38                                                   uint16_t flags) :
39     ExpressionVariable(LLVMCastKind::eKindClang),
40     m_parser_vars(),
41     m_jit_vars ()
42 {
43     m_flags = flags;
44     m_frozen_sp = ValueObjectConstResult::Create (exe_scope, value, name);
45 }
46 
47 ClangExpressionVariable::ClangExpressionVariable (const lldb::ValueObjectSP &valobj_sp) :
48     ExpressionVariable(LLVMCastKind::eKindClang),
49     m_parser_vars(),
50     m_jit_vars ()
51 {
52     m_flags = EVNone;
53     m_frozen_sp = valobj_sp;
54 }
55 
56 TypeFromUser
57 ClangExpressionVariable::GetTypeFromUser()
58 {
59     TypeFromUser tfu (m_frozen_sp->GetCompilerType());
60     return tfu;
61 }
62