condeval is called jump threading now
[cparser] / walk_statements.c
index 8a4cbc1..4c8a6c6 100644 (file)
@@ -1,3 +1,22 @@
+/*
+ * This file is part of cparser.
+ * Copyright (C) 2007-2009 Matthias Braun <matze@braunis.de>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ */
 #include <config.h>
 
 #include "adt/error.h"
@@ -49,12 +68,6 @@ static void walk_expression(expression_t const *const expr,
                walk_expression(expr->conditional.false_expression, callback, env);
                return;
 
-       case EXPR_BUILTIN_PREFETCH:
-               walk_expression(expr->builtin_prefetch.adr,      callback, env);
-               walk_expression(expr->builtin_prefetch.rw,       callback, env);
-               walk_expression(expr->builtin_prefetch.locality, callback, env);
-               return;
-
        case EXPR_BUILTIN_CONSTANT_P:
                walk_expression(expr->builtin_constant.value, callback, env);
                return;
@@ -81,6 +94,19 @@ static void walk_expression(expression_t const *const expr,
                return;
        }
 
+       case EXPR_VA_START:
+               walk_expression(expr->va_starte.ap, callback, env);
+               return;
+
+       case EXPR_VA_ARG:
+               walk_expression(expr->va_arge.ap, callback, env);
+               return;
+
+       case EXPR_VA_COPY:
+               walk_expression(expr->va_copye.src, callback, env);
+               walk_expression(expr->va_copye.dst, callback, env);
+               return;
+
        case EXPR_INVALID:
        case EXPR_OFFSETOF:
        case EXPR_REFERENCE:
@@ -91,10 +117,8 @@ static void walk_expression(expression_t const *const expr,
        case EXPR_STRING_LITERAL:
        case EXPR_WIDE_STRING_LITERAL:
        case EXPR_FUNCNAME:
-       case EXPR_BUILTIN_SYMBOL:
-       case EXPR_VA_START:
-       case EXPR_VA_ARG:
        case EXPR_LABEL_ADDRESS:
+       case EXPR_BUILTIN_TYPES_COMPATIBLE_P:
                break;
        }
 
@@ -120,7 +144,8 @@ static void walk_declarations(const entity_t*            entity,
                               statement_callback   const callback,
                               void                *const env)
 {
-       for (; entity != NULL; entity = entity->base.next) {
+       entity_t const *const end = last != NULL ? last->base.next : NULL;
+       for (; entity != end; entity = entity->base.next) {
                /* we only look at variables */
                if (entity->kind != ENTITY_VARIABLE)
                        continue;
@@ -130,9 +155,6 @@ static void walk_declarations(const entity_t*            entity,
                if (initializer != NULL) {
                        walk_initializer(initializer, callback, env);
                }
-
-               if (entity == last)
-                       break;
        }
 }
 
@@ -208,7 +230,6 @@ void walk_statements(statement_t *const stmt, statement_callback const callback,
                        walk_statements(stmt->ms_try.final_statement, callback, env);
                        return;
 
-               case STATEMENT_LOCAL_LABEL:
                case STATEMENT_INVALID:
                case STATEMENT_EMPTY:
                case STATEMENT_CONTINUE: