diff options
author | bothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-04-08 14:03:48 +0000 |
---|---|---|
committer | bothner <bothner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-04-08 14:03:48 +0000 |
commit | dae7d8ad0370268c616e6d5a4bf8c2fd745735db (patch) | |
tree | da1bfbbe113dd95c4e32fc4661d73298fc0876a6 /gcc/tree.c | |
parent | b4e1922b7ff51a7d1a08a3c3c3644827bf23e52f (diff) | |
download | gcc-dae7d8ad0370268c616e6d5a4bf8c2fd745735db.tar.gz |
d
Fri Apr 3 17:02:13 1998 Alexandre Petit-Bianco <apbianco@cygnus.com>
* tree.def (EXPR_WITH_FILE_LOCATION): New tree node definition.
* tree.h (EXPR_WFL_{NODE,FILENAME,FILENAME_NODE,LINENO,
COLNO,LINECOL,SET_LINECOL,EMIT_LINE_NOTE}): New macros.
(build_expr_wfl): New prototype declaration.
* tree.c (build_expr_wfl): New function, to build
EXPR_WITH_FILE_LOCATION nodes.
(copy_node): Don't zero TREE_CHAIN if copying a
EXPR_WITH_FILE_LOCATION node.
* print-tree.c (print_node): Handle EXPR_WITH_FILE_LOCATION.
* expr.c (expand_expr): Handle EXPR_WITH_FILE_LOCATION.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@19049 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/gcc/tree.c b/gcc/tree.c index b6db322d667..c0b1e34c2c6 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1185,7 +1185,9 @@ copy_node (node) for (i = length / sizeof (int) * sizeof (int); i < length; i++) ((char *) t)[i] = ((char *) node)[i]; - TREE_CHAIN (t) = 0; + /* EXPR_WITH_FILE_LOCATION must keep filename info stored in TREE_CHAIN */ + if (TREE_CODE (node) != EXPR_WITH_FILE_LOCATION) + TREE_CHAIN (t) = 0; TREE_ASM_WRITTEN (t) = 0; if (TREE_CODE_CLASS (code) == 'd') @@ -3218,6 +3220,26 @@ build_block (vars, tags, subblocks, supercontext, chain) BLOCK_CHAIN (block) = chain; return block; } + +/* EXPR_WITH_FILE_LOCATION are used to keep track of the exact + location where an expression or an identifier were encountered. It + is necessary for languages where the frontend parser will handle + recursively more than one file (Java is one of them). */ + +tree +build_expr_wfl (node, file, line, col) + tree node; + char *file; + int line, col; +{ + register tree wfl = make_node (EXPR_WITH_FILE_LOCATION); + EXPR_WFL_NODE (wfl) = node; + EXPR_WFL_FILENAME_NODE (wfl) = get_identifier (file); + EXPR_WFL_SET_LINECOL (wfl, line, col); + TREE_SIDE_EFFECTS (wfl) = TREE_SIDE_EFFECTS (node); + TREE_TYPE (wfl) = TREE_TYPE (node); + return wfl; +} /* Return a declaration like DDECL except that its DECL_MACHINE_ATTRIBUTE is ATTRIBUTE. */ |