aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-05-16 14:15:44 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-05-21 03:06:27 +0200
commita6c549b2e17333a385e6d9eb3962a05471b56985 (patch)
treee0f73527a1e2a308046c609d00be0d06b3cced24
parentb5b7da4222c11ab90c736bda471dfa46685ee320 (diff)
downloadsparse-dev-a6c549b2e17333a385e6d9eb3962a05471b56985.tar.gz
autodoc: document a few more APIs to test multiline
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--Documentation/api.rst10
-rw-r--r--evaluate.h15
-rw-r--r--expression.h18
3 files changed, 41 insertions, 2 deletions
diff --git a/Documentation/api.rst b/Documentation/api.rst
index 8b6f0401..d1a1d3ca 100644
--- a/Documentation/api.rst
+++ b/Documentation/api.rst
@@ -9,3 +9,13 @@ Utilities
~~~~~~~~~
.. c:autodoc:: ptrlist.c
+
+Parsing
+~~~~~~~
+
+.. c:autodoc:: expression.h
+
+Typing
+~~~~~~
+
+.. c:autodoc:: evaluate.h
diff --git a/evaluate.h b/evaluate.h
index 36de7d69..f68f7fb7 100644
--- a/evaluate.h
+++ b/evaluate.h
@@ -6,8 +6,23 @@ struct statement;
struct symbol;
struct symbol_list;
+///
+// evaluate the type of an expression
+// @expr: the expression to be evaluated
+// @return: the type of the expression or ``NULL``
+// if the expression can't be evaluated
struct symbol *evaluate_expression(struct expression *expr);
+
+///
+// evaluate the type of a statement
+// @stmt: the statement to be evaluated
+// @return: the type of the statement or ``NULL``
+// if it can't be evaluated
struct symbol *evaluate_statement(struct statement *stmt);
+
+///
+// evaluate the type of a set of symbols
+// @list: the list of the symbol to be evaluated
void evaluate_symbol_list(struct symbol_list *list);
#endif
diff --git a/expression.h b/expression.h
index b5fa9bc1..ba4157fd 100644
--- a/expression.h
+++ b/expression.h
@@ -243,9 +243,23 @@ struct expression {
};
};
-/* Constant expression values */
-int is_zero_constant(struct expression *);
+///
+// Constant expression values
+// --------------------------
+
+///
+// test if an expression evaluates to the constant ``0``.
+// @return: ``1`` if @expr evaluate to ``0``,
+// ``0`` otherwise.
+int is_zero_constant(struct expression *expr);
+
+///
+// test the compile time truth value of an expression
+// @return:
+// * ``-1`` if @expr is not constant,
+// * ``0`` or ``1`` depending on the truth value of @expr.
int expr_truth_value(struct expression *expr);
+
long long get_expression_value(struct expression *);
long long const_expression_value(struct expression *);
long long get_expression_value_silent(struct expression *expr);