Allow multiple variable declarations with a single type
This commit is contained in:
@ -79,7 +79,7 @@ namespace gcc
|
||||
|
||||
bool is_assignable_from(tree assignee, tree assignment)
|
||||
{
|
||||
return TREE_TYPE(assignment) == assignee
|
||||
return get_qualified_type(TREE_TYPE(assignment), TYPE_UNQUALIFIED) == assignee
|
||||
|| are_compatible_pointers(assignee, assignment);
|
||||
}
|
||||
|
||||
@ -133,17 +133,19 @@ namespace gcc
|
||||
|
||||
tree do_pointer_arithmetic(boot::binary_operator binary_operator, tree left, tree right)
|
||||
{
|
||||
tree left_type = get_qualified_type(TREE_TYPE(left), TYPE_UNQUALIFIED);
|
||||
tree right_type = get_qualified_type(TREE_TYPE(right), TYPE_UNQUALIFIED);
|
||||
if (binary_operator == boot::binary_operator::sum)
|
||||
{
|
||||
tree pointer{ NULL_TREE };
|
||||
tree offset{ NULL_TREE };
|
||||
|
||||
if (is_pointer_type(TREE_TYPE(left)) && is_integral_type(TREE_TYPE(right)))
|
||||
if (is_pointer_type(left_type) && is_integral_type(right_type))
|
||||
{
|
||||
pointer = left;
|
||||
offset = right;
|
||||
}
|
||||
else if (is_integral_type(TREE_TYPE(left)) && is_pointer_type(TREE_TYPE(right)))
|
||||
else if (is_integral_type(left_type) && is_pointer_type(right_type))
|
||||
{
|
||||
pointer = right;
|
||||
offset = left;
|
||||
@ -161,10 +163,10 @@ namespace gcc
|
||||
}
|
||||
else if (binary_operator == boot::binary_operator::subtraction)
|
||||
{
|
||||
if (is_pointer_type(TREE_TYPE(left)) && is_integral_type(TREE_TYPE(right)))
|
||||
if (is_pointer_type(left_type) && is_integral_type(right_type))
|
||||
{
|
||||
tree pointer_type = TREE_TYPE(left);
|
||||
tree offset_type = TREE_TYPE(right);
|
||||
tree pointer_type = left_type;
|
||||
tree offset_type = right_type;
|
||||
tree size_exp = fold_convert(offset_type, size_in_bytes(TREE_TYPE(pointer_type)));
|
||||
|
||||
tree convert_expression = fold_build2(MULT_EXPR, offset_type, right, size_exp);
|
||||
@ -172,8 +174,8 @@ namespace gcc
|
||||
|
||||
convert_expression = fold_build1(NEGATE_EXPR, sizetype, convert_expression);
|
||||
return fold_build2(POINTER_PLUS_EXPR, pointer_type, left, convert_expression);
|
||||
} else if (is_pointer_type(TREE_TYPE(left)) && is_pointer_type(TREE_TYPE(right))
|
||||
&& TREE_TYPE(left) == TREE_TYPE(right))
|
||||
}
|
||||
else if (is_pointer_type(left_type) && is_pointer_type(right_type) && left_type == right_type)
|
||||
{
|
||||
return fold_build2(POINTER_DIFF_EXPR, ssizetype, left, right);
|
||||
}
|
||||
@ -185,8 +187,8 @@ namespace gcc
|
||||
tree_code operator_code, tree left, tree right, tree target_type)
|
||||
{
|
||||
location_t expression_location = get_location(&expression->position());
|
||||
tree left_type = TREE_TYPE(left);
|
||||
tree right_type = TREE_TYPE(right);
|
||||
tree left_type = get_qualified_type(TREE_TYPE(left), TYPE_UNQUALIFIED);
|
||||
tree right_type = get_qualified_type(TREE_TYPE(right), TYPE_UNQUALIFIED);
|
||||
|
||||
if (condition)
|
||||
{
|
||||
|
Reference in New Issue
Block a user