diff options
author | Christopher Li <sparse@chrisli.org> | 2010-07-22 16:17:31 -0700 |
---|---|---|
committer | Christopher Li <sparse@chrisli.org> | 2010-07-22 16:17:31 -0700 |
commit | da07704c2037b6f9566a378eacf8381e5f5c9ba5 (patch) | |
tree | e64b4eeaa3b207af92513b23527f321f9e427805 | |
parent | skip may_alias and declare builtin_fabs (diff) | |
download | sparse-da07704c2037b6f9566a378eacf8381e5f5c9ba5.tar.gz sparse-da07704c2037b6f9566a378eacf8381e5f5c9ba5.tar.bz2 sparse-da07704c2037b6f9566a378eacf8381e5f5c9ba5.zip |
inspect: cast expression
Adding cast expression for AST inspecting.
Signed-off-by: Christopher Li <sparse@chrisli.org>
-rw-r--r-- | ast-inspect.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/ast-inspect.c b/ast-inspect.c index 293334e..5363de3 100644 --- a/ast-inspect.c +++ b/ast-inspect.c @@ -66,6 +66,12 @@ void inspect_statement(AstNode *node) ast_append_child(node, "post_statement:", stmt->iterator_post_statement, inspect_statement); break; + + case STMT_RETURN: + ast_append_child(node, "ret_value:", stmt->ret_value, inspect_expression); + ast_append_child(node, "ret_target:", stmt->ret_target, inspect_symbol); + break; + default: break; } @@ -109,7 +115,7 @@ void inspect_symbol(AstNode *node) { struct symbol *sym = node->ptr; node->text = g_strdup_printf("%s %s: %s", node->text, symbol_type_name(sym->type), - show_ident(sym->ident)); + builtin_typename(sym) ?: show_ident(sym->ident)); ast_append_child(node, "ctype.base_type:", sym->ctype.base_type,inspect_symbol); switch (sym->type) { @@ -181,6 +187,18 @@ void inspect_expression(AstNode *node) ast_append_child(node, "left:", expr->left, inspect_expression); ast_append_child(node, "right:", expr->right, inspect_expression); break; + + case EXPR_CAST: + case EXPR_FORCE_CAST: + case EXPR_IMPLIED_CAST: + ast_append_child(node, "cast_type:", expr->cast_type, inspect_symbol); + ast_append_child(node, "cast_expression:", expr->cast_expression, inspect_expression); + break; + + case EXPR_PREOP: + ast_append_child(node, "unop:", expr->unop, inspect_expression); + break; + default: break; } |