optimize.c (expand_call_inline): Wrap the expanded call in an EXPR_WITH_FILE_LOCATION...
authorMark Mitchell <mark@codesourcery.com>
Sun, 5 Dec 1999 02:46:48 +0000 (02:46 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sun, 5 Dec 1999 02:46:48 +0000 (02:46 +0000)
* optimize.c (expand_call_inline): Wrap the expanded call in an
EXPR_WITH_FILE_LOCATION node to get correct line numbers for
inlined functions.

From-SVN: r30784

gcc/cp/ChangeLog
gcc/cp/optimize.c

index a5e7dd9a92d2d500e6138e70c163bae438155f68..5176865f1df0c7bcace7f0b28078865b1e362e4c 100644 (file)
@@ -1,5 +1,9 @@
 1999-12-04  Mark Mitchell  <mark@codesourcery.com>
 
+       * optimize.c (expand_call_inline): Wrap the expanded call in an
+       EXPR_WITH_FILE_LOCATION node to get correct line numbers for
+       inlined functions.
+
        * optimize.c (inline_data): Remove fns_top.  Add scope_stmt.  Add
        in_target_cleanup_p.
        (remap_decl): New function.
index 57161661d1ea5f3cea89c5cf3f95ed83024ca46e..8e474a81a7744dc39e1739d0a432291b9064638d 100644 (file)
@@ -641,15 +641,20 @@ expand_call_inline (tp, walk_subtrees, data)
 
   /* The new expression has side-effects if the old one did.  */
   TREE_SIDE_EFFECTS (expr) = TREE_SIDE_EFFECTS (t);
+
+  /* Replace the call by the inlined body.  Wrap it in an
+     EXPR_WITH_FILE_LOCATION so that we'll get debugging line notes
+     pointing to the right place.  */
+  chain = TREE_CHAIN (*tp);
+  *tp = build_expr_wfl (expr, DECL_SOURCE_FILE (fn), DECL_SOURCE_LINE (fn),
+                       /*col=*/0);
+  EXPR_WFL_EMIT_LINE_NOTE (*tp) = 1;
+  TREE_CHAIN (*tp) = chain;
+
   /* If the value of the new expression is ignored, that's OK.  We
      don't warn about this for CALL_EXPRs, so we shouldn't warn about
      the equivalent inlined version either.  */
-  TREE_USED (expr) = 1;
-
-  /* Replace the call by the inlined body.  */
-  chain = TREE_CHAIN (*tp);
-  *tp = expr;
-  TREE_CHAIN (expr) = chain;
+  TREE_USED (*tp) = 1;
 
   /* Recurse into the body of the just inlined function.  */
   expand_calls_inline (tp, id);