aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl2.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2001-08-24 08:07:46 -0400
committerJason Merrill <jason@gcc.gnu.org>2001-08-24 08:07:46 -0400
commit0213a355281c1ce387d9fae4061d18f6b9bcd54e (patch)
treeadef91f04544976faec6a008d13e5bd087582d2d /gcc/cp/decl2.c
parent2dc8352c90590135507210ce0638d31eaec88d0e (diff)
downloadgcc-0213a355281c1ce387d9fae4061d18f6b9bcd54e.zip
gcc-0213a355281c1ce387d9fae4061d18f6b9bcd54e.tar.gz
gcc-0213a355281c1ce387d9fae4061d18f6b9bcd54e.tar.bz2
c-common.c (c_alignof, [...]): Move here...
* c-common.c (c_alignof, c_alignof_expr): Move here... * c-typeck.c: ...from here. * c-tree.h, c-common.h: Adjust. * tree.c (cp_build_qualified_type_real): Use get_qualified_type. (build_cplus_array_type): Use cp_build_qualified_type, not TYPE_MAIN_VARIANT, to get an unqualified version. * decl2.c (grok_alignof): Lose. (build_expr_from_tree): Use expr_sizeof and c_alignof_expr. * typeck.c (c_alignof): Lose. * semantics.c (finish_sizeof, finish_alignof): New. * parse.y: Use them. * cp-tree.h: Declare them. From-SVN: r45145
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r--gcc/cp/decl2.c41
1 files changed, 3 insertions, 38 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 7be3368..cb84d26 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1018,42 +1018,6 @@ grokclassfn (ctype, function, flags, quals)
}
}
-/* Work on the expr used by alignof (this is only called by the parser). */
-
-tree
-grok_alignof (expr)
- tree expr;
-{
- tree best, t;
- int bestalign;
-
- if (processing_template_decl)
- return build_min (ALIGNOF_EXPR, sizetype, expr);
-
- if (TREE_CODE (expr) == COMPONENT_REF
- && DECL_C_BIT_FIELD (TREE_OPERAND (expr, 1)))
- error ("`__alignof__' applied to a bit-field");
-
- if (TREE_CODE (expr) == INDIRECT_REF)
- {
- best = t = TREE_OPERAND (expr, 0);
- bestalign = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (t)));
-
- while (TREE_CODE (t) == NOP_EXPR
- && TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 0))) == POINTER_TYPE)
- {
- int thisalign;
- t = TREE_OPERAND (t, 0);
- thisalign = TYPE_ALIGN (TREE_TYPE (TREE_TYPE (t)));
- if (thisalign > bestalign)
- best = t, bestalign = thisalign;
- }
- return c_alignof (TREE_TYPE (TREE_TYPE (best)));
- }
- else
- return c_alignof (TREE_TYPE (expr));
-}
-
/* Create an ARRAY_REF, checking for the user doing things backwards
along the way. */
@@ -3858,8 +3822,9 @@ build_expr_from_tree (t)
{
tree r = build_expr_from_tree (TREE_OPERAND (t, 0));
if (!TYPE_P (r))
- r = TREE_TYPE (r);
- return TREE_CODE (t) == SIZEOF_EXPR ? c_sizeof (r) : c_alignof (r);
+ return TREE_CODE (t) == SIZEOF_EXPR ? expr_sizeof (r) : c_alignof_expr (r);
+ else
+ return TREE_CODE (t) == SIZEOF_EXPR ? c_sizeof (r) : c_alignof (r);
}
case MODOP_EXPR: