From be2e3b8126faf869a608db4d91c57f25a532f55b Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Thu, 6 Dec 2007 15:24:44 +0000 Subject: [PATCH] add preliminary support for __assume() [r18626] --- ast.c | 4 ++++ ast_t.h | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ast.c b/ast.c index f8a1c18..86ee507 100644 --- a/ast.c +++ b/ast.c @@ -223,6 +223,9 @@ static void print_unary_expression(const unary_expression_t *unexpr) case EXPR_UNARY_CAST_IMPLICIT: print_expression(unexpr->value); return; + case EXPR_UNARY_ASSUME: + fputs("__assume", out); + break; default: panic("invalid unary expression found"); } @@ -779,6 +782,7 @@ bool is_constant_expression(const expression_t *expression) case EXPR_UNARY_POSTFIX_DECREMENT: case EXPR_UNARY_PREFIX_INCREMENT: case EXPR_UNARY_PREFIX_DECREMENT: + case EXPR_UNARY_ASSUME: /* has VOID type */ case EXPR_BINARY_ASSIGN: case EXPR_BINARY_MUL_ASSIGN: case EXPR_BINARY_DIV_ASSIGN: diff --git a/ast_t.h b/ast_t.h index bbabdca..0f5f420 100644 --- a/ast_t.h +++ b/ast_t.h @@ -46,8 +46,9 @@ typedef enum { EXPR_UNARY_PREFIX_INCREMENT, EXPR_UNARY_PREFIX_DECREMENT, EXPR_UNARY_CAST, - EXPR_UNARY_CAST_IMPLICIT, /* compiler generated cast */ - EXPR_UNARY_LAST = EXPR_UNARY_CAST_IMPLICIT, + EXPR_UNARY_CAST_IMPLICIT, /**< compiler generated cast */ + EXPR_UNARY_ASSUME, /**< MS __assume() */ + EXPR_UNARY_LAST = EXPR_UNARY_ASSUME, EXPR_BINARY_FIRST, EXPR_BINARY_ADD = EXPR_BINARY_FIRST, @@ -143,7 +144,8 @@ typedef enum { case EXPR_UNARY_PREFIX_INCREMENT: \ case EXPR_UNARY_PREFIX_DECREMENT: \ case EXPR_UNARY_CAST: \ - case EXPR_UNARY_CAST_IMPLICIT: + case EXPR_UNARY_CAST_IMPLICIT: \ + case EXPR_UNARY_ASSUME: struct context_t { declaration_t *declarations; -- 2.20.1