Patchwork [Ada] Adjust source location on boolean inversions

login
register
mail settings
Submitter Eric Botcazou
Date Oct. 10, 2010, 12:21 p.m.
Message ID <201010101421.51910.ebotcazou@adacore.com>
Download mbox | patch
Permalink /patch/67350/
State New
Headers show

Comments

Eric Botcazou - Oct. 10, 2010, 12:21 p.m.
This yields more precise debug info for complex conditional expressions.

Tested on i586-suse-linux, applied on the mainline.


2010-10-10  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/trans.c (gnat_to_gnu) <N_Not_In>: Use
	invert_truthvalue_loc instead of invert_truthvalue.
	* gcc-interface/utils2.c (build_binary_op) <NE_EXPR>: Likewise.
	(build_unary_op) <TRUTH_NOT_EXPR>: Likewise.

Patch

Index: gcc-interface/utils2.c
===================================================================
--- gcc-interface/utils2.c	(revision 165234)
+++ gcc-interface/utils2.c	(working copy)
@@ -791,7 +791,7 @@  build_binary_op (enum tree_code op_code,
 	  result = compare_arrays (result_type, left_operand, right_operand);
 
 	  if (op_code == NE_EXPR)
-	    result = invert_truthvalue (result);
+	    result = invert_truthvalue_loc (EXPR_LOCATION (result), result);
 	  else
 	    gcc_assert (op_code == EQ_EXPR);
 
@@ -1018,7 +1018,7 @@  build_unary_op (enum tree_code op_code,
 #ifdef ENABLE_CHECKING
       gcc_assert (TREE_CODE (get_base_type (result_type)) == BOOLEAN_TYPE);
 #endif
-      result = invert_truthvalue (operand);
+      result = invert_truthvalue_loc (EXPR_LOCATION (operand), operand);
       break;
 
     case ATTR_ADDR_EXPR:
Index: gcc-interface/trans.c
===================================================================
--- gcc-interface/trans.c	(revision 165250)
+++ gcc-interface/trans.c	(working copy)
@@ -4496,7 +4496,8 @@  gnat_to_gnu (Node_Id gnat_node)
 	  }
 
 	if (kind == N_Not_In)
-	  gnu_result = invert_truthvalue (gnu_result);
+	  gnu_result
+	    = invert_truthvalue_loc (EXPR_LOCATION (gnu_result), gnu_result);
       }
       break;