diff options
author | Richard Henderson <rth@redhat.com> | 2003-09-21 16:39:40 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2003-09-21 16:39:40 -0700 |
commit | 7e2af53a14ce4710e1dca754acf603db0f9d8802 (patch) | |
tree | d04ef32430711aab636f45451f9e7a3ad34ab36f /gcc/tree.h | |
parent | d6a1d39a7dbf00f373ace14470d5edb5cc4337be (diff) | |
download | gcc-7e2af53a14ce4710e1dca754acf603db0f9d8802.zip gcc-7e2af53a14ce4710e1dca754acf603db0f9d8802.tar.gz gcc-7e2af53a14ce4710e1dca754acf603db0f9d8802.tar.bz2 |
tree.h (TREE_LOCUS): Rename from DECL_SOURCE_LOCATION; make const.
* tree.h (TREE_LOCUS): Rename from DECL_SOURCE_LOCATION; make const.
(TREE_FILENAME, TREE_LINENO): Likewise.
(set_tree_locus, copy_tree_locus, set_tree_file_line): New.
(TREE_LOCUS_SET_P): New.
* c-aux-info.c, c-decl.c, c-parse.in, coverage.c, dbxout.c,
diagnostic.c, dwarf2out.c, dwarfout.c, function.c, integrate.c,
print-tree.c, stmt.c, toplev.c, tree-dump.c, tree-inline.c,
tree-optimize.c, tree.c, tree.def, xcoffout.c, config/alpha/alpha.c,
config/mips/mips.c, doc/c-tree.texi, objc/objc-act.c: Update to match.
ada/
* trans.c, utils.c: Update for DECL_SOURCE_LOCATION rename and
change to const.
cp/
* class.c, cp-tree.h, decl.c, decl2.c, error.c, init.c,
method.c, optimize.c, pt.c, semantics.c, tree.c: Update for
DECL_SOURCE_LOCATION rename and change to const.
f/
* com.c, ste.c: Update for DECL_SOURCE_LOCATION rename and
change to const.
java/
* class.c, decl.c, jcf-parse.c, jcf-write.c, parse.y,
resource.c: Update for DECL_SOURCE_LOCATION rename and change to const.
treelang/
* treetree.c: Update for DECL_SOURCE_LOCATION rename and
change to const.
From-SVN: r71636
Diffstat (limited to 'gcc/tree.h')
-rw-r--r-- | gcc/tree.h | 30 |
1 files changed, 23 insertions, 7 deletions
@@ -802,6 +802,29 @@ struct tree_vec GTY(()) #define TREE_OPERAND(NODE, I) TREE_OPERAND_CHECK (NODE, I) #define TREE_COMPLEXITY(NODE) (EXPR_CHECK (NODE)->exp.complexity) +/* These macros access the location of a declaration. For 3.4, this is + only defined for DECLs, but for 3.5 it will be valid on EXPRs as well; + thus the name is not decl specific. The values accessed from the + uppercase macros are intentionally read-only. Use the setter functions + to write to this field. */ + +#define TREE_LOCUS(NODE) \ + (*(const location_t *)&DECL_CHECK (NODE)->decl.locus) +#define TREE_FILENAME(NODE) (TREE_LOCUS (NODE).file) +#define TREE_LINENO(NODE) (TREE_LOCUS (NODE).line) +#define TREE_LOCUS_SET_P(NODE) (TREE_LINENO (NODE) != 0) + +#define set_tree_locus(NODE, LOC) \ + ((void)(DECL_CHECK (NODE)->decl.locus = (LOC))) +#define copy_tree_locus(DEST, SRC) \ + ((void)(DECL_CHECK (DEST)->decl.locus = DECL_CHECK (SRC)->decl.locus)) +#define set_tree_file_line(NODE, FILE, LINE) \ + do { \ + location_t *l_ = &DECL_CHECK (NODE)->decl.locus; \ + l_->file = (FILE); \ + l_->line = (LINE); \ + } while (0) + /* In a LABELED_BLOCK_EXPR node. */ #define LABELED_BLOCK_LABEL(NODE) \ TREE_OPERAND_CHECK_CODE (NODE, LABELED_BLOCK_EXPR, 0) @@ -1309,13 +1332,6 @@ struct tree_type GTY(()) /* For a FIELD_DECL in a QUAL_UNION_TYPE, records the expression, which if nonzero, indicates that the field occupies the type. */ #define DECL_QUALIFIER(NODE) (FIELD_DECL_CHECK (NODE)->decl.initial) -/* These two fields describe where in the source code the declaration - was. If the declaration appears in several places (as for a C - function that is declared first and then defined later), this - information should refer to the definition. */ -#define DECL_SOURCE_LOCATION(NODE) (DECL_CHECK (NODE)->decl.locus) -#define DECL_SOURCE_FILE(NODE) (DECL_SOURCE_LOCATION (NODE).file) -#define DECL_SOURCE_LINE(NODE) (DECL_SOURCE_LOCATION (NODE).line) /* Holds the size of the datum, in bits, as a tree expression. Need not be constant. */ #define DECL_SIZE(NODE) (DECL_CHECK (NODE)->decl.size) |