Expression.cpp revision 355940
1//===-- Expression.cpp ------------------------------------------*- C++ -*-===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9#include "lldb/Expression/Expression.h"
10#include "lldb/Target/ExecutionContextScope.h"
11#include "lldb/Target/Target.h"
12
13using namespace lldb_private;
14
15Expression::Expression(Target &target, ExpressionKind kind)
16    : m_kind(kind),
17      m_target_wp(target.shared_from_this()),
18      m_jit_start_addr(LLDB_INVALID_ADDRESS),
19      m_jit_end_addr(LLDB_INVALID_ADDRESS) {
20  // Can't make any kind of expression without a target.
21  assert(m_target_wp.lock());
22}
23
24Expression::Expression(ExecutionContextScope &exe_scope, ExpressionKind kind)
25    : m_kind(kind),
26      m_target_wp(exe_scope.CalculateTarget()),
27      m_jit_start_addr(LLDB_INVALID_ADDRESS),
28      m_jit_end_addr(LLDB_INVALID_ADDRESS) {
29  assert(m_target_wp.lock());
30}
31