From 6a2053773b894b7f347752396d64e28e326d733e Mon Sep 17 00:00:00 2001 From: Martin Sebor Date: Mon, 1 Feb 2021 09:17:21 -0700 Subject: [PATCH] Document various BLOCK macros. gcc/ChangeLog: * tree.h (BLOCK_VARS): Add comment. (BLOCK_SUBBLOCKS): Same. (BLOCK_SUPERCONTEXT): Same. (BLOCK_ABSTRACT_ORIGIN): Same. (inlined_function_outer_scope_p): Same. --- gcc/tree.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/gcc/tree.h b/gcc/tree.h index 17a811c02e8..4f33868e8e1 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -1912,16 +1912,27 @@ class auto_suppress_location_wrappers #define OMP_CLAUSE_OPERAND(NODE, I) \ OMP_CLAUSE_ELT_CHECK (NODE, I) -/* In a BLOCK node. */ +/* In a BLOCK (scope) node: + Variables declared in the scope NODE. */ #define BLOCK_VARS(NODE) (BLOCK_CHECK (NODE)->block.vars) #define BLOCK_NONLOCALIZED_VARS(NODE) \ (BLOCK_CHECK (NODE)->block.nonlocalized_vars) #define BLOCK_NUM_NONLOCALIZED_VARS(NODE) \ vec_safe_length (BLOCK_NONLOCALIZED_VARS (NODE)) #define BLOCK_NONLOCALIZED_VAR(NODE,N) (*BLOCK_NONLOCALIZED_VARS (NODE))[N] +/* A chain of BLOCKs (scopes) nested within the scope NODE. */ #define BLOCK_SUBBLOCKS(NODE) (BLOCK_CHECK (NODE)->block.subblocks) +/* The scope enclosing the scope NODE, or FUNCTION_DECL for the "outermost" + function scope. Inlined functions are chained by this so that given + expression E and its TREE_BLOCK(E) B, BLOCK_SUPERCONTEXT(B) is the scope + in which E has been made or into which E has been inlined. */ #define BLOCK_SUPERCONTEXT(NODE) (BLOCK_CHECK (NODE)->block.supercontext) +/* Points to the next scope at the same level of nesting as scope NODE. */ #define BLOCK_CHAIN(NODE) (BLOCK_CHECK (NODE)->block.chain) +/* A BLOCK, or FUNCTION_DECL of the function from which a block has been + inlined. In a scope immediately enclosing an inlined leaf expression, + points to the outermost scope into which it has been inlined (thus + bypassing all intermediate BLOCK_SUPERCONTEXTs). */ #define BLOCK_ABSTRACT_ORIGIN(NODE) (BLOCK_CHECK (NODE)->block.abstract_origin) #define BLOCK_ORIGIN(NODE) \ (BLOCK_ABSTRACT_ORIGIN(NODE) ? BLOCK_ABSTRACT_ORIGIN(NODE) : (NODE)) @@ -5077,7 +5088,10 @@ function_args_iter_next (function_args_iterator *i) i->next = TREE_CHAIN (i->next); } -/* We set BLOCK_SOURCE_LOCATION only to inlined function entry points. */ +/* Returns true if a BLOCK has a source location. + BLOCK_SOURCE_LOCATION is set only to inlined function entry points, + so the function returns true for all but the innermost and outermost + blocks into which an expression has been inlined. */ static inline bool inlined_function_outer_scope_p (const_tree block) -- 2.30.2