Fixed bug where entry pointcut wouldn't know the filename/lineno.
authorJustin Seyster <jseyster@cs.sunysb.edu>
Thu, 28 Oct 2010 00:09:01 +0000 (20:09 -0400)
committerJustin Seyster <jseyster@cs.sunysb.edu>
Thu, 28 Oct 2010 00:28:12 +0000 (20:28 -0400)
In this case, if the user called aop_duplicate() with a captured
in_param.

src/aop-weave.c

index 711e75382edd1be05e5d178a616e188085f13d75..ca8fc02a49612c123a57c2162417832cc21f15e9 100644 (file)
@@ -41,6 +41,8 @@
 #include <tm.h>
 #include <tree.h>
 #include <gimple.h>
+#include <tree-flow.h>
+
 #include <toplev.h>
 
 /* Defining GENERATOR_FILE prevents real.h from also including the
@@ -456,12 +458,22 @@ insert_stmts_at_entry (VEC(gimple, heap) *stmt_list)
   int i;
   edge in_edge;
   gimple stmt;
+  gimple entry_stmt;
+
+  entry_stmt = first_stmt (ENTRY_BLOCK_PTR_FOR_FUNCTION (cfun)->next_bb);
 
   /* Get the edge for the main entry point. */  
   in_edge = single_succ_edge (ENTRY_BLOCK_PTR_FOR_FUNCTION (cfun));
 
   for (i = 0; VEC_iterate (gimple, stmt_list, i, stmt); i++)
-    gsi_insert_on_edge_immediate (in_edge, stmt);
+    {
+      /* This is so entry pointcut functions can still tell what the
+        line number/filename is for this function's entry. */
+      if (first_stmt != NULL)
+       gimple_set_location (stmt, gimple_location (entry_stmt));
+
+      gsi_insert_on_edge_immediate (in_edge, stmt);
+    }
 }
 
 /**