diff options
author | Per Bothner <per@bothner.com> | 2004-06-30 11:11:14 -0700 |
---|---|---|
committer | Per Bothner <bothner@gcc.gnu.org> | 2004-06-30 11:11:14 -0700 |
commit | a281759fdf4cc20f179d37ef875f7c233ab68f46 (patch) | |
tree | 01829581c8eb09eede00ea3a28703fb4b3440dc5 /gcc/tree-mudflap.c | |
parent | 3c20847b8301eb9aa407ee8273b6e738e7067ee0 (diff) | |
download | gcc-a281759fdf4cc20f179d37ef875f7c233ab68f46.zip gcc-a281759fdf4cc20f179d37ef875f7c233ab68f46.tar.gz gcc-a281759fdf4cc20f179d37ef875f7c233ab68f46.tar.bz2 |
Conditionally compile support for --enable-mapped_location.
* tree-mudflap.c (mf_file_function_line_tree): Take a location_t
rather than a pointer to one. Use expand_location.
(mf_varname_tree): Use expand_location.
* tree-dump.c: Use expand_location on DECL_SOURCE_LOCATION.
* coverage.c: Likewise.
* print-tree.c: Likewise.
* c-aux-info.c (gen_aux_info_record): Likewise.
* c-parse.in: Use SET_EXPR_LOCATION macro.
* gimple-low.c: Likewise.
* tree-mudflap.c: Likewise.
* gimplify.c: Likewise. Also use EXPR_LOCATION and EXPR_HAS_LOCATION.
* c-ppoutput.c: Use new source_location typedef instead of fileline.
* c-semantics.c: Use new macros.
* c-typeck.c: Likewise.
From-SVN: r83920
Diffstat (limited to 'gcc/tree-mudflap.c')
-rw-r--r-- | gcc/tree-mudflap.c | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/gcc/tree-mudflap.c b/gcc/tree-mudflap.c index dcde2ac..dbb994d 100644 --- a/gcc/tree-mudflap.c +++ b/gcc/tree-mudflap.c @@ -50,7 +50,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA /* Helpers. */ static tree mf_build_string (const char *string); static tree mf_varname_tree (tree); -static tree mf_file_function_line_tree (location_t *); +static tree mf_file_function_line_tree (location_t); /* Initialization of all the mf-runtime.h extern decls. */ static void mf_init_extern_trees (void); @@ -117,10 +117,11 @@ mf_varname_tree (tree decl) /* Add FILENAME[:LINENUMBER]. */ { + expanded_location xloc = expand_location (DECL_SOURCE_LOCATION (decl)); const char *sourcefile; - unsigned sourceline; + unsigned sourceline = xloc.line; - sourcefile = DECL_SOURCE_FILE (decl); + sourcefile = xloc.file; if (sourcefile == NULL && current_function_decl != NULL_TREE) sourcefile = DECL_SOURCE_FILE (current_function_decl); if (sourcefile == NULL) @@ -128,7 +129,6 @@ mf_varname_tree (tree decl) pp_string (buf, sourcefile); - sourceline = DECL_SOURCE_LINE (decl); if (sourceline != 0) { pp_string (buf, ":"); @@ -188,25 +188,23 @@ mf_varname_tree (tree decl) /* And another friend, for producing a simpler message. */ static tree -mf_file_function_line_tree (location_t *locus) +mf_file_function_line_tree (location_t location) { + expanded_location xloc = expand_location (location); const char *file = NULL, *colon, *line, *op, *name, *cp; char linebuf[18]; char *string; tree result; - /* Add FILENAME. */ - if (locus != NULL) - file = locus->file; - if (file == NULL && current_function_decl != NULL_TREE) - file = DECL_SOURCE_FILE (current_function_decl); - if (file == NULL) - file = "<unknown file>"; + /* Add FILENAME[:LINENUMBER]. */ + if (xloc.file == NULL && current_function_decl != NULL_TREE) + xloc.file = DECL_SOURCE_FILE (current_function_decl); + if (xloc.file == NULL) + xloc.file = "<unknown file>"; - /* Add :LINENUMBER. */ - if (locus != NULL && locus->line > 0) + if (xloc.line > 0) { - sprintf (linebuf, "%d", locus->line); + sprintf (linebuf, "%d", xloc.line); colon = ":"; line = linebuf; } @@ -348,13 +346,13 @@ mf_decl_cache_locals (void) globals into the cache variables. */ t = build (MODIFY_EXPR, TREE_TYPE (mf_cache_shift_decl_l), mf_cache_shift_decl_l, mf_cache_shift_decl); - annotate_with_locus (t, DECL_SOURCE_LOCATION (current_function_decl)); + SET_EXPR_LOCATION (t, DECL_SOURCE_LOCATION (current_function_decl)); gimplify_to_stmt_list (&t); shift_init_stmts = t; t = build (MODIFY_EXPR, TREE_TYPE (mf_cache_mask_decl_l), mf_cache_mask_decl_l, mf_cache_mask_decl); - annotate_with_locus (t, DECL_SOURCE_LOCATION (current_function_decl)); + SET_EXPR_LOCATION (t, DECL_SOURCE_LOCATION (current_function_decl)); gimplify_to_stmt_list (&t); mask_init_stmts = t; @@ -548,7 +546,10 @@ mf_build_check_statement_for (tree addr, tree size, This is the body of the conditional. */ - u = tree_cons (NULL_TREE, mf_file_function_line_tree (locus), NULL_TREE); + u = tree_cons (NULL_TREE, + mf_file_function_line_tree (locus == NULL ? UNKNOWN_LOCATION + : *locus), + NULL_TREE); u = tree_cons (NULL_TREE, dirflag, u); u = tree_cons (NULL_TREE, size, u); u = tree_cons (NULL_TREE, mf_value, u); @@ -920,7 +921,7 @@ mx_register_decls (tree decl, tree *stmt_list) register_fncall_params); /* Accumulate the two calls. */ - /* ??? Set EXPR_LOCUS. */ + /* ??? Set EXPR_LOCATION. */ gimplify_stmt (®ister_fncall); gimplify_stmt (&unregister_fncall); |