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 "lldb/Core/ConstString.h" 13 #include "lldb/Core/DataExtractor.h" 14 #include "lldb/Core/Stream.h" 15 #include "lldb/Core/Value.h" 16 #include "lldb/Core/ValueObjectConstResult.h" 17 #include "lldb/Target/ExecutionContext.h" 18 #include "lldb/Target/Process.h" 19 #include "clang/AST/ASTContext.h" 20 21 using namespace lldb_private; 22 using namespace clang; 23 24 ClangExpressionVariable::ClangExpressionVariable( 25 ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, 26 uint32_t addr_byte_size) 27 : ExpressionVariable(LLVMCastKind::eKindClang), m_parser_vars(), 28 m_jit_vars() { 29 m_flags = EVNone; 30 m_frozen_sp = 31 ValueObjectConstResult::Create(exe_scope, byte_order, addr_byte_size); 32 } 33 34 ClangExpressionVariable::ClangExpressionVariable( 35 ExecutionContextScope *exe_scope, Value &value, const ConstString &name, 36 uint16_t flags) 37 : ExpressionVariable(LLVMCastKind::eKindClang), m_parser_vars(), 38 m_jit_vars() { 39 m_flags = flags; 40 m_frozen_sp = ValueObjectConstResult::Create(exe_scope, value, name); 41 } 42 43 ClangExpressionVariable::ClangExpressionVariable( 44 const lldb::ValueObjectSP &valobj_sp) 45 : ExpressionVariable(LLVMCastKind::eKindClang), m_parser_vars(), 46 m_jit_vars() { 47 m_flags = EVNone; 48 m_frozen_sp = valobj_sp; 49 } 50 51 ClangExpressionVariable::ClangExpressionVariable( 52 ExecutionContextScope *exe_scope, const ConstString &name, 53 const TypeFromUser &user_type, lldb::ByteOrder byte_order, 54 uint32_t addr_byte_size) 55 : ExpressionVariable(LLVMCastKind::eKindClang), m_parser_vars(), 56 m_jit_vars() { 57 m_flags = EVNone; 58 m_frozen_sp = 59 ValueObjectConstResult::Create(exe_scope, byte_order, addr_byte_size); 60 SetName(name); 61 SetCompilerType(user_type); 62 } 63 64 TypeFromUser ClangExpressionVariable::GetTypeFromUser() { 65 TypeFromUser tfu(m_frozen_sp->GetCompilerType()); 66 return tfu; 67 } 68