1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
//===-- SwiftExpressionVariable.h -------------------------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
#ifndef liblldb_SwiftExpressionVariable_h_
#define liblldb_SwiftExpressionVariable_h_
// C Includes
#include <signal.h>
#include <stdint.h>
#include <string.h>
// C++ Includes
#include <map>
#include <string>
#include <vector>
// Other libraries and framework includes
#include "llvm/Support/Casting.h"
// Project includes
#include "lldb/Core/Value.h"
#include "lldb/Expression/ExpressionVariable.h"
#include "lldb/Symbol/TaggedASTType.h"
#include "lldb/Utility/ConstString.h"
#include "lldb/lldb-public.h"
namespace llvm {
class Value;
}
namespace lldb_private {
class SwiftExpressionVariable : public ExpressionVariable {
public:
SwiftExpressionVariable(ExecutionContextScope *exe_scope,
lldb::ByteOrder byte_order, uint32_t addr_byte_size);
SwiftExpressionVariable(const lldb::ValueObjectSP &valobj_sp);
SwiftExpressionVariable(ExecutionContextScope *exe_scope, ConstString name,
const TypeFromUser &user_type,
lldb::ByteOrder byte_order, uint32_t addr_byte_size);
//----------------------------------------------------------------------
/// Utility functions for dealing with ExpressionVariableLists in
/// Clang-specific ways
//----------------------------------------------------------------------
static SwiftExpressionVariable *
CreateVariableInList(ExpressionVariableList &list,
ExecutionContextScope *exe_scope, ConstString name,
const TypeFromUser &user_type,
lldb::ByteOrder byte_order, uint32_t addr_byte_size) {
SwiftExpressionVariable *swift_var =
new SwiftExpressionVariable(exe_scope, byte_order, addr_byte_size);
lldb::ExpressionVariableSP var_sp(swift_var);
swift_var->SetName(name);
swift_var->SetCompilerType(user_type);
list.AddVariable(var_sp);
return swift_var;
}
bool GetIsModifiable() const { return (m_swift_flags & EVSIsModifiable); }
void SetIsModifiable(bool is_modifiable) {
if (is_modifiable)
m_swift_flags |= EVSIsModifiable;
else
m_swift_flags &= ~EVSIsModifiable;
}
bool GetIsComputed() const { return (m_swift_flags & EVSIsComputed); }
void SetIsComputed(bool is_computed) {
if (is_computed)
m_swift_flags |= EVSIsComputed;
else
m_swift_flags &= ~EVSIsComputed;
}
enum SwiftFlags {
EVSNone = 0,
EVSNeedsInit = 1 << 0, ///< This variable's contents are not yet initialized
///(for result variables and new persistent
///variables)
EVSIsModifiable =
1 << 1, ///< This variable is a "let" and should not be modified.
EVSIsComputed =
1
<< 2 ///< This variable is a computed property and has no backing store.
};
typedef uint8_t SwiftFlagType;
SwiftFlagType m_swift_flags; // takes elements of Flags
// LLVM RTTI Support
static char ID;
//----------------------------------------------------------------------
/// Members
//----------------------------------------------------------------------
SwiftExpressionVariable(const SwiftExpressionVariable &) = delete;
const SwiftExpressionVariable &
operator=(const SwiftExpressionVariable &) = delete;
};
} // namespace lldb_private
#endif // liblldb_SwiftExpressionVariable_h_
|