1 //===-- ClangExpressionVariable.cpp -----------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "ClangExpressionVariable.h"
11 #include "lldb/Core/Value.h"
12 #include "lldb/Core/ValueObjectConstResult.h"
13 #include "lldb/Target/ExecutionContext.h"
14 #include "lldb/Target/Process.h"
15 #include "lldb/Utility/ConstString.h"
16 #include "lldb/Utility/DataExtractor.h"
17 #include "lldb/Utility/Stream.h"
18 #include "clang/AST/ASTContext.h"
20 using namespace lldb_private;
21 using namespace clang;
23 ClangExpressionVariable::ClangExpressionVariable(
24 ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order,
25 uint32_t addr_byte_size)
26 : ExpressionVariable(LLVMCastKind::eKindClang), m_parser_vars(),
30 ValueObjectConstResult::Create(exe_scope, byte_order, addr_byte_size);
33 ClangExpressionVariable::ClangExpressionVariable(
34 ExecutionContextScope *exe_scope, Value &value, ConstString name,
36 : ExpressionVariable(LLVMCastKind::eKindClang), m_parser_vars(),
39 m_frozen_sp = ValueObjectConstResult::Create(exe_scope, value, name);
42 ClangExpressionVariable::ClangExpressionVariable(
43 const lldb::ValueObjectSP &valobj_sp)
44 : ExpressionVariable(LLVMCastKind::eKindClang), m_parser_vars(),
47 m_frozen_sp = valobj_sp;
50 ClangExpressionVariable::ClangExpressionVariable(
51 ExecutionContextScope *exe_scope, ConstString name,
52 const TypeFromUser &user_type, lldb::ByteOrder byte_order,
53 uint32_t addr_byte_size)
54 : ExpressionVariable(LLVMCastKind::eKindClang), m_parser_vars(),
58 ValueObjectConstResult::Create(exe_scope, byte_order, addr_byte_size);
60 SetCompilerType(user_type);
63 TypeFromUser ClangExpressionVariable::GetTypeFromUser() {
64 TypeFromUser tfu(m_frozen_sp->GetCompilerType());