forked from OSchip/llvm-project
Remove some dead code in ValueObject.
Originally I converted this entire function and all dependents to use StringRef, but there were some test failures that were tricky to track down, as this is a complicated function. So I'm starting over, this time in smaller increments. llvm-svn: 287307
This commit is contained in:
parent
63e10c9c96
commit
c2d5558b21
|
@ -2607,13 +2607,14 @@ ValueObjectSP ValueObject::GetValueForExpressionPath_Impl(
|
|||
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
|
||||
return ValueObjectSP();
|
||||
}
|
||||
if (!separator_position ||
|
||||
separator_position > close_bracket_position) // if no separator, this
|
||||
// is either [] or [N]
|
||||
{
|
||||
|
||||
if (!separator_position || separator_position > close_bracket_position) {
|
||||
// if no separator, this is of the form [N]. Note that this cannot
|
||||
// be an unbounded range of the form [], because that case was handled
|
||||
// above with an unconditional return.
|
||||
char *end = NULL;
|
||||
unsigned long index = ::strtoul(expression_cstr + 1, &end, 0);
|
||||
if (!end || end != close_bracket_position) // if something weird is in
|
||||
if (end != close_bracket_position) // if something weird is in
|
||||
// our way return an error
|
||||
{
|
||||
*first_unparsed = expression_cstr;
|
||||
|
@ -2622,24 +2623,6 @@ ValueObjectSP ValueObject::GetValueForExpressionPath_Impl(
|
|||
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
|
||||
return ValueObjectSP();
|
||||
}
|
||||
if (end - expression_cstr ==
|
||||
1) // if this is [], only return a valid value for arrays
|
||||
{
|
||||
if (root_compiler_type_info.Test(eTypeIsArray)) {
|
||||
*first_unparsed = expression_cstr + 2;
|
||||
*reason_to_stop =
|
||||
ValueObject::eExpressionPathScanEndReasonArrayRangeOperatorMet;
|
||||
*final_result =
|
||||
ValueObject::eExpressionPathEndResultTypeUnboundedRange;
|
||||
return root;
|
||||
} else {
|
||||
*first_unparsed = expression_cstr;
|
||||
*reason_to_stop =
|
||||
ValueObject::eExpressionPathScanEndReasonEmptyRangeNotAllowed;
|
||||
*final_result = ValueObject::eExpressionPathEndResultTypeInvalid;
|
||||
return ValueObjectSP();
|
||||
}
|
||||
}
|
||||
// from here on we do have a valid index
|
||||
if (root_compiler_type_info.Test(eTypeIsArray)) {
|
||||
ValueObjectSP child_valobj_sp = root->GetChildAtIndex(index, true);
|
||||
|
@ -2791,7 +2774,7 @@ ValueObjectSP ValueObject::GetValueForExpressionPath_Impl(
|
|||
{
|
||||
char *end = NULL;
|
||||
unsigned long index_lower = ::strtoul(expression_cstr + 1, &end, 0);
|
||||
if (!end || end != separator_position) // if something weird is in our
|
||||
if (end != separator_position) // if something weird is in our
|
||||
// way return an error
|
||||
{
|
||||
*first_unparsed = expression_cstr;
|
||||
|
@ -2801,7 +2784,7 @@ ValueObjectSP ValueObject::GetValueForExpressionPath_Impl(
|
|||
return ValueObjectSP();
|
||||
}
|
||||
unsigned long index_higher = ::strtoul(separator_position + 1, &end, 0);
|
||||
if (!end || end != close_bracket_position) // if something weird is in
|
||||
if (end != close_bracket_position) // if something weird is in
|
||||
// our way return an error
|
||||
{
|
||||
*first_unparsed = expression_cstr;
|
||||
|
@ -2811,11 +2794,8 @@ ValueObjectSP ValueObject::GetValueForExpressionPath_Impl(
|
|||
return ValueObjectSP();
|
||||
}
|
||||
if (index_lower > index_higher) // swap indices if required
|
||||
{
|
||||
unsigned long temp = index_lower;
|
||||
index_lower = index_higher;
|
||||
index_higher = temp;
|
||||
}
|
||||
std::swap(index_lower, index_higher);
|
||||
|
||||
if (root_compiler_type_info.Test(
|
||||
eTypeIsScalar)) // expansion only works for scalars
|
||||
{
|
||||
|
@ -2975,7 +2955,7 @@ int ValueObject::ExpandArraySliceExpression(
|
|||
{
|
||||
char *end = NULL;
|
||||
unsigned long index = ::strtoul(expression_cstr + 1, &end, 0);
|
||||
if (!end || end != close_bracket_position) // if something weird is in
|
||||
if (end != close_bracket_position) // if something weird is in
|
||||
// our way return an error
|
||||
{
|
||||
*first_unparsed = expression_cstr;
|
||||
|
@ -3093,7 +3073,7 @@ int ValueObject::ExpandArraySliceExpression(
|
|||
{
|
||||
char *end = NULL;
|
||||
unsigned long index_lower = ::strtoul(expression_cstr + 1, &end, 0);
|
||||
if (!end || end != separator_position) // if something weird is in our
|
||||
if (end != separator_position) // if something weird is in our
|
||||
// way return an error
|
||||
{
|
||||
*first_unparsed = expression_cstr;
|
||||
|
@ -3103,7 +3083,7 @@ int ValueObject::ExpandArraySliceExpression(
|
|||
return 0;
|
||||
}
|
||||
unsigned long index_higher = ::strtoul(separator_position + 1, &end, 0);
|
||||
if (!end || end != close_bracket_position) // if something weird is in
|
||||
if (end != close_bracket_position) // if something weird is in
|
||||
// our way return an error
|
||||
{
|
||||
*first_unparsed = expression_cstr;
|
||||
|
@ -3113,11 +3093,8 @@ int ValueObject::ExpandArraySliceExpression(
|
|||
return 0;
|
||||
}
|
||||
if (index_lower > index_higher) // swap indices if required
|
||||
{
|
||||
unsigned long temp = index_lower;
|
||||
index_lower = index_higher;
|
||||
index_higher = temp;
|
||||
}
|
||||
std::swap(index_lower, index_higher);
|
||||
|
||||
if (root_compiler_type_info.Test(
|
||||
eTypeIsScalar)) // expansion only works for scalars
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue