[llvm-commits] CVS: llvm-gcc/gcc/cp/parser.c typeck.c
Chris Lattner
lattner at cs.uiuc.edu
Sun Feb 13 19:21:57 PST 2005
Changes in directory llvm-gcc/gcc/cp:
parser.c updated: 1.3 -> 1.4
typeck.c updated: 1.5 -> 1.6
---
Log message:
Now that GCC can properly realize new things are constants (e.g. &Global[10]),
we can get rid of the gross hackery we have added in the past to handle
global initializers.
---
Diffs of the changes: (+4 -12)
parser.c | 4 ----
typeck.c | 12 ++++--------
2 files changed, 4 insertions(+), 12 deletions(-)
Index: llvm-gcc/gcc/cp/parser.c
diff -u llvm-gcc/gcc/cp/parser.c:1.3 llvm-gcc/gcc/cp/parser.c:1.4
--- llvm-gcc/gcc/cp/parser.c:1.3 Mon Jan 3 16:29:14 2005
+++ llvm-gcc/gcc/cp/parser.c Sun Feb 13 21:21:43 2005
@@ -10878,7 +10878,6 @@
set to FALSE if there is no initializer present. If there is an
initializer, and it is not a constant-expression, *NON_CONSTANT_P
is set to true; otherwise it is set to false. */
-extern int parsing_initializer;
static tree
cp_parser_initializer (cp_parser* parser, bool* is_parenthesized_init,
bool* non_constant_p)
@@ -10895,8 +10894,6 @@
/* Assume that the initializer is constant. */
*non_constant_p = false;
- ++parsing_initializer;
-
if (token->type == CPP_EQ)
{
/* Consume the `='. */
@@ -10914,7 +10911,6 @@
init = error_mark_node;
}
- --parsing_initializer;
return init;
}
Index: llvm-gcc/gcc/cp/typeck.c
diff -u llvm-gcc/gcc/cp/typeck.c:1.5 llvm-gcc/gcc/cp/typeck.c:1.6
--- llvm-gcc/gcc/cp/typeck.c:1.5 Fri Feb 11 14:09:06 2005
+++ llvm-gcc/gcc/cp/typeck.c Sun Feb 13 21:21:43 2005
@@ -20,8 +20,6 @@
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-extern int parsing_initializer;
-
/* This file is part of the C++ front end.
It contains routines to build C++ expressions given their operands,
including computing the types of the result, C and C++ specific error
@@ -2229,7 +2227,7 @@
* instead, generate an array ref, even though the first argument is a
* pointer, not an array!
*/
- if (EMIT_LLVM && !parsing_initializer)
+ if (EMIT_LLVM)
return build (ARRAY_REF, TREE_TYPE(TREE_TYPE(ar)), ar, ind);
return build_indirect_ref (cp_build_binary_op (PLUS_EXPR, ar, ind),
@@ -3913,7 +3911,7 @@
}
/* For &x[y], return x+y */
- if (TREE_CODE (arg) == ARRAY_REF && (!EMIT_LLVM || parsing_initializer))
+ if (TREE_CODE (arg) == ARRAY_REF && !EMIT_LLVM)
{
if (!cxx_mark_addressable (TREE_OPERAND (arg, 0)))
return error_mark_node;
@@ -4054,13 +4052,11 @@
rval = build_base_path (PLUS_EXPR, rval, binfo, 1);
rval = build_nop (argtype, rval);
- if (!EMIT_LLVM || parsing_initializer)
+ if (!EMIT_LLVM)
addr = fold (build (PLUS_EXPR, argtype, rval,
cp_convert (argtype, byte_position (field))));
else
- /* For LLVM, don't fold pointer arithmetic unless parsing a
- * static initializer.
- */
+ /* For LLVM, don't fold pointer arithmetic! */
addr = fold(build1(ADDR_EXPR, argtype, arg));
}
More information about the llvm-commits
mailing list