20#include "llvm/Support/FormatAdapters.h"
35 value_sp = dynamic_sp;
41 value_sp = synthetic_sp;
50 return type_system.get()->GetBasicTypeFromAST(basic_type);
57 llvm::StringRef name) {
67llvm::Expected<lldb::ValueObjectSP>
70 return llvm::make_error<DILDiagnosticError>(
m_expr,
"invalid value object",
72 llvm::Expected<lldb::TypeSystemSP> type_system =
75 return type_system.takeError();
78 if (valobj->IsBitfield()) {
83 uint32_t bitfield_size = valobj->GetBitfieldBitSize();
86 if (bitfield_size > 0 && in_type.
IsInteger()) {
90 llvm::Expected<uint64_t> int_bit_size =
93 return int_bit_size.takeError();
94 llvm::Expected<uint64_t> uint_bit_size =
97 return int_bit_size.takeError();
98 if (bitfield_size < *int_bit_size ||
99 (in_type.
IsSigned() && bitfield_size == *int_bit_size))
100 return valobj->CastToBasicType(int_type);
101 if (bitfield_size <= *uint_bit_size)
102 return valobj->CastToBasicType(uint_type);
105 bool resolved = valobj->ResolveValue(scalar);
107 return llvm::createStringError(
"invalid scalar value");
116 if (valobj->GetCompilerType().IsInteger() ||
117 valobj->GetCompilerType().IsUnscopedEnumerationType()) {
118 llvm::Expected<CompilerType> promoted_type =
119 type_system.get()->DoIntegralPromotion(valobj->GetCompilerType(),
122 return promoted_type.takeError();
123 if (!promoted_type->CompareTypes(valobj->GetCompilerType()))
124 return valobj->CastToBasicType(*promoted_type);
170 switch (basic_type) {
189llvm::Expected<CompilerType>
194 llvm::Expected<uint64_t> lhs_size =
197 return lhs_size.takeError();
198 llvm::Expected<uint64_t> rhs_size =
201 return rhs_size.takeError();
203 if (*rhs_size == *lhs_size) {
204 llvm::Expected<lldb::TypeSystemSP> type_system =
207 return type_system.takeError();
212 return r_type_unsigned;
218llvm::Expected<CompilerType>
224 return lhs_or_err.takeError();
228 return rhs_or_err.takeError();
244 if (l_rank == 0 || r_rank == 0)
245 return llvm::make_error<DILDiagnosticError>(
246 m_expr,
"unexpected basic type in arithmetic operation", location);
251 using Rank = std::tuple<size_t, bool>;
252 Rank int_l_rank = {l_rank, !lhs_type.
IsSigned()};
253 Rank int_r_rank = {r_rank, !rhs_type.
IsSigned()};
254 if (int_l_rank < int_r_rank) {
257 return type_or_err.takeError();
260 if (int_l_rank > int_r_rank) {
263 return type_or_err.takeError();
278 std::vector<lldb::VariableSP> possible_matches;
281 llvm::StringRef str_ref_name = var_sp->GetName().GetStringRef();
283 str_ref_name.consume_front(
"::");
289 if (var_sp->NameMatches(name))
290 possible_matches.push_back(var_sp);
294 if (possible_matches.size() > 0)
295 return possible_matches[0];
301 llvm::StringRef name_ref, std::shared_ptr<StackFrame> stack_frame,
305 stack_frame->GetSymbolContext(lldb::eSymbolContextCompUnit);
310 name_ref.consume_front(
"::");
317 stack_frame->GetValueObjectForFrameVariable(var_sp, use_dynamic);
325 target_sp->GetImages().FindGlobalVariables(
326 ConstString(name_ref), std::numeric_limits<uint32_t>::max(),
329 if (!modules_var_list.
Empty()) {
342 std::shared_ptr<StackFrame> stack_frame,
346 if (name_ref.consume_front(
"$")) {
351 if (
const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName(name_ref))
357 if (!name_ref.contains(
"::")) {
361 stack_frame->GetInScopeVariableList(
false));
366 variable_list->FindVariable(
ConstString(name_ref));
369 stack_frame->GetValueObjectForFrameVariable(var_sp, use_dynamic);
377 lldb::eSymbolContextFunction | lldb::eSymbolContextBlock);
379 value_sp = stack_frame->FindVariable(
ConstString(ivar_name));
381 value_sp = value_sp->GetChildMemberWithName(name_ref);
390 std::shared_ptr<StackFrame> frame_sp,
392 bool fragile_ivar,
bool check_ptr_vs_member)
400 auto value_or_error = node.
Accept(
this);
402 if (value_or_error && !*value_or_error)
403 return llvm::make_error<DILDiagnosticError>(
m_expr,
"invalid value object",
407 return value_or_error;
410llvm::Expected<lldb::ValueObjectSP>
412 auto valobj_or_err =
Evaluate(node);
414 return valobj_or_err;
418 if (valobj->GetCompilerType().IsReferenceType()) {
419 valobj = valobj->Dereference(
error);
421 return error.ToError();
426llvm::Expected<lldb::ValueObjectSP>
438 llvm::formatv(
"use of undeclared identifier '{0}'", node.
GetName());
439 return llvm::make_error<DILDiagnosticError>(
446llvm::Expected<lldb::ValueObjectSP>
459 operand = dynamic_op;
465 child_sp = synth_obj_sp->Dereference(
error);
469 return llvm::make_error<DILDiagnosticError>(
m_expr,
error.AsCString(),
478 return llvm::make_error<DILDiagnosticError>(
m_expr,
error.AsCString(),
484 if (operand->GetCompilerType().IsReferenceType()) {
485 operand = operand->Dereference(
error);
487 return error.ToError();
489 llvm::Expected<lldb::ValueObjectSP> conv_op =
497 llvm::formatv(
"invalid argument type '{0}' to unary expression",
499 return llvm::make_error<DILDiagnosticError>(
m_expr, errMsg,
503 bool resolved = operand->ResolveValue(scalar);
510 m_target, scalar, operand->GetCompilerType(),
"result");
514 if (operand->GetCompilerType().IsReferenceType()) {
515 operand = operand->Dereference(
error);
517 return error.ToError();
519 llvm::Expected<lldb::ValueObjectSP> conv_op =
529 llvm::formatv(
"invalid argument type '{0}' to unary expression",
531 return llvm::make_error<DILDiagnosticError>(
m_expr, errMsg,
537 return llvm::make_error<DILDiagnosticError>(
m_expr,
"invalid unary operation",
541llvm::Expected<lldb::ValueObjectSP>
546 bool l_resolved = lhs->ResolveValue(
l);
547 bool r_resolved = rhs->ResolveValue(r);
549 if (!l_resolved || !r_resolved)
550 return llvm::make_error<DILDiagnosticError>(
m_expr,
"invalid scalar value",
553 auto value_object = [
this, result_type](
Scalar scalar) {
555 result_type,
"result");
560 return value_object(
l + r);
562 return value_object(
l - r);
564 return llvm::make_error<DILDiagnosticError>(
565 m_expr,
"invalid arithmetic operation", location);
573 auto orig_lhs_type = lhs->GetCompilerType();
574 auto orig_rhs_type = rhs->GetCompilerType();
577 return type_or_err.takeError();
584 llvm::formatv(
"invalid operands to binary expression ('{0}' and '{1}')",
585 orig_lhs_type.GetTypeName(), orig_rhs_type.GetTypeName());
586 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(errMsg),
595 auto orig_lhs_type = lhs->GetCompilerType();
596 auto orig_rhs_type = rhs->GetCompilerType();
599 return type_or_err.takeError();
606 llvm::formatv(
"invalid operands to binary expression ('{0}' and '{1}')",
607 orig_lhs_type.GetTypeName(), orig_rhs_type.GetTypeName());
608 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(errMsg),
612llvm::Expected<lldb::ValueObjectSP>
624 lhs->GetCompilerType().GetTypeSystem().GetSharedPointer();
626 rhs->GetCompilerType().GetTypeSystem().GetSharedPointer();
627 if (lhs_system->GetPluginName() != rhs_system->GetPluginName()) {
629 return llvm::make_error<DILDiagnosticError>(
640 return llvm::make_error<DILDiagnosticError>(
644llvm::Expected<lldb::ValueObjectSP>
657 const uint32_t pointer_type_flags =
658 base->GetCompilerType().GetTypeInfo(
nullptr);
659 if ((pointer_type_flags & lldb::eTypeIsObjC) &&
660 (pointer_type_flags & lldb::eTypeIsPointer)) {
669 if (!base->IsPointerType() && base->HasSyntheticValue()) {
672 base->GetSyntheticValue()->Dereference(deref_error);
673 synth_deref_sp && deref_error.
Success()) {
674 base = std::move(synth_deref_sp);
676 if (!base || deref_error.
Fail()) {
677 std::string errMsg = llvm::formatv(
678 "Failed to dereference synthetic value: {0}", deref_error);
679 return llvm::make_error<DILDiagnosticError>(
685 std::string errMsg =
"Failed to dereference synthetic value";
686 return llvm::make_error<DILDiagnosticError>(
694 bool base_is_ptr = base->IsPointerType();
696 if (expr_is_ptr != base_is_ptr) {
699 llvm::formatv(
"member reference type {0} is a pointer; "
700 "did you mean to use '->'?",
701 base->GetCompilerType().TypeDescription());
702 return llvm::make_error<DILDiagnosticError>(
706 llvm::formatv(
"member reference type {0} is not a pointer; "
707 "did you mean to use '.'?",
708 base->GetCompilerType().TypeDescription());
709 return llvm::make_error<DILDiagnosticError>(
719 field_obj = base->GetSyntheticValue();
721 field_obj = field_obj->GetChildMemberWithName(node.
GetFieldName());
725 std::string errMsg = llvm::formatv(
726 "\"{0}\" is not a member of \"({1}) {2}\"", node.
GetFieldName(),
727 base->GetTypeName().AsCString(
"<invalid type>"), base->GetName());
728 return llvm::make_error<DILDiagnosticError>(
738 field_obj = dynamic_val_sp;
744 if (node.
GetIsArrow() && base->IsPointerType())
746 std::string errMsg = llvm::formatv(
747 "\"{0}\" is not a member of \"({1}) {2}\"", node.
GetFieldName(),
748 base->GetTypeName().AsCString(
"<invalid type>"), base->GetName());
749 return llvm::make_error<DILDiagnosticError>(
753llvm::Expected<lldb::ValueObjectSP>
760 if (!idx->GetCompilerType().IsIntegerOrUnscopedEnumerationType()) {
761 return llvm::make_error<DILDiagnosticError>(
766 uint64_t child_idx = idx->GetValueAsUnsigned(0);
774 CompilerType base_type = base->GetCompilerType().GetNonReferenceType();
775 base->GetExpressionPath(var_expr_path_strm);
776 bool is_incomplete_array =
false;
778 bool is_objc_pointer =
true;
781 is_objc_pointer =
false;
782 else if (!base->GetCompilerType().IsPointerType())
783 is_objc_pointer =
false;
786 std::string err_msg = llvm::formatv(
787 "\"({0}) {1}\" is an Objective-C pointer, and cannot be subscripted",
788 base->GetTypeName().AsCString(
"<invalid type>"),
790 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(err_msg),
793 if (is_objc_pointer) {
795 if (!synthetic || synthetic == base) {
796 std::string err_msg =
797 llvm::formatv(
"\"({0}) {1}\" is not an array type",
798 base->GetTypeName().AsCString(
"<invalid type>"),
800 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(err_msg),
803 if (
static_cast<uint32_t
>(child_idx) >=
804 synthetic->GetNumChildrenIgnoringErrors()) {
805 std::string err_msg = llvm::formatv(
806 "array index {0} is not valid for \"({1}) {2}\"", child_idx,
807 base->GetTypeName().AsCString(
"<invalid type>"),
809 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(err_msg),
812 child_valobj_sp = synthetic->GetChildAtIndex(child_idx);
813 if (!child_valobj_sp) {
814 std::string err_msg = llvm::formatv(
815 "array index {0} is not valid for \"({1}) {2}\"", child_idx,
816 base->GetTypeName().AsCString(
"<invalid type>"),
818 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(err_msg),
822 if (
auto dynamic_sp = child_valobj_sp->GetDynamicValue(
m_use_dynamic))
823 child_valobj_sp = std::move(dynamic_sp);
825 return child_valobj_sp;
828 child_valobj_sp = base->GetSyntheticArrayMember(child_idx,
true);
829 if (!child_valobj_sp) {
830 std::string err_msg = llvm::formatv(
831 "failed to use pointer as array for index {0} for "
833 child_idx, base->GetTypeName().AsCString(
"<invalid type>"),
836 err_msg =
"subscript of pointer to incomplete type 'void'";
837 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(err_msg),
840 }
else if (base_type.
IsArrayType(
nullptr,
nullptr, &is_incomplete_array)) {
841 child_valobj_sp = base->GetChildAtIndex(child_idx);
843 child_valobj_sp = base->GetSyntheticArrayMember(child_idx,
true);
844 if (!child_valobj_sp) {
845 std::string err_msg = llvm::formatv(
846 "array index {0} is not valid for \"({1}) {2}\"", child_idx,
847 base->GetTypeName().AsCString(
"<invalid type>"),
849 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(err_msg),
854 base->GetSyntheticBitFieldChild(child_idx, child_idx,
true);
855 if (!child_valobj_sp) {
856 std::string err_msg = llvm::formatv(
857 "bitfield range {0}:{1} is not valid for \"({2}) {3}\"", child_idx,
858 child_idx, base->GetTypeName().AsCString(
"<invalid type>"),
860 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(err_msg),
866 std::string err_msg =
867 llvm::formatv(
"\"{0}\" is not an array type",
868 base->GetTypeName().AsCString(
"<invalid type>"));
869 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(err_msg),
872 if (
static_cast<uint32_t
>(child_idx) >=
873 synthetic->GetNumChildrenIgnoringErrors(child_idx + 1)) {
874 std::string err_msg = llvm::formatv(
875 "array index {0} is not valid for \"({1}) {2}\"", child_idx,
876 base->GetTypeName().AsCString(
"<invalid type>"),
878 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(err_msg),
881 child_valobj_sp = synthetic->GetChildAtIndex(child_idx);
882 if (!child_valobj_sp) {
883 std::string err_msg = llvm::formatv(
884 "array index {0} is not valid for \"({1}) {2}\"", child_idx,
885 base->GetTypeName().AsCString(
"<invalid type>"),
887 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(err_msg),
892 if (child_valobj_sp) {
894 if (
auto dynamic_sp = child_valobj_sp->GetDynamicValue(
m_use_dynamic))
895 child_valobj_sp = std::move(dynamic_sp);
897 return child_valobj_sp;
901 int64_t signed_child_idx = idx->GetValueAsSigned(0, &success);
903 return llvm::make_error<DILDiagnosticError>(
904 m_expr,
"could not get the index as an integer",
906 return base->GetSyntheticArrayMember(signed_child_idx,
true);
909llvm::Expected<lldb::ValueObjectSP>
912 if (!first_idx_or_err)
913 return first_idx_or_err;
916 if (!last_idx_or_err)
917 return last_idx_or_err;
920 if (!first_idx->GetCompilerType().IsIntegerOrUnscopedEnumerationType() ||
921 !last_idx->GetCompilerType().IsIntegerOrUnscopedEnumerationType()) {
922 return llvm::make_error<DILDiagnosticError>(
926 bool success_first, success_last;
927 int64_t first_index = first_idx->GetValueAsSigned(0, &success_first);
928 int64_t last_index = last_idx->GetValueAsSigned(0, &success_last);
929 if (!success_first || !success_last)
930 return llvm::make_error<DILDiagnosticError>(
934 if (first_index > last_index)
935 std::swap(first_index, last_index);
942 base->GetSyntheticBitFieldChild(first_index, last_index,
true);
943 if (!child_valobj_sp) {
944 std::string message = llvm::formatv(
945 "bitfield range {0}:{1} is not valid for \"({2}) {3}\"", first_index,
946 last_index, base->GetTypeName().AsCString(
"<invalid type>"),
947 base->GetName().AsCString());
948 return llvm::make_error<DILDiagnosticError>(
m_expr, message,
951 return child_valobj_sp;
954llvm::Expected<CompilerType>
956 std::shared_ptr<ExecutionContextScope> ctx,
961 llvm::APInt apint = literal.
GetValue();
963 llvm::SmallVector<std::pair<lldb::BasicType, lldb::BasicType>, 3> candidates;
974 for (
auto [signed_, unsigned_] : candidates) {
975 CompilerType signed_type = type_system->GetBasicTypeFromAST(signed_);
978 llvm::Expected<uint64_t> size = signed_type.
GetBitSize(ctx.get());
980 return size.takeError();
981 if (!literal.
IsUnsigned() && apint.isIntN(*size - 1))
984 return type_system->GetBasicTypeFromAST(unsigned_);
987 return llvm::make_error<DILDiagnosticError>(
989 "integer literal is too large to be represented in any integer type",
993llvm::Expected<lldb::ValueObjectSP>
995 llvm::Expected<lldb::TypeSystemSP> type_system =
998 return type_system.takeError();
1000 llvm::Expected<CompilerType> type =
1003 return type.takeError();
1008 llvm::Expected<uint64_t> type_bitsize =
1011 return type_bitsize.takeError();
1017llvm::Expected<lldb::ValueObjectSP>
1019 llvm::Expected<lldb::TypeSystemSP> type_system =
1022 return type_system.takeError();
1025 &node.
GetValue().getSemantics() == &llvm::APFloat::IEEEsingle();
1031 return llvm::make_error<DILDiagnosticError>(
1039llvm::Expected<lldb::ValueObjectSP>
1045llvm::Expected<CastKind>
1050 if (target_type.
GetTypeInfo() & lldb::eTypeIsFloat) {
1051 std::string errMsg = llvm::formatv(
"Cast from {0} to {1} is not allowed",
1054 return llvm::make_error<DILDiagnosticError>(
1055 m_expr, std::move(errMsg), location,
1065 uint64_t type_byte_size = 0;
1066 uint64_t rhs_type_byte_size = 0;
1068 type_byte_size = *temp;
1070 std::string errMsg = llvm::formatv(
"unable to get byte size for type {0}",
1072 return llvm::make_error<DILDiagnosticError>(
1073 m_expr, std::move(errMsg), location,
1078 rhs_type_byte_size = *temp;
1080 std::string errMsg = llvm::formatv(
"unable to get byte size for type {0}",
1082 return llvm::make_error<DILDiagnosticError>(
1083 m_expr, std::move(errMsg), location,
1087 if (type_byte_size < rhs_type_byte_size) {
1088 std::string errMsg = llvm::formatv(
1089 "cast from pointer to smaller type {0} loses information",
1091 return llvm::make_error<DILDiagnosticError>(
1092 m_expr, std::move(errMsg), location,
1097 std::string errMsg = llvm::formatv(
"cannot convert {0} to {1}",
1101 return llvm::make_error<DILDiagnosticError>(
1102 m_expr, std::move(errMsg), location,
1108llvm::Expected<CastKind>
1119 std::string errMsg = llvm::formatv(
"Cast from {0} to {1} is not allowed",
1123 return llvm::make_error<DILDiagnosticError>(
1124 m_expr, std::move(errMsg), location,
1134 std::string errMsg = llvm::formatv(
1135 "cannot cast from type {0} to pointer type {1}",
1138 return llvm::make_error<DILDiagnosticError>(
1139 m_expr, std::move(errMsg), location,
1146 std::string errMsg = llvm::formatv(
1147 "casting of {0} to {1} is not implemented yet",
1149 return llvm::make_error<DILDiagnosticError>(
1150 m_expr, std::move(errMsg), location,
1157 if (!operand_or_err)
1158 return operand_or_err;
1168 operand->GetName().GetStringRef());
1169 op_type = operand->GetCompilerType();
1174 return type_or_err.takeError();
1177 if (operand->GetCompilerType().IsReferenceType()) {
1179 operand = operand->Dereference(
error);
1181 return llvm::make_error<DILDiagnosticError>(
m_expr,
error.AsCString(),
1185 switch (cast_kind) {
1190 return operand->CastToEnumType(target_type);
1196 return operand->CastToBasicType(target_type);
1201 ? operand->GetLoadAddress()
1202 : (op_type.
IsSigned() ? operand->GetValueAsSigned(0)
1203 : operand->GetValueAsUnsigned(0));
1204 llvm::StringRef name =
"result";
1215 std::string errMsg =
1216 llvm::formatv(
"unable to cast from '{0}' to '{1}'",
1218 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(errMsg),
static llvm::raw_ostream & error(Stream &strm)
lldb::VariableListSP GetVariableList(bool can_create)
Get the variable list for a compile unit.
Generic representation of a type in a programming language.
bool IsEnumerationType(bool &is_signed) const
lldb::BasicType GetBasicTypeEnumeration() const
bool IsArrayType(CompilerType *element_type=nullptr, uint64_t *size=nullptr, bool *is_incomplete=nullptr) const
CompilerType GetPointerType() const
Return a new CompilerType that is a pointer to this type.
llvm::Expected< uint64_t > GetByteSize(ExecutionContextScope *exe_scope) const
Return the size of the type in bytes.
bool IsPointerToVoid() const
CompilerType GetNonReferenceType() const
If this type is a reference to a type (L value or R value reference), return a new type with the refe...
ConstString GetTypeName(bool BaseOnly=false) const
bool IsReferenceType(CompilerType *pointee_type=nullptr, bool *is_rvalue=nullptr) const
std::string TypeDescription()
CompilerType GetArrayElementType(ExecutionContextScope *exe_scope) const
Creating related types.
bool IsInteger() const
This is used when you don't care about the signedness of the integer.
CompilerType GetPointeeType() const
If this type is a pointer type, return the type that the pointer points to, else return an invalid ty...
uint32_t GetTypeInfo(CompilerType *pointee_or_element_compiler_type=nullptr) const
bool CompareTypes(CompilerType rhs) const
llvm::Expected< uint64_t > GetBitSize(ExecutionContextScope *exe_scope) const
Return the size of the type in bits.
bool IsScalarType() const
bool IsNullPtrType() const
CompilerType GetCanonicalType() const
bool IsPointerType(CompilerType *pointee_type=nullptr) const
A uniqued constant string class.
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
virtual void CalculateExecutionContext(ExecutionContext &exe_ctx)=0
Reconstruct the object's execution context into sc.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
void TruncOrExtendTo(uint16_t bits, bool sign)
Convert to an integer with bits and the given signedness.
bool Fail() const
Test for error condition.
bool Success() const
Test for success condition.
const char * GetData() const
Defines a symbol context baton that can be handed other debug core functions.
llvm::StringRef GetInstanceVariableName()
Determines the name of the instance variable for the this decl context.
CompileUnit * comp_unit
The CompileUnit for a given query.
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, lldb::RegisterContextSP ®_ctx_sp, const RegisterInfo *reg_info)
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope, const lldb::VariableSP &var_sp)
static lldb::ValueObjectSP CreateValueObjectFromBool(lldb::TargetSP target, bool value, llvm::StringRef name)
Create a value object containing the given boolean value.
static lldb::ValueObjectSP CreateValueObjectFromAddress(llvm::StringRef name, uint64_t address, const ExecutionContext &exe_ctx, CompilerType type, bool do_deref=true)
Given an address either create a value object containing the value at that address,...
lldb::addr_t GetLoadAddress()
Return the target load address associated with this value object.
static lldb::ValueObjectSP CreateValueObjectFromScalar(lldb::TargetSP target, Scalar &s, CompilerType type, llvm::StringRef name)
Create a value object containing the given Scalar value.
CompilerType GetCompilerType()
The rest of the classes in this file, except for the Visitor class at the very end,...
uint32_t GetLocation() const
virtual llvm::Expected< lldb::ValueObjectSP > Accept(Visitor *v) const =0
ASTNode & GetBase() const
ASTNode & GetIndex() const
BinaryOpKind GetKind() const
ASTNode & GetOperand() const
CompilerType GetType() const
const llvm::APFloat & GetValue() const
std::string GetName() const
uint32_t GetRadix() const
IntegerTypeSuffix GetTypeSuffix() const
const llvm::APInt & GetValue() const
std::shared_ptr< StackFrame > m_exe_ctx_scope
llvm::Expected< lldb::ValueObjectSP > Evaluate(const ASTNode &node)
Evaluate an ASTNode.
llvm::Expected< lldb::ValueObjectSP > EvaluateBinaryAddition(lldb::ValueObjectSP lhs, lldb::ValueObjectSP rhs, uint32_t location)
llvm::Expected< lldb::ValueObjectSP > EvaluateAndDereference(const ASTNode &node)
Evaluate an ASTNode.
llvm::Expected< lldb::ValueObjectSP > EvaluateScalarOp(BinaryOpKind kind, lldb::ValueObjectSP lhs, lldb::ValueObjectSP rhs, CompilerType result_type, uint32_t location)
llvm::Expected< CompilerType > PromoteSignedInteger(CompilerType &lhs_type, CompilerType &rhs_type)
If lhs_type is unsigned and rhs_type is signed, check whether it can represent all of the values of l...
llvm::Expected< lldb::ValueObjectSP > EvaluateBinarySubtraction(lldb::ValueObjectSP lhs, lldb::ValueObjectSP rhs, uint32_t location)
Interpreter(lldb::TargetSP target, llvm::StringRef expr, std::shared_ptr< StackFrame > frame_sp, lldb::DynamicValueType use_dynamic, bool use_synthetic, bool fragile_ivar, bool check_ptr_vs_member)
llvm::Expected< lldb::ValueObjectSP > UnaryConversion(lldb::ValueObjectSP valobj, uint32_t location)
Perform usual unary conversions on a value.
llvm::Expected< lldb::ValueObjectSP > Visit(const IdentifierNode &node) override
bool m_check_ptr_vs_member
llvm::Expected< CompilerType > PickIntegerType(lldb::TypeSystemSP type_system, std::shared_ptr< ExecutionContextScope > ctx, const IntegerLiteralNode &literal)
lldb::DynamicValueType m_use_dynamic
llvm::Expected< CompilerType > ArithmeticConversion(lldb::ValueObjectSP &lhs, lldb::ValueObjectSP &rhs, uint32_t location)
Perform an arithmetic conversion on two values from an arithmetic operation.
llvm::Expected< CastKind > VerifyCastType(lldb::ValueObjectSP operand, CompilerType source_type, CompilerType target_type, int location)
As a preparation for type casting, compare the requested 'target' type of the cast with the type of t...
llvm::Expected< CastKind > VerifyArithmeticCast(CompilerType source_type, CompilerType target_type, int location)
A helper function for VerifyCastType (below).
llvm::StringRef GetFieldName() const
ASTNode & GetBase() const
UnaryOpKind GetKind() const
ASTNode & GetOperand() const
CastKind
The type casts allowed by DIL.
@ eEnumeration
Casting from a scalar to an enumeration type.
@ ePointer
Casting to a pointer type.
@ eNone
Invalid promotion type (results in error).
@ eArithmetic
Casting to a scalar.
static lldb::BasicType BasicTypeToUnsigned(lldb::BasicType basic_type)
llvm::Expected< lldb::TypeSystemSP > GetTypeSystemFromCU(std::shared_ptr< StackFrame > ctx)
lldb::ValueObjectSP GetDynamicOrSyntheticValue(lldb::ValueObjectSP value_sp, lldb::DynamicValueType use_dynamic, bool use_synthetic)
static CompilerType GetBasicType(lldb::TypeSystemSP type_system, lldb::BasicType basic_type)
static lldb::ValueObjectSP ArrayToPointerConversion(ValueObject &valobj, ExecutionContextScope &ctx, llvm::StringRef name)
BinaryOpKind
The binary operators recognized by DIL.
static size_t ConversionRank(CompilerType type)
Basic types with a lower rank are converted to the basic type with a higher rank.
static lldb::VariableSP DILFindVariable(ConstString name, VariableList &variable_list)
lldb::ValueObjectSP LookupGlobalIdentifier(llvm::StringRef name_ref, std::shared_ptr< StackFrame > frame_sp, lldb::TargetSP target_sp, lldb::DynamicValueType use_dynamic)
Given the name of an identifier, check to see if it matches the name of a global variable.
lldb::ValueObjectSP LookupIdentifier(llvm::StringRef name_ref, std::shared_ptr< StackFrame > frame_sp, lldb::DynamicValueType use_dynamic)
Given the name of an identifier (variable name, member name, type name, etc.), find the ValueObject f...
std::shared_ptr< lldb_private::TypeSystem > TypeSystemSP
BasicType
Basic types enumeration for the public API SBType::GetBasicType().
@ eBasicTypeUnsignedShort
@ eBasicTypeUnsignedInt128
@ eBasicTypeUnsignedLongLong
std::shared_ptr< lldb_private::ValueObject > ValueObjectSP
@ eLanguageTypeObjC
Objective-C.
std::shared_ptr< lldb_private::VariableList > VariableListSP
std::shared_ptr< lldb_private::Variable > VariableSP
std::shared_ptr< lldb_private::Target > TargetSP
std::shared_ptr< lldb_private::RegisterContext > RegisterContextSP
Every register is described in detail including its name, alternate name (optional),...