diff options
author | Jason Merrill <jason@redhat.com> | 2002-01-15 17:27:07 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2002-01-15 17:27:07 -0500 |
commit | de097a2d7d044caf6841fa395bb322d4ef8ba841 (patch) | |
tree | 9dec30bd55dcecc61d1bc99e776548971a77e3dd /gcc/c-semantics.c | |
parent | 93e9a9924741c257172f3384ae199b45b5364886 (diff) | |
download | gcc-de097a2d7d044caf6841fa395bb322d4ef8ba841.tar.gz |
c-common.def (FILE_STMT): New code.
* c-common.def (FILE_STMT): New code.
* c-common.c (statement_code_p): It's a statement.
* c-common.h (stmt_tree_s): Add x_last_filename.
(FILE_STMT_FILENAME_NODE, FILE_STMT_FILENAME): New macros.
(last_expr_filename): New macro.
* c-semantics.c (begin_stmt_tree): Initialize it.
(add_stmt): If the filename changed, also insert a
FILE_STMT.
(expand_stmt): Handle seeing one.
From-SVN: r48881
Diffstat (limited to 'gcc/c-semantics.c')
-rw-r--r-- | gcc/c-semantics.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/gcc/c-semantics.c b/gcc/c-semantics.c index 4bab4d3aaa6..682943f17c2 100644 --- a/gcc/c-semantics.c +++ b/gcc/c-semantics.c @@ -60,6 +60,7 @@ begin_stmt_tree (t) *t = build_nt (EXPR_STMT, void_zero_node); last_tree = *t; last_expr_type = NULL_TREE; + last_expr_filename = input_filename; } /* T is a statement. Add it to the statement-tree. */ @@ -68,6 +69,19 @@ tree add_stmt (t) tree t; { + if (input_filename != last_expr_filename) + { + /* If the filename has changed, also add in a FILE_STMT. Do a string + compare first, though, as it might be an equivalent string. */ + int add = (strcmp (input_filename, last_expr_filename) != 0); + last_expr_filename = input_filename; + if (add) + { + tree pos = build_nt (FILE_STMT, get_identifier (input_filename)); + add_stmt (pos); + } + } + /* Add T to the statement-tree. */ TREE_CHAIN (last_tree) = t; last_tree = t; @@ -760,6 +774,10 @@ expand_stmt (t) switch (TREE_CODE (t)) { + case FILE_STMT: + input_filename = FILE_STMT_FILENAME (t); + break; + case RETURN_STMT: genrtl_return_stmt (t); break; @@ -845,4 +863,3 @@ expand_stmt (t) t = TREE_CHAIN (t); } } - |