summaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2015-02-15 22:30:16 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2015-02-15 22:30:16 +0000
commit5154126f772a7659d26fffff6db5e11f6cb396b7 (patch)
tree4f786f92b69387a69a14ef0957b60b15265f4203 /gcc/tree.c
parent18d8d57c3be12b7f3269cee702eb7074ea123e38 (diff)
downloadgcc-5154126f772a7659d26fffff6db5e11f6cb396b7.tar.gz
* cgraph.h (symtab_node::has_aliases_p): Simplify.
(symtab_node::call_for_symbol_and_aliases): Use has_aliases_p * tree.c (lookup_binfo_at_offset): Make static. (get_binfo_at_offset): Do not shadow offset; add explanatory comment. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@220718 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 6fe1d5a0d55..29f70f8ec11 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -11992,7 +11992,7 @@ type_in_anonymous_namespace_p (const_tree t)
/* Lookup sub-BINFO of BINFO of TYPE at offset POS. */
-tree
+static tree
lookup_binfo_at_offset (tree binfo, tree type, HOST_WIDE_INT pos)
{
unsigned int i;
@@ -12045,11 +12045,13 @@ get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type)
else if (offset != 0)
{
tree found_binfo = NULL, base_binfo;
- int offset = (tree_to_shwi (BINFO_OFFSET (binfo)) + pos
- / BITS_PER_UNIT);
+ /* Offsets in BINFO are in bytes relative to the whole structure
+ while POS is in bits relative to the containing field. */
+ int binfo_offset = (tree_to_shwi (BINFO_OFFSET (binfo)) + pos
+ / BITS_PER_UNIT);
for (i = 0; BINFO_BASE_ITERATE (binfo, i, base_binfo); i++)
- if (tree_to_shwi (BINFO_OFFSET (base_binfo)) == offset
+ if (tree_to_shwi (BINFO_OFFSET (base_binfo)) == binfo_offset
&& types_same_for_odr (TREE_TYPE (base_binfo), TREE_TYPE (fld)))
{
found_binfo = base_binfo;
@@ -12058,7 +12060,8 @@ get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type)
if (found_binfo)
binfo = found_binfo;
else
- binfo = lookup_binfo_at_offset (binfo, TREE_TYPE (fld), offset);
+ binfo = lookup_binfo_at_offset (binfo, TREE_TYPE (fld),
+ binfo_offset);
}
type = TREE_TYPE (fld);