[gcjx] Patch: FYI: annotate case labels

Tom Tromey tromey@redhat.com
Sun Mar 27 02:56:00 GMT 2005


I'm checking this in on the gcjx branch.

This adds locations to the CASE_LABEL_EXPRs we generate.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* tree.cc (visit_switch): Annotate case label expression.

Index: tree.cc
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Attic/tree.cc,v
retrieving revision 1.1.2.27
diff -u -r1.1.2.27 tree.cc
--- tree.cc 27 Mar 2005 02:48:54 -0000 1.1.2.27
+++ tree.cc 27 Mar 2005 02:49:38 -0000
@@ -719,9 +719,17 @@
        ++i)
     {
       if ((*i).get () == def)
-	tsi_link_after (&out, build3 (CASE_LABEL_EXPR, NULL_TREE,
-				      NULL_TREE, NULL_TREE, NULL_TREE),
-			TSI_CONTINUE_LINKING);
+	{
+	  tree label = build0 (LABEL_DECL, NULL_TREE);
+	  DECL_CONTEXT (label) = current_block;
+	  tsi_link_after (&out, build1 (LABEL_EXPR, void_type_node, label),
+			  TSI_CONTINUE_LINKING);
+
+	  tree case_label = build3 (CASE_LABEL_EXPR, NULL_TREE, NULL_TREE,
+				    NULL_TREE, label);
+	  annotate (case_label, (*i).get ());
+	  tsi_link_after (&out, case_label, TSI_CONTINUE_LINKING);
+	}
       (*i)->visit (this);
       tsi_link_after (&out, current, TSI_CONTINUE_LINKING);
     }
@@ -759,9 +767,8 @@
        ++i)
     {
       jint value = jint (intb->convert ((*i)->type (), (*i)->value ()));
-      tree new_label = build3 (CASE_LABEL_EXPR,
-			       void_type_node,
-			       build_int (value), NULL_TREE, label);
+      tree new_label = build3 (CASE_LABEL_EXPR, NULL_TREE, build_int (value),
+			       NULL_TREE, label);
       annotate (new_label, swblock);
       tsi_link_after (&out, new_label, TSI_CONTINUE_LINKING);
     }



More information about the Java-patches mailing list