23#include "llvm/Support/ErrorExtras.h"
24#include "llvm/Support/FormatAdapters.h"
32 return type_system.get()->GetBasicTypeFromAST(basic_type);
39 llvm::StringRef name) {
49static llvm::Expected<lldb::LanguageType>
54 return llvm::createStringErrorV(
"no compile unit for frame: {}",
64 return llvm::createStringErrorV(
"no compile unit for frame: {}",
69 return symbol_context.
module_sp->GetTypeSystemForLanguage(language);
72llvm::Expected<lldb::ValueObjectSP>
75 return llvm::make_error<DILDiagnosticError>(
m_expr,
"invalid value object",
77 llvm::Expected<lldb::TypeSystemSP> type_system =
80 return type_system.takeError();
83 if (valobj->IsBitfield()) {
88 uint32_t bitfield_size = valobj->GetBitfieldBitSize();
91 if (bitfield_size > 0 && in_type.
IsInteger()) {
95 llvm::Expected<uint64_t> int_bit_size =
98 return int_bit_size.takeError();
99 llvm::Expected<uint64_t> uint_bit_size =
102 return uint_bit_size.takeError();
103 if (bitfield_size < *int_bit_size ||
104 (in_type.
IsSigned() && bitfield_size == *int_bit_size)) {
105 auto result = valobj->CastToBasicType(int_type);
106 if (result->GetError().Fail())
107 return llvm::make_error<DILDiagnosticError>(
108 m_expr, result->GetError().AsCString(), location);
111 if (bitfield_size <= *uint_bit_size) {
112 auto result = valobj->CastToBasicType(uint_type);
113 if (result->GetError().Fail())
114 return llvm::make_error<DILDiagnosticError>(
115 m_expr, result->GetError().AsCString(), location);
120 bool resolved = valobj->ResolveValue(scalar);
122 return llvm::createStringError(
"invalid scalar value");
132 valobj->GetCompilerType().GetPromotedIntegerType();
134 auto result = valobj->CastToBasicType(promoted_type);
135 if (result->GetError().Fail())
136 return llvm::make_error<DILDiagnosticError>(
137 m_expr, result->GetError().AsCString(), location);
184 switch (basic_type) {
203llvm::Expected<CompilerType>
210 return lhs_size.takeError();
213 return rhs_size.takeError();
215 if (*rhs_size == *lhs_size) {
216 llvm::Expected<lldb::TypeSystemSP> type_system =
219 return type_system.takeError();
224 return r_type_unsigned;
230llvm::Expected<CompilerType>
236 return lhs_or_err.takeError();
240 return rhs_or_err.takeError();
256 if (l_rank == 0 || r_rank == 0)
257 return llvm::make_error<DILDiagnosticError>(
258 m_expr,
"unexpected basic type in arithmetic operation", location);
263 using Rank = std::tuple<size_t, bool>;
264 Rank int_l_rank = {l_rank, !lhs_type.
IsSigned()};
265 Rank int_r_rank = {r_rank, !rhs_type.
IsSigned()};
266 if (int_l_rank < int_r_rank) {
269 return type_or_err.takeError();
272 if (int_l_rank > int_r_rank) {
275 return type_or_err.takeError();
290 std::vector<lldb::VariableSP> possible_matches;
293 llvm::StringRef str_ref_name = var_sp->GetName().GetStringRef();
295 str_ref_name.consume_front(
"::");
301 if (var_sp->NameMatches(name))
302 possible_matches.push_back(var_sp);
306 if (possible_matches.size() > 0)
307 return possible_matches[0];
323 name_ref.consume_front(
"::");
338 target_sp->GetImages().FindGlobalVariables(
339 ConstString(name_ref), std::numeric_limits<uint32_t>::max(),
342 if (!modules_var_list.
Empty()) {
358 if (name_ref.starts_with(
"$")) {
360 target_sp->GetPersistentExpressionStateForLanguage(language))
361 if (
auto var_sp = state->GetVariable(name_ref))
362 if (
auto valobj_sp = var_sp->GetValueObject())
373 if (name_ref.consume_front(
"$")) {
378 if (
const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName(name_ref))
384 if (!name_ref.contains(
"::")) {
393 variable_list->FindVariable(
ConstString(name_ref));
404 lldb::eSymbolContextFunction | lldb::eSymbolContextBlock);
408 value_sp = value_sp->GetChildMemberWithName(name_ref);
418 if (name_ref.contains(
"::")) {
419 llvm::StringRef enum_typename, enumerator_name;
422 std::tie(enum_typename, enumerator_name) = name_ref.rsplit(
"::");
427 const llvm::APSInt &value) ->
bool {
428 if (name == enumerator_name) {
431 enum_type,
"result");
447 const bool check_ptr_vs_member =
449 const bool no_synth_child =
451 const bool allow_var_updates =
453 const bool disallow_globals =
464 auto value_or_error = node.
Accept(
this);
466 if (value_or_error && !*value_or_error)
467 return llvm::make_error<DILDiagnosticError>(
m_expr,
"invalid value object",
471 return value_or_error;
474llvm::Expected<lldb::ValueObjectSP>
476 auto valobj_or_err =
Evaluate(node);
478 return valobj_or_err;
482 if (valobj->GetCompilerType().IsReferenceType()) {
483 valobj = valobj->Dereference(
error);
485 return error.ToError();
490llvm::Expected<lldb::ValueObjectSP>
504 if (!identifier && node.
GetName()[0] ==
'$') {
507 return language.takeError();
512 if (!identifier && node.
GetName() ==
"nullptr") {
515 llvm::Expected<lldb::TypeSystemSP> type_system =
518 return type_system.takeError();
519 type_system.get()->GetPointerByteSize();
520 llvm::APInt value(type_system.get()->GetPointerByteSize() * CHAR_BIT, 0);
529 llvm::formatv(
"use of undeclared identifier '{0}'", node.
GetName());
530 return llvm::make_error<DILDiagnosticError>(
537llvm::Expected<lldb::ValueObjectSP>
550 operand = dynamic_op;
556 child_sp = synth_obj_sp->Dereference(
error);
560 return llvm::make_error<DILDiagnosticError>(
m_expr,
error.AsCString(),
569 return llvm::make_error<DILDiagnosticError>(
m_expr,
error.AsCString(),
575 if (operand->GetCompilerType().IsReferenceType()) {
576 operand = operand->Dereference(
error);
578 return error.ToError();
580 llvm::Expected<lldb::ValueObjectSP> conv_op =
588 llvm::formatv(
"invalid argument type '{0}' to unary expression",
590 return llvm::make_error<DILDiagnosticError>(
m_expr, errMsg,
594 bool resolved = operand->ResolveValue(scalar);
601 m_stack_frame, scalar, operand->GetCompilerType(),
"result");
605 if (operand->GetCompilerType().IsReferenceType()) {
606 operand = operand->Dereference(
error);
608 return error.ToError();
610 llvm::Expected<lldb::ValueObjectSP> conv_op =
620 llvm::formatv(
"invalid argument type '{0}' to unary expression",
622 return llvm::make_error<DILDiagnosticError>(
m_expr, errMsg,
628 if (operand->GetCompilerType().IsReferenceType()) {
629 operand = operand->Dereference(
error);
631 return error.ToError();
633 llvm::Expected<lldb::ValueObjectSP> conv_op =
641 llvm::formatv(
"invalid argument type '{0}' to unary expression",
643 return llvm::make_error<DILDiagnosticError>(
m_expr, errMsg,
647 bool resolved = operand->ResolveValue(scalar);
649 std::string errMsg = llvm::formatv(
"invalid operand value: {0}",
650 operand->GetError().AsCString());
651 return llvm::make_error<DILDiagnosticError>(
m_expr, errMsg,
658 m_stack_frame, scalar, operand->GetCompilerType(),
"result");
662 if (operand->GetCompilerType().IsReferenceType()) {
663 operand = operand->Dereference(
error);
665 return error.ToError();
670 llvm::formatv(
"invalid argument type '{0}' to unary expression",
672 return llvm::make_error<DILDiagnosticError>(
m_expr, errMsg,
675 llvm::Expected<lldb::TypeSystemSP> type_system =
678 return type_system.takeError();
679 auto value_or_err = operand->GetValueAsBool();
681 return value_or_err.takeError();
683 !(*value_or_err),
"result");
686 return llvm::make_error<DILDiagnosticError>(
m_expr,
"invalid unary operation",
690llvm::Expected<lldb::ValueObjectSP>
694 if (ptr->GetCompilerType().IsPointerToVoid())
695 return llvm::make_error<DILDiagnosticError>(
696 m_expr,
"arithmetic on a pointer to void", location);
697 if (ptr->GetValueAsUnsigned(0) == 0 && offset != 0)
698 return llvm::make_error<DILDiagnosticError>(
699 m_expr,
"arithmetic on a nullptr is undefined", location);
702 int64_t offset_int = offset->GetValueAsSigned(0, &success);
704 std::string errMsg = llvm::formatv(
"could not get the offset: {0}",
705 offset->GetError().AsCString());
706 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(errMsg),
710 llvm::Expected<uint64_t> byte_size =
711 ptr->GetCompilerType().GetPointeeType().GetByteSize(&
m_stack_frame);
713 return byte_size.takeError();
714 uint64_t ptr_addr = ptr->GetValueAsUnsigned(0);
716 ptr_addr -= offset_int * (*byte_size);
718 ptr_addr += offset_int * (*byte_size);
726llvm::Expected<lldb::ValueObjectSP>
731 bool l_resolved = lhs->ResolveValue(
l);
734 llvm::formatv(
"invalid lhs value: {0}", lhs->GetError().AsCString());
735 return llvm::make_error<DILDiagnosticError>(
m_expr, errMsg, location);
737 bool r_resolved = rhs->ResolveValue(r);
740 llvm::formatv(
"invalid rhs value: {0}", rhs->GetError().AsCString());
741 return llvm::make_error<DILDiagnosticError>(
m_expr, errMsg, location);
744 auto value_object = [
this, result_type](
Scalar scalar) {
746 result_type,
"result");
751 return value_object(
l + r);
753 return value_object(
l - r);
755 return value_object(
l * r);
757 return value_object(
l / r);
759 return value_object(
l % r);
761 return value_object(
l & r);
763 return value_object(
l ^ r);
765 return value_object(
l | r);
767 return value_object(
l << r);
769 return value_object(
l >> r);
771 return value_object(
l < r);
773 return value_object(
l > r);
775 return value_object(
l <= r);
777 return value_object(
l >= r);
779 return value_object(
l == r);
781 return value_object(
l != r);
785 return llvm::make_error<DILDiagnosticError>(
786 m_expr,
"invalid arithmetic operation", location);
795 auto orig_lhs_type = lhs->GetCompilerType();
796 auto orig_rhs_type = rhs->GetCompilerType();
799 return type_or_err.takeError();
808 if (lhs->GetCompilerType().IsPointerType()) {
811 }
else if (rhs->GetCompilerType().IsPointerType()) {
816 if (!ptr || !offset->GetCompilerType().IsInteger()) {
818 llvm::formatv(
"invalid operands to binary expression ('{0}' and '{1}')",
819 orig_lhs_type.GetTypeName(), orig_rhs_type.GetTypeName());
820 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(errMsg),
833 auto orig_lhs_type = lhs->GetCompilerType();
834 auto orig_rhs_type = rhs->GetCompilerType();
837 return type_or_err.takeError();
843 auto lhs_type = lhs->GetCompilerType();
844 auto rhs_type = rhs->GetCompilerType();
847 if (lhs_type.IsPointerType() && rhs_type.IsInteger())
851 if (lhs_type.IsPointerType() && rhs_type.IsPointerType()) {
852 if (lhs_type.IsPointerToVoid() && rhs_type.IsPointerToVoid()) {
853 return llvm::make_error<DILDiagnosticError>(
854 m_expr,
"arithmetic on pointers to void", location);
859 if (!lhs_unqualified_type.
CompareTypes(rhs_unqualified_type)) {
860 std::string errMsg = llvm::formatv(
861 "'{0}' and '{1}' are not pointers to compatible types",
862 orig_lhs_type.GetTypeName(), orig_rhs_type.GetTypeName());
863 return llvm::make_error<DILDiagnosticError>(
m_expr, errMsg, location);
866 llvm::Expected<uint64_t> lhs_byte_size =
869 return lhs_byte_size.takeError();
871 int64_t item_size = *lhs_byte_size;
872 int64_t diff =
static_cast<int64_t
>(lhs->GetValueAsUnsigned(0) -
873 rhs->GetValueAsUnsigned(0));
874 assert(item_size > 0 &&
"Pointee size cannot be 0");
875 if (diff % item_size != 0) {
878 return llvm::make_error<DILDiagnosticError>(
879 m_expr,
"undefined pointer arithmetic", location);
883 llvm::Expected<lldb::TypeSystemSP> type_system =
886 return type_system.takeError();
887 CompilerType ptrdiff_type = type_system.get()->GetPointerDiffType(
true);
889 return llvm::make_error<DILDiagnosticError>(
890 m_expr,
"unable to determine pointer diff type", location);
894 ptrdiff_type,
"result");
898 llvm::formatv(
"invalid operands to binary expression ('{0}' and '{1}')",
899 orig_lhs_type.GetTypeName(), orig_rhs_type.GetTypeName());
900 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(errMsg),
908 auto orig_lhs_type = lhs->GetCompilerType();
909 auto orig_rhs_type = rhs->GetCompilerType();
912 return type_or_err.takeError();
917 llvm::formatv(
"invalid operands to binary expression ('{0}' and '{1}')",
918 orig_lhs_type.GetTypeName(), orig_rhs_type.GetTypeName());
919 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(errMsg),
930 auto orig_lhs_type = lhs->GetCompilerType();
931 auto orig_rhs_type = rhs->GetCompilerType();
934 return type_or_err.takeError();
939 llvm::formatv(
"invalid operands to binary expression ('{0}' and '{1}')",
940 orig_lhs_type.GetTypeName(), orig_rhs_type.GetTypeName());
941 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(errMsg),
946 if (result_type.
IsInteger() && rhs->GetValueAsSigned(-1) == 0) {
947 return llvm::make_error<DILDiagnosticError>(
948 m_expr,
"division by zero is undefined", location);
958 auto orig_lhs_type = lhs->GetCompilerType();
959 auto orig_rhs_type = rhs->GetCompilerType();
962 return type_or_err.takeError();
967 llvm::formatv(
"invalid operands to binary expression ('{0}' and '{1}')",
968 orig_lhs_type.GetTypeName(), orig_rhs_type.GetTypeName());
969 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(errMsg),
973 if (rhs->GetValueAsSigned(-1) == 0) {
974 return llvm::make_error<DILDiagnosticError>(
975 m_expr,
"division by zero is undefined", location);
991 return llvm::createStringError(
992 "Illegal type for lhs of assignment (not scalar numeric type)");
997 return llvm::createStringError(
998 "Illegal type for rhs of assignment (not scalar numeric type)");
1003 return llvm::createStringError(
1004 "Invalid assignment: Can only assign pointers to pointers");
1009 lhs_type != rhs_type) {
1010 std::string err_msg =
1011 llvm::formatv(
"Incompatible types for assignment: Cannot assign {0} "
1014 return llvm::createStringError(err_msg);
1020llvm::Expected<lldb::ValueObjectSP>
1025 if (llvm::Error err = lhs->CanSetValue())
1031 return all_ok.takeError();
1040 bool is_zero = val->GetValueAsUnsigned(-1) == 0;
1041 bool is_boolean = val->GetCompilerType().IsBoolean();
1042 return is_zero && !is_boolean && is_literal;
1048 bool rhs_is_literal, uint32_t location) {
1049 auto orig_lhs_type = lhs->GetCompilerType();
1050 auto orig_rhs_type = rhs->GetCompilerType();
1054 bool lhs_nullptr_or_zero =
1055 orig_lhs_type.IsNullPtrType() ||
IsLiteralZero(lhs, lhs_is_literal);
1056 bool rhs_nullptr_or_zero =
1057 orig_rhs_type.IsNullPtrType() ||
IsLiteralZero(rhs, rhs_is_literal);
1059 if (orig_lhs_type.IsArrayType())
1061 if (orig_rhs_type.IsArrayType())
1067 if (lhs_type == rhs_type)
1068 return llvm::Error::success();
1078 lhs_child = lhs->GetChildAtIndex(0);
1079 if (lhs_child && (lhs_child->IsPointerType() ||
1080 lhs_child->GetCompilerType().IsNullPtrType()))
1081 lhs_type = lhs_child->GetCompilerType();
1087 rhs_child = rhs->GetChildAtIndex(0);
1088 if (rhs_child && (rhs_child->IsPointerType() ||
1089 rhs_child->GetCompilerType().IsNullPtrType()))
1090 rhs_type = rhs_child->GetCompilerType();
1093 if ((lhs_type != orig_lhs_type) || (rhs_type != orig_rhs_type)) {
1095 return llvm::Error::success();
1099 return llvm::Error::success();
1107 return llvm::Error::success();
1111 bool comparable = lhs_unqualified.
CompareTypes(rhs_unqualified);
1113 return llvm::Error::success();
1115 std::string errMsg = llvm::formatv(
1116 "comparison of distinct pointer types ({0} and {1})",
1117 orig_lhs_type.TypeDescription(), orig_rhs_type.TypeDescription());
1118 return llvm::make_error<DILDiagnosticError>(
m_expr, errMsg, location);
1121 if (!is_ordered && ((orig_lhs_type.IsNullPtrType() && rhs_nullptr_or_zero) ||
1122 (lhs_nullptr_or_zero && orig_rhs_type.IsNullPtrType())))
1123 return llvm::Error::success();
1130 return type_or_err.takeError();
1132 lhs_type = lhs->GetCompilerType();
1133 rhs_type = rhs->GetCompilerType();
1136 return llvm::Error::success();
1142 return llvm::Error::success();
1143 std::string errMsg = llvm::formatv(
1144 "invalid operands to binary expression ({0} and {1})",
1145 orig_lhs_type.TypeDescription(), orig_rhs_type.TypeDescription());
1146 return llvm::make_error<DILDiagnosticError>(
m_expr, errMsg, location);
1155 return t.IsPointerType() || t.IsInteger() ||
1156 t.IsUnscopedEnumerationType() || (!is_ordered && t.IsNullPtrType());
1159 if ((lhs_type.
IsPointerType() && comparable_to_pointer(rhs_type)) ||
1160 (comparable_to_pointer(lhs_type) && rhs_type.
IsPointerType())) {
1169 bool comparable = lhs_unqualified_type.
CompareTypes(rhs_unqualified_type);
1173 std::string errMsg = llvm::formatv(
1174 "comparison of distinct pointer types ({0} and {1})",
1175 orig_lhs_type.TypeDescription(), orig_rhs_type.TypeDescription());
1176 return llvm::make_error<DILDiagnosticError>(
m_expr, errMsg, location);
1180 return llvm::Error::success();
1183 std::string errMsg = llvm::formatv(
1184 "invalid operands to binary expression ({0} and {1})",
1185 orig_lhs_type.TypeDescription(), orig_rhs_type.TypeDescription());
1186 return llvm::make_error<DILDiagnosticError>(
m_expr, errMsg, location);
1189llvm::Expected<lldb::ValueObjectSP>
1192 bool rhs_is_literal, uint32_t location) {
1202 rhs_is_literal, location))
1205 llvm::Expected<lldb::TypeSystemSP> type_system =
1208 return type_system.takeError();
1214llvm::Expected<lldb::ValueObjectSP>
1219 auto orig_lhs_type = lhs->GetCompilerType();
1220 auto orig_rhs_type = rhs->GetCompilerType();
1223 return type_or_err.takeError();
1227 std::string errMsg =
1228 llvm::formatv(
"invalid operands to binary expression ('{0}' and '{1}')",
1229 orig_lhs_type.GetTypeName(), orig_rhs_type.GetTypeName());
1230 return llvm::make_error<DILDiagnosticError>(
m_expr, errMsg, location);
1236llvm::Expected<lldb::ValueObjectSP>
1245 return lhs_or_err.takeError();
1249 return rhs_or_err.takeError();
1255 std::string errMsg =
1256 llvm::formatv(
"invalid operands to binary expression ('{0}' and '{1}')",
1258 return llvm::make_error<DILDiagnosticError>(
m_expr, errMsg, location);
1262 uint64_t amount = rhs->GetValueAsUnsigned(0, &success);
1264 return llvm::make_error<DILDiagnosticError>(
1265 m_expr,
"could not get the shift amount as an integer", location);
1268 return lhs_size.takeError();
1269 if (amount >= *lhs_size)
1270 return llvm::make_error<DILDiagnosticError>(
m_expr,
"invalid shift amount",
1276llvm::Expected<lldb::ValueObjectSP>
1286 auto lhs_type = lhs->GetCompilerType();
1287 if (!lhs_type.IsContextuallyConvertibleToBool()) {
1288 std::string errMsg = llvm::formatv(
1289 "value of type {0} is not contextually convertible to 'bool'",
1290 lhs_type.TypeDescription());
1291 return llvm::make_error<DILDiagnosticError>(
m_expr, errMsg,
1294 llvm::Expected<lldb::TypeSystemSP> type_system =
1297 return type_system.takeError();
1301 auto lvalue_or_err = lhs->GetValueAsBool();
1303 return lvalue_or_err.takeError();
1304 bool lhs_val = *lvalue_or_err;
1315 auto rhs_type = rhs->GetCompilerType();
1316 if (!rhs_type.IsContextuallyConvertibleToBool()) {
1317 std::string errMsg = llvm::formatv(
1318 "value of type {0} is not contextually convertible to 'bool'",
1319 rhs_type.TypeDescription());
1320 return llvm::make_error<DILDiagnosticError>(
m_expr, errMsg,
1324 auto rvalue_or_err = rhs->GetValueAsBool();
1326 return rvalue_or_err.takeError();
1328 *rvalue_or_err,
"result");
1331llvm::Expected<lldb::ValueObjectSP>
1350 lhs->GetCompilerType().GetTypeSystem().GetSharedPointer();
1352 rhs->GetCompilerType().GetTypeSystem().GetSharedPointer();
1353 if (lhs_system->GetPluginName() != rhs_system->GetPluginName()) {
1355 return llvm::make_error<DILDiagnosticError>(
1457 return llvm::make_error<DILDiagnosticError>(
1461llvm::Expected<lldb::ValueObjectSP>
1473 if (!base->IsPointerType() && base->HasSyntheticValue()) {
1476 base->GetSyntheticValue()->Dereference(deref_error);
1477 synth_deref_sp && deref_error.
Success()) {
1478 base = std::move(synth_deref_sp);
1480 if (!base || deref_error.
Fail()) {
1481 std::string errMsg = llvm::formatv(
1482 "Failed to dereference synthetic value: {0}", deref_error);
1483 return llvm::make_error<DILDiagnosticError>(
1489 std::string errMsg =
"Failed to dereference synthetic value";
1490 return llvm::make_error<DILDiagnosticError>(
1493 expr_is_ptr =
false;
1498 bool base_is_ptr = base->IsPointerType();
1500 if (expr_is_ptr != base_is_ptr) {
1502 std::string errMsg =
1503 llvm::formatv(
"member reference type {0} is a pointer; "
1504 "did you mean to use '->'?",
1505 base->GetCompilerType().TypeDescription());
1506 return llvm::make_error<DILDiagnosticError>(
1509 std::string errMsg =
1510 llvm::formatv(
"member reference type {0} is not a pointer; "
1511 "did you mean to use '.'?",
1512 base->GetCompilerType().TypeDescription());
1513 return llvm::make_error<DILDiagnosticError>(
1523 field_obj = base->GetSyntheticValue();
1525 field_obj = field_obj->GetChildMemberWithName(node.
GetFieldName());
1529 std::string errMsg = llvm::formatv(
1530 "\"{0}\" is not a member of \"({1}) {2}\"", node.
GetFieldName(),
1531 base->GetTypeName().AsCString(
"<invalid type>"), base->GetName());
1532 return llvm::make_error<DILDiagnosticError>(
1542 field_obj = dynamic_val_sp;
1548 if (node.
GetIsArrow() && base->IsPointerType())
1550 std::string errMsg = llvm::formatv(
1551 "\"{0}\" is not a member of \"({1}) {2}\"", node.
GetFieldName(),
1552 base->GetTypeName().AsCString(
"<invalid type>"), base->GetName());
1553 return llvm::make_error<DILDiagnosticError>(
1557llvm::Expected<lldb::ValueObjectSP>
1564 if (!idx->GetCompilerType().IsIntegerOrUnscopedEnumerationType()) {
1565 return llvm::make_error<DILDiagnosticError>(
1570 uint64_t child_idx = idx->GetValueAsUnsigned(0);
1578 CompilerType base_type = base->GetCompilerType().GetNonReferenceType();
1579 base->GetExpressionPath(var_expr_path_strm);
1580 bool is_incomplete_array =
false;
1582 bool is_objc_pointer =
true;
1585 is_objc_pointer =
false;
1586 else if (!base->GetCompilerType().IsPointerType())
1587 is_objc_pointer =
false;
1590 std::string err_msg = llvm::formatv(
1591 "\"({0}) {1}\" is an Objective-C pointer, and cannot be subscripted",
1592 base->GetTypeName().AsCString(
"<invalid type>"),
1593 var_expr_path_strm.
GetData());
1594 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(err_msg),
1597 if (is_objc_pointer) {
1599 if (!synthetic || synthetic == base) {
1600 std::string err_msg =
1601 llvm::formatv(
"\"({0}) {1}\" is not an array type",
1602 base->GetTypeName().AsCString(
"<invalid type>"),
1603 var_expr_path_strm.
GetData());
1604 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(err_msg),
1607 if (
static_cast<uint32_t
>(child_idx) >=
1608 synthetic->GetNumChildrenIgnoringErrors()) {
1609 std::string err_msg = llvm::formatv(
1610 "array index {0} is not valid for \"({1}) {2}\"", child_idx,
1611 base->GetTypeName().AsCString(
"<invalid type>"),
1612 var_expr_path_strm.
GetData());
1613 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(err_msg),
1616 child_valobj_sp = synthetic->GetChildAtIndex(child_idx);
1617 if (!child_valobj_sp) {
1618 std::string err_msg = llvm::formatv(
1619 "array index {0} is not valid for \"({1}) {2}\"", child_idx,
1620 base->GetTypeName().AsCString(
"<invalid type>"),
1621 var_expr_path_strm.
GetData());
1622 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(err_msg),
1626 if (
auto dynamic_sp = child_valobj_sp->GetDynamicValue(
m_use_dynamic))
1627 child_valobj_sp = std::move(dynamic_sp);
1629 return child_valobj_sp;
1632 child_valobj_sp = base->GetSyntheticArrayMember(child_idx,
true);
1633 if (!child_valobj_sp) {
1634 std::string err_msg = llvm::formatv(
1635 "failed to use pointer as array for index {0} for "
1637 child_idx, base->GetTypeName().AsCString(
"<invalid type>"),
1638 var_expr_path_strm.
GetData());
1640 err_msg =
"subscript of pointer to incomplete type 'void'";
1641 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(err_msg),
1644 }
else if (base_type.
IsArrayType(
nullptr,
nullptr, &is_incomplete_array)) {
1645 child_valobj_sp = base->GetChildAtIndex(child_idx);
1647 child_valobj_sp = base->GetSyntheticArrayMember(child_idx,
true);
1648 if (!child_valobj_sp) {
1649 std::string err_msg = llvm::formatv(
1650 "array index {0} is not valid for \"({1}) {2}\"", child_idx,
1651 base->GetTypeName().AsCString(
"<invalid type>"),
1652 var_expr_path_strm.
GetData());
1653 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(err_msg),
1658 base->GetSyntheticBitFieldChild(child_idx, child_idx,
true);
1659 if (!child_valobj_sp) {
1660 std::string err_msg = llvm::formatv(
1661 "bitfield range {0}:{1} is not valid for \"({2}) {3}\"", child_idx,
1662 child_idx, base->GetTypeName().AsCString(
"<invalid type>"),
1663 var_expr_path_strm.
GetData());
1664 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(err_msg),
1670 std::string err_msg =
1671 llvm::formatv(
"\"{0}\" is not an array type",
1672 base->GetTypeName().AsCString(
"<invalid type>"));
1673 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(err_msg),
1676 if (
static_cast<uint32_t
>(child_idx) >=
1677 synthetic->GetNumChildrenIgnoringErrors(child_idx + 1)) {
1678 std::string err_msg = llvm::formatv(
1679 "array index {0} is not valid for \"({1}) {2}\"", child_idx,
1680 base->GetTypeName().AsCString(
"<invalid type>"),
1681 var_expr_path_strm.
GetData());
1682 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(err_msg),
1685 child_valobj_sp = synthetic->GetChildAtIndex(child_idx);
1686 if (!child_valobj_sp) {
1687 std::string err_msg = llvm::formatv(
1688 "array index {0} is not valid for \"({1}) {2}\"", child_idx,
1689 base->GetTypeName().AsCString(
"<invalid type>"),
1690 var_expr_path_strm.
GetData());
1691 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(err_msg),
1696 if (child_valobj_sp) {
1698 if (
auto dynamic_sp = child_valobj_sp->GetDynamicValue(
m_use_dynamic))
1699 child_valobj_sp = std::move(dynamic_sp);
1701 return child_valobj_sp;
1705 int64_t signed_child_idx = idx->GetValueAsSigned(0, &success);
1707 return llvm::make_error<DILDiagnosticError>(
1708 m_expr,
"could not get the index as an integer",
1710 return base->GetSyntheticArrayMember(signed_child_idx,
true);
1713llvm::Expected<lldb::ValueObjectSP>
1716 if (!first_idx_or_err)
1717 return first_idx_or_err;
1720 if (!last_idx_or_err)
1721 return last_idx_or_err;
1724 if (!first_idx->GetCompilerType().IsIntegerOrUnscopedEnumerationType() ||
1725 !last_idx->GetCompilerType().IsIntegerOrUnscopedEnumerationType()) {
1726 return llvm::make_error<DILDiagnosticError>(
1730 bool success_first, success_last;
1731 int64_t first_index = first_idx->GetValueAsSigned(0, &success_first);
1732 int64_t last_index = last_idx->GetValueAsSigned(0, &success_last);
1733 if (!success_first || !success_last)
1734 return llvm::make_error<DILDiagnosticError>(
1740 if (first_index < 0 || last_index < 0) {
1741 std::string message =
1742 llvm::formatv(
"bitfield range {0}:{1} is not valid (negative index)",
1743 first_index, last_index);
1744 return llvm::make_error<DILDiagnosticError>(
m_expr, message,
1749 if (first_index > last_index)
1750 std::swap(first_index, last_index);
1755 if (last_index - first_index >= 64) {
1756 std::string message =
1757 llvm::formatv(
"bitfield range {0}:{1} is not valid (more than 64 bits)",
1758 first_index, last_index);
1759 return llvm::make_error<DILDiagnosticError>(
m_expr, message,
1771 llvm::Expected<uint64_t> base_bit_size =
1774 return base_bit_size.takeError();
1775 if (
static_cast<uint64_t
>(last_index) >= *base_bit_size) {
1776 std::string message = llvm::formatv(
1777 "bitfield range {0}:{1} is not valid for \"({2}) {3}\"", first_index,
1778 last_index, base->GetTypeName().AsCString(
"<invalid type>"),
1779 base->GetName().GetStringRef());
1780 return llvm::make_error<DILDiagnosticError>(
m_expr, message,
1785 base->GetSyntheticBitFieldChild(first_index, last_index,
true);
1786 if (!child_valobj_sp) {
1787 std::string message = llvm::formatv(
1788 "bitfield range {0}:{1} is not valid for \"({2}) {3}\"", first_index,
1789 last_index, base->GetTypeName().AsCString(
"<invalid type>"),
1790 base->GetName().GetStringRef());
1791 return llvm::make_error<DILDiagnosticError>(
m_expr, message,
1794 return child_valobj_sp;
1797llvm::Expected<CompilerType>
1804 llvm::APInt apint = literal.
GetValue();
1806 llvm::SmallVector<std::pair<lldb::BasicType, lldb::BasicType>, 3> candidates;
1817 for (
auto [signed_, unsigned_] : candidates) {
1818 CompilerType signed_type = type_system->GetBasicTypeFromAST(signed_);
1821 llvm::Expected<uint64_t> size = signed_type.
GetBitSize(&ctx);
1823 return size.takeError();
1824 if (!literal.
IsUnsigned() && apint.isIntN(*size - 1))
1827 return type_system->GetBasicTypeFromAST(unsigned_);
1830 return llvm::make_error<DILDiagnosticError>(
1832 "integer literal is too large to be represented in any integer type",
1836llvm::Expected<lldb::ValueObjectSP>
1838 llvm::Expected<lldb::TypeSystemSP> type_system =
1841 return type_system.takeError();
1843 llvm::Expected<CompilerType> type =
1846 return type.takeError();
1851 llvm::Expected<uint64_t> type_bitsize = type->GetBitSize(&
m_stack_frame);
1853 return type_bitsize.takeError();
1857 if (type->IsSigned())
1863llvm::Expected<lldb::ValueObjectSP>
1865 llvm::Expected<lldb::TypeSystemSP> type_system =
1868 return type_system.takeError();
1871 &node.
GetValue().getSemantics() == &llvm::APFloat::IEEEsingle();
1877 return llvm::make_error<DILDiagnosticError>(
1885llvm::Expected<lldb::ValueObjectSP>
1888 llvm::Expected<lldb::TypeSystemSP> type_system =
1891 return type_system.takeError();
1896llvm::Expected<CastKind>
1901 if (target_type.
GetTypeInfo() & lldb::eTypeIsFloat) {
1902 std::string errMsg = llvm::formatv(
"Cast from {0} to {1} is not allowed",
1905 return llvm::make_error<DILDiagnosticError>(
1906 m_expr, std::move(errMsg), location,
1916 uint64_t type_byte_size = 0;
1917 uint64_t rhs_type_byte_size = 0;
1919 type_byte_size = *temp;
1921 std::string errMsg = llvm::formatv(
"unable to get byte size for type {0}",
1924 "GetByteSize failed: {0}");
1925 return llvm::make_error<DILDiagnosticError>(
1926 m_expr, std::move(errMsg), location,
1931 rhs_type_byte_size = *temp;
1933 std::string errMsg = llvm::formatv(
"unable to get byte size for type {0}",
1936 "GetByteSize failed: {0}");
1937 return llvm::make_error<DILDiagnosticError>(
1938 m_expr, std::move(errMsg), location,
1942 if (type_byte_size < rhs_type_byte_size) {
1943 std::string errMsg = llvm::formatv(
1944 "cast from pointer to smaller type {0} loses information",
1946 return llvm::make_error<DILDiagnosticError>(
1947 m_expr, std::move(errMsg), location,
1952 std::string errMsg = llvm::formatv(
"cannot convert {0} to {1}",
1956 return llvm::make_error<DILDiagnosticError>(
1957 m_expr, std::move(errMsg), location,
1963llvm::Expected<CastKind>
1974 std::string errMsg = llvm::formatv(
"Cast from {0} to {1} is not allowed",
1978 return llvm::make_error<DILDiagnosticError>(
1979 m_expr, std::move(errMsg), location,
1989 std::string errMsg = llvm::formatv(
1990 "cannot cast from type {0} to pointer type {1}",
1993 return llvm::make_error<DILDiagnosticError>(
1994 m_expr, std::move(errMsg), location,
2001 std::string errMsg = llvm::formatv(
2002 "casting of {0} to {1} is not implemented yet",
2004 return llvm::make_error<DILDiagnosticError>(
2005 m_expr, std::move(errMsg), location,
2012 if (!operand_or_err)
2013 return operand_or_err;
2023 operand->GetName().GetStringRef());
2024 op_type = operand->GetCompilerType();
2029 return type_or_err.takeError();
2032 if (operand->GetCompilerType().IsReferenceType()) {
2034 operand = operand->Dereference(
error);
2036 return llvm::make_error<DILDiagnosticError>(
m_expr,
error.AsCString(),
2041 switch (cast_kind) {
2046 result = operand->CastToEnumType(target_type);
2052 result = operand->CastToBasicType(target_type);
2057 ? operand->GetLoadAddress()
2058 : (op_type.
IsSigned() ? operand->GetValueAsSigned(0)
2059 : operand->GetValueAsUnsigned(0));
2060 llvm::StringRef name =
"result";
2074 if (result->GetError().Fail())
2075 return llvm::make_error<DILDiagnosticError>(
2080 std::string errMsg =
2081 llvm::formatv(
"unable to cast from '{0}' to '{1}'",
2083 return llvm::make_error<DILDiagnosticError>(
m_expr, std::move(errMsg),
2087llvm::Expected<lldb::ValueObjectSP>
2096 std::string errMsg = llvm::formatv(
2097 "value of type {0} is not contextually convertible to 'bool'",
2099 return llvm::make_error<DILDiagnosticError>(
m_expr, errMsg,
2104 auto value_or_err = condition->GetValueAsBool();
2106 if (*value_or_err) {
2110 return *true_or_err;
2114 return false_or_err;
2115 return *false_or_err;
2117 return value_or_err.takeError();
2128 return byte_size.takeError();
2136 if (arg->IsBitfield())
2137 return llvm::make_error<DILDiagnosticError>(
2138 m_expr,
"invalid application of 'sizeof' to bit-field",
2141 llvm::Expected<uint64_t> byte_size = arg->GetByteSize();
2143 return byte_size.takeError();
2147 llvm::Expected<lldb::TypeSystemSP> type_system =
2150 return type_system.takeError();
2151 CompilerType size_type = type_system.get()->GetSizeType();
2153 return llvm::make_error<DILDiagnosticError>(
2157 size_type,
"result");
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOG_ERROR(log, error,...)
lldb::VariableListSP GetVariableList(bool can_create)
Get the variable list for a compile unit.
lldb::LanguageType GetLanguage()
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
bool IsScalarOrUnscopedEnumerationType() const
CompilerType GetPointerType() const
Return a new CompilerType that is a pointer to this type.
bool IsContextuallyConvertibleToBool() const
This may only be defined in TypeSystemClang.
llvm::Expected< uint64_t > GetByteSize(ExecutionContextScope *exe_scope) const
Return the size of the type in bytes.
bool IsPointerToVoid() const
void ForEachEnumerator(std::function< bool(const CompilerType &integer_type, ConstString name, const llvm::APSInt &value)> const &callback) const
If this type is an enumeration, iterate through all of its enumerators using a callback.
bool IsIntegerOrEnumerationType(bool &is_signed) const
bool IsScopedEnumerationType() 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 GetFullyUnqualifiedType() const
CompilerType GetPointeeType() const
If this type is a pointer type, return the type that the pointer points to, else return an invalid ty...
bool IsUnscopedEnumerationType() const
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.
This base class provides an interface to stack frames.
@ eExpressionPathOptionCheckPtrVsMember
@ eExpressionPathOptionsDisallowGlobals
@ eExpressionPathOptionsAllowVarUpdates
@ eExpressionPathOptionsNoSyntheticChildren
virtual const char * GetFunctionName()
Get the frame's demangled name.
virtual lldb::RegisterContextSP GetRegisterContext()
Get the RegisterContext for this frame, if possible.
virtual lldb::ValueObjectSP GetValueObjectForFrameVariable(const lldb::VariableSP &variable_sp, lldb::DynamicValueType use_dynamic)
Create a ValueObject for a given Variable in this StackFrame.
virtual const SymbolContext & GetSymbolContext(lldb::SymbolContextItem resolve_scope)
Provide a SymbolContext for this StackFrame's current pc value.
virtual lldb::VariableListSP GetInScopeVariableList(bool get_file_globals, bool include_synthetic_vars=true, bool must_have_valid_location=false)
Retrieve the list of variables that are in scope at this StackFrame's pc.
virtual lldb::ValueObjectSP FindVariable(ConstString name)
Attempt to reconstruct the ValueObject for a variable with a given name from within the current Stack...
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 GetInstanceName()
Determines the name of the instance for this decl context.
lldb::ModuleSP module_sp
The Module for a given query.
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 CreateValueObjectFromScalar(const ExecutionContext &exe_ctx, Scalar &s, CompilerType type, llvm::StringRef name, ValueObject *parent=nullptr)
Create a value object containing the given Scalar value.
static lldb::ValueObjectSP CreateValueObjectFromBool(const ExecutionContext &exe_ctx, lldb::TypeSystemSP typesystem, bool value, llvm::StringRef name, ValueObject *parent=nullptr)
Create a value object containing the given boolean value.
lldb::addr_t GetLoadAddress()
Return the target load address associated with this value object.
CompilerType GetCompilerType()
static lldb::ValueObjectSP CreateValueObjectFromAddress(llvm::StringRef name, uint64_t address, const ExecutionContext &exe_ctx, CompilerType type, bool do_deref=true, ValueObject *parent=nullptr)
Given an address either create a value object containing the value at that address,...
The rest of the classes in this file, except for the Visitor class at the very end,...
uint32_t GetLocation() const
virtual bool IsConstLiteral() 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
ASTNode & GetFalseOperand() const
ASTNode & GetTrueOperand() const
ASTNode & GetCondition() const
const llvm::APFloat & GetValue() const
std::string GetName() const
uint32_t GetRadix() const
IntegerTypeSuffix GetTypeSuffix() const
const llvm::APInt & GetValue() const
llvm::Expected< lldb::ValueObjectSP > EvaluateBinaryRemainder(lldb::ValueObjectSP lhs, lldb::ValueObjectSP rhs, uint32_t location)
llvm::Error ValidateComparison(BinaryOpKind kind, lldb::ValueObjectSP &lhs, lldb::ValueObjectSP &rhs, bool lhs_is_literal, bool rhs_is_literal, uint32_t location)
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 > PointerOffset(lldb::ValueObjectSP ptr, lldb::ValueObjectSP offset, BinaryOpKind operation, uint32_t location)
Add or subtract the offset to the pointer according to the pointee type byte size.
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 > EvaluateBinaryShift(BinaryOpKind kind, lldb::ValueObjectSP lhs, lldb::ValueObjectSP rhs, uint32_t location)
llvm::Expected< lldb::ValueObjectSP > EvaluateLogical(const BinaryOpNode &node)
llvm::Expected< lldb::ValueObjectSP > EvaluateBinarySubtraction(lldb::ValueObjectSP lhs, lldb::ValueObjectSP rhs, uint32_t location)
llvm::Expected< lldb::ValueObjectSP > UnaryConversion(lldb::ValueObjectSP valobj, uint32_t location)
Perform usual unary conversions on a value.
llvm::Expected< lldb::ValueObjectSP > EvaluateComparison(BinaryOpKind kind, lldb::ValueObjectSP lhs, lldb::ValueObjectSP rhs, bool lhs_is_literal, bool rhs_is_literal, uint32_t location)
llvm::Expected< lldb::ValueObjectSP > Visit(const IdentifierNode &node) override
bool m_check_ptr_vs_member
llvm::Expected< lldb::ValueObjectSP > EvaluateBinaryDivision(lldb::ValueObjectSP lhs, lldb::ValueObjectSP rhs, uint32_t location)
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< lldb::ValueObjectSP > EvaluateBinaryMultiplication(lldb::ValueObjectSP lhs, lldb::ValueObjectSP rhs, uint32_t location)
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...
Interpreter(lldb::TargetSP target, llvm::StringRef expr, StackFrame &stack_frame, lldb::DynamicValueType use_dynamic, uint32_t options)
llvm::Expected< CompilerType > PickIntegerType(lldb::TypeSystemSP type_system, ExecutionContextScope &ctx, const IntegerLiteralNode &literal)
llvm::Expected< lldb::ValueObjectSP > EvaluateAssignment(lldb::ValueObjectSP lhs, lldb::ValueObjectSP rhs, uint32_t location)
llvm::Expected< CastKind > VerifyArithmeticCast(CompilerType source_type, CompilerType target_type, int location)
A helper function for VerifyCastType (below).
llvm::Expected< lldb::ValueObjectSP > EvaluateBinaryBitwise(BinaryOpKind kind, lldb::ValueObjectSP lhs, lldb::ValueObjectSP rhs, uint32_t location)
StackFrame & m_stack_frame
llvm::StringRef GetFieldName() const
ASTNode & GetBase() const
ASTNode & GetNodeArg() const
CompilerType GetTypeArg() 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.
lldb::ValueObjectSP LookupPersistentIdentifier(llvm::StringRef name_ref, StackFrame &stack_frame, lldb::TargetSP target_sp, lldb::LanguageType language)
Given the name of a persistent identifier (i.e., one that starts with a $), find the ValueObject for ...
static lldb::BasicType BasicTypeToUnsigned(lldb::BasicType basic_type)
static bool IsLiteralZero(lldb::ValueObjectSP &val, bool is_literal)
static llvm::Expected< lldb::TypeSystemSP > GetTypeSystemFromCU(StackFrame &ctx)
lldb::ValueObjectSP LookupIdentifier(llvm::StringRef name_ref, StackFrame &stack_frame, lldb::DynamicValueType use_dynamic)
Given the name of an identifier (variable name, member name, type name, etc.), find the ValueObject f...
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.
lldb::ValueObjectSP LookupGlobalIdentifier(llvm::StringRef name_ref, StackFrame &stack_frame, 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.
static llvm::Expected< bool > VerifyAssignmentTypes(CompilerType lhs_type, CompilerType rhs_type)
lldb::ValueObjectSP LookupEnumValue(llvm::StringRef name_ref, ExecutionContextScope &ctx_scope)
Given the name of an identifier, attempt to find an enumeration value.
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)
CompilerType ResolveTypeByName(const std::string &name, ExecutionContextScope &ctx_scope)
static bool HasFloatingRepresentation(CompilerType ct)
static llvm::Expected< lldb::LanguageType > GetSourceLanguageFromCU(StackFrame &ctx)
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
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
LanguageType
Programming language type.
@ 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),...