Print this page
11972 resync smatch

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/smatch/src/smatch_type.c
          +++ new/usr/src/tools/smatch/src/smatch_type.c
↓ open down ↓ 390 lines elided ↑ open up ↑
 391  391  }
 392  392  
 393  393  int returns_pointer(struct symbol *sym)
 394  394  {
 395  395          if (!sym)
 396  396                  return 0;
 397  397          sym = get_base_type(sym);
 398  398          if (!sym || sym->type != SYM_FN)
 399  399                  return 0;
 400  400          sym = get_base_type(sym);
 401      -        if (sym->type == SYM_PTR)
      401 +        if (sym && sym->type == SYM_PTR)
 402  402                  return 1;
 403  403          return 0;
 404  404  }
 405  405  
 406  406  sval_t sval_type_max(struct symbol *base_type)
 407  407  {
 408  408          sval_t ret;
 409  409  
 410  410          if (!base_type || !type_bits(base_type))
 411  411                  base_type = &llong_ctype;
↓ open down ↓ 77 lines elided ↑ open up ↑
 489  489          if (!name || !sym)
 490  490                  goto free;
 491  491  
 492  492          if (sym->ctype.modifiers & MOD_STATIC)
 493  493                  ret = 1;
 494  494  free:
 495  495          free_string(name);
 496  496          return ret;
 497  497  }
 498  498  
 499      -int is_local_variable(struct expression *expr)
      499 +bool is_local_variable(struct expression *expr)
 500  500  {
 501  501          struct symbol *sym;
 502      -        char *name;
 503  502  
 504      -        name = expr_to_var_sym(expr, &sym);
 505      -        free_string(name);
 506      -        if (!sym || !sym->scope || !sym->scope->token || !cur_func_sym)
 507      -                return 0;
 508      -        if (cmp_pos(sym->scope->token->pos, cur_func_sym->pos) < 0)
 509      -                return 0;
 510      -        if (is_static(expr))
 511      -                return 0;
 512      -        return 1;
      503 +        if (!expr || expr->type != EXPR_SYMBOL || !expr->symbol)
      504 +                return false;
      505 +        sym = expr->symbol;
      506 +        if (!(sym->ctype.modifiers & MOD_TOPLEVEL))
      507 +                return true;
      508 +        return false;
 513  509  }
 514  510  
 515  511  int types_equiv(struct symbol *one, struct symbol *two)
 516  512  {
 517  513          if (!one && !two)
 518  514                  return 1;
 519  515          if (!one || !two)
 520  516                  return 0;
 521  517          if (one->type != two->type)
 522  518                  return 0;
↓ open down ↓ 273 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX