tree.def (EXPR_WITH_FILE_LOCATION): New tree node definition.
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. From-SVN: r19049
This commit is contained in:
parent
1382bac6e8
commit
bf1e5319c3
|
@ -1,3 +1,16 @@
|
|||
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.
|
||||
|
||||
Wed Apr 8 12:51:19 1998 Jeffrey A Law (law@cygnus.com)
|
||||
|
||||
* configure.in (x86-dg-dgux): Run fixinc.dgux.
|
||||
|
|
|
@ -5171,6 +5171,11 @@ expand_expr (exp, target, tmode, modifier)
|
|||
copy_rtx (XEXP (TREE_CST_RTL (exp), 0)));
|
||||
return TREE_CST_RTL (exp);
|
||||
|
||||
case EXPR_WITH_FILE_LOCATION:
|
||||
if (EXPR_WFL_EMIT_LINE_NOTE (exp))
|
||||
emit_line_note (EXPR_WFL_FILENAME (exp), EXPR_WFL_LINENO (exp));
|
||||
return expand_expr (EXPR_WFL_NODE (exp), target, tmode, modifier);
|
||||
|
||||
case SAVE_EXPR:
|
||||
context = decl_function_context (exp);
|
||||
|
||||
|
|
|
@ -571,6 +571,15 @@ print_node (file, prefix, node, indent)
|
|||
print_node (file, temp, TREE_OPERAND (node, i), indent + 4);
|
||||
}
|
||||
}
|
||||
|
||||
if (TREE_CODE (node) == EXPR_WITH_FILE_LOCATION)
|
||||
{
|
||||
indent_to (file, indent+4);
|
||||
fprintf (file, "%s:%d:%d",
|
||||
(EXPR_WFL_FILENAME_NODE (node ) ?
|
||||
EXPR_WFL_FILENAME (node) : "(no file info)"),
|
||||
EXPR_WFL_LINENO (node), EXPR_WFL_COLNO (node));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
|
|
24
gcc/tree.c
24
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. */
|
||||
|
|
|
@ -739,6 +739,11 @@ DEFTREECODE (EXIT_EXPR, "exit_expr", 's', 1)
|
|||
The type should be void and the value should be ignored. */
|
||||
DEFTREECODE (LOOP_EXPR, "loop_expr", 's', 1)
|
||||
|
||||
/* Used to represent a tree node, such as IDENTIFIER_NODE or an EXPR
|
||||
node, adding several location information: a file name, a line
|
||||
number and column number. It is expanded as the node it refers to
|
||||
and can be considered a no-op "conversion" with an annotation. */
|
||||
DEFTREECODE (EXPR_WITH_FILE_LOCATION, "expr_with_file_location", '1', 2)
|
||||
/*
|
||||
Local variables:
|
||||
mode:c
|
||||
|
|
12
gcc/tree.h
12
gcc/tree.h
|
@ -643,6 +643,17 @@ struct tree_vec
|
|||
#define TREE_OPERAND(NODE, I) ((NODE)->exp.operands[I])
|
||||
#define TREE_COMPLEXITY(NODE) ((NODE)->exp.complexity)
|
||||
|
||||
/* In expression with file location information. */
|
||||
#define EXPR_WFL_NODE(NODE) TREE_OPERAND((NODE), 0)
|
||||
#define EXPR_WFL_FILENAME(NODE) (IDENTIFIER_POINTER ((NODE)->common.chain))
|
||||
#define EXPR_WFL_FILENAME_NODE(NODE) ((NODE)->common.chain)
|
||||
#define EXPR_WFL_LINENO(NODE) ((NODE)->exp.complexity >> 12)
|
||||
#define EXPR_WFL_COLNO(NODE) ((NODE)->exp.complexity & 0xfff)
|
||||
#define EXPR_WFL_LINECOL(NODE) ((NODE)->exp.complexity)
|
||||
#define EXPR_WFL_SET_LINECOL(NODE, LINE, COL) \
|
||||
(EXPR_WFL_LINECOL(NODE) = ((LINE) << 12) | ((COL) & 0xfff))
|
||||
#define EXPR_WFL_EMIT_LINE_NOTE(NODE) ((NODE)->common.lang_flag_0)
|
||||
|
||||
struct tree_exp
|
||||
{
|
||||
char common[sizeof (struct tree_common)];
|
||||
|
@ -1296,6 +1307,7 @@ extern tree build_decl_list PROTO((tree, tree));
|
|||
extern tree build_expr_list PROTO((tree, tree));
|
||||
extern tree build_decl PROTO((enum tree_code, tree, tree));
|
||||
extern tree build_block PROTO((tree, tree, tree, tree, tree));
|
||||
extern tree build_expr_wfl PROTO((tree, char *, int, int));
|
||||
|
||||
/* Construct various nodes representing data types. */
|
||||
|
||||
|
|
Loading…
Reference in New Issue