From 6ab49f196ed7f58d4c22d789218f3b4f750b2b8b Mon Sep 17 00:00:00 2001 From: Justin Seyster Date: Fri, 13 Aug 2010 19:26:44 -0400 Subject: [PATCH] Fixed bug when trying to get the filename/lineno for a function entry. --- src/aop-duplicate.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/aop-duplicate.c b/src/aop-duplicate.c index 29f587e..5cd2fd8 100644 --- a/src/aop-duplicate.c +++ b/src/aop-duplicate.c @@ -147,6 +147,12 @@ duplicate_function_body (const char *tmpvar_name, gimple call) basic_block cur_bb; basic_block last_bb; + source_location orig_loc; + + /* Remember the source location in the original first block. */ + cur_bb = ENTRY_BLOCK_PTR_FOR_FUNCTION (cfun); + orig_loc = gimple_location (first_stmt (cur_bb->next_bb)); + bb_pairs = VEC_alloc (bb_pair, gc, INITIAL_PAIRS); label_pairs = VEC_alloc (label_pair, heap, INITIAL_PAIRS); @@ -265,7 +271,7 @@ duplicate_function_body (const char *tmpvar_name, gimple call) /* TODO: Can this line be removed? */ DECL_SOURCE_LOCATION(new_label) = DECL_SOURCE_LOCATION(old_label); distributor_bb = split_edge(e); - + tmpvar = create_tmp_var(integer_type_node, tmpvar_name); /*add_referenced_var(tmpvar);*/ @@ -314,6 +320,11 @@ duplicate_function_body (const char *tmpvar_name, gimple call) make_edge(distributor_bb, new_first_bb, EDGE_TRUE_VALUE); } + /* Make the distributor block have the same source location as the + original entry block. The function entry pointcut relies on this + to determine line number/filename for its join point. */ + gimple_set_location (first_stmt (distributor_bb), orig_loc); + free_original_copy_tables(); VEC_free (label_pair, heap, label_pairs); -- 2.43.0