do not add searchpath stuff into parse_headername
[cparser] / ast.h
diff --git a/ast.h b/ast.h
index 0f70f3b..9223ca2 100644 (file)
--- a/ast.h
+++ b/ast.h
@@ -87,17 +87,29 @@ typedef union  statement_t                           statement_t;
 
 typedef struct translation_unit_t                    translation_unit_t;
 
-void  init_ast(void);
-void  exit_ast(void);
+/**
+ * Initialize the AST construction.
+ */
+void init_ast(void);
+
+/**
+ * Free the AST.
+ */
+void exit_ast(void);
+
+void print_expression(const expression_t *expression);
+void print_initializer(const initializer_t *initializer);
+void print_ast(const translation_unit_t *unit);
+void print_indent(void);
+void print_declaration(const entity_t *entity);
+void print_entity(const entity_t *entity);
+void change_indent(int delta);
 
-void  print_expression(const expression_t *expression);
-void  print_initializer(const initializer_t *initializer);
-void  print_ast(const translation_unit_t *unit);
-void  print_indent(void);
-void  print_declaration(const entity_t *entity);
-void  print_entity(const entity_t *entity);
-void  change_indent(int delta);
-void *allocate_ast(size_t size);
+typedef enum expression_classification_t {
+       EXPR_CLASS_VARIABLE,
+       EXPR_CLASS_ERROR,
+       EXPR_CLASS_CONSTANT
+} expression_classification_t;
 
 /**
  * Returns true if a given expression is a compile time
@@ -105,7 +117,7 @@ void *allocate_ast(size_t size);
  *
  * @param expression  the expression to check
  */
-bool is_constant_initializer(const initializer_t *initializer);
+expression_classification_t is_constant_initializer(const initializer_t *initializer);
 
 /**
  * Returns true if a given expression is a compile time
@@ -113,13 +125,16 @@ bool is_constant_initializer(const initializer_t *initializer);
  *
  * @param expression  the expression to check
  */
-bool is_constant_expression(const expression_t *expression);
+expression_classification_t is_constant_expression(const expression_t *expression);
 
 /**
- * An object with a fixed but at compiletime unknown adress which will be known
- * at link/load time.
+ * Checks if an expression is a constant/known value to the linker. Examples:
+ *  - all constant expression casted to a pointer type
+ *  - "&x", with x being a global variable.
+ *  - "array" or "a.array" in case array is an array and array and a,
+ *  respectively is an object with link time constant address
  */
-bool is_address_constant(const expression_t *expression);
+expression_classification_t is_linker_constant(const expression_t *expression);
 
 long fold_constant_to_int(const expression_t *expression);
 bool fold_constant_to_bool(const expression_t *expression);