Print this page
new smatch

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/smatch/src/smatch_modification_hooks.c
          +++ new/usr/src/tools/smatch/src/smatch_modification_hooks.c
↓ open down ↓ 135 lines elided ↑ open up ↑
 136  136                  }
 137  137  
 138  138          } END_FOR_EACH_SM(sm);
 139  139  }
 140  140  
 141  141  static void call_modification_hooks(struct expression *expr, struct expression *mod_expr, int late)
 142  142  {
 143  143          char *name;
 144  144          struct symbol *sym;
 145  145  
 146      -        if (late == LATE)
 147      -                update_mtag_data(expr);
 148      -
 149  146          name = expr_to_known_chunk_sym(expr, &sym);
 150  147          if (!name)
 151  148                  goto free;
 152  149          call_modification_hooks_name_sym(name, sym, mod_expr, late);
 153  150  free:
 154  151          free_string(name);
 155  152  }
 156  153  
 157  154  static void db_param_add(struct expression *expr, int param, char *key, char *value)
 158  155  {
 159      -        struct expression *arg, *gen_expr;
      156 +        struct expression *arg;
 160  157          char *name, *other_name;
 161  158          struct symbol *sym, *other_sym;
 162  159  
 163  160          while (expr->type == EXPR_ASSIGNMENT)
 164  161                  expr = strip_expr(expr->right);
 165  162          if (expr->type != EXPR_CALL)
 166  163                  return;
 167  164  
 168  165          arg = get_argument_from_call_expr(expr->args, param);
 169  166          if (!arg)
 170  167                  return;
 171  168  
 172      -        gen_expr = gen_expression_from_key(arg, key);
 173      -        if (gen_expr)
 174      -                update_mtag_data(gen_expr);
 175      -
 176  169          name = get_variable_from_key(arg, key, &sym);
 177  170          if (!name || !sym)
 178  171                  goto free;
 179  172  
 180  173          __in_fake_assign++;
 181  174          call_modification_hooks_name_sym(name, sym, expr, BOTH);
 182  175          __in_fake_assign--;
 183  176  
 184  177          other_name = get_other_name_sym(name, sym, &other_sym);
 185  178          if (other_name) {
↓ open down ↓ 33 lines elided ↑ open up ↑
 219  212                  if (tmp->type == EXPR_PREOP && tmp->op == '&')
 220  213                          call_modification_hooks(tmp->unop, expr, BOTH);
 221  214                  else
 222  215                          call_modification_hooks(deref_expression(tmp), expr, BOTH);
 223  216          } END_FOR_EACH_PTR(arg);
 224  217  }
 225  218  
 226  219  static void asm_expr(struct statement *stmt, int late)
 227  220  {
 228  221          struct expression *expr;
 229      -        int state = 0;
 230  222  
 231  223          FOR_EACH_PTR(stmt->asm_outputs, expr) {
 232      -                switch (state) {
 233      -                case 0: /* identifier */
 234      -                case 1: /* constraint */
 235      -                        state++;
      224 +                if (expr->type != EXPR_ASM_OPERAND)
 236  225                          continue;
 237      -                case 2: /* expression */
 238      -                        state = 0;
 239      -                        call_modification_hooks(expr, NULL, late);
 240      -                        continue;
 241      -                }
      226 +                call_modification_hooks(expr->expr, NULL, late);
 242  227          } END_FOR_EACH_PTR(expr);
 243  228  }
 244  229  
 245      -
 246  230  static void match_assign_early(struct expression *expr)
 247  231  {
 248  232          match_assign(expr, EARLY);
 249  233  }
 250  234  
 251  235  static void unop_expr_early(struct expression *expr)
 252  236  {
 253  237          unop_expr(expr, EARLY);
 254  238  }
 255  239  
↓ open down ↓ 53 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX