00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00066 #ifndef CTRUMP_PARSER_AST_H
00067 #define CTRUMP_PARSER_AST_H
00068 
00069 #include "ctrump/ast/types.h"
00070 #include "ctrump/ast/location.h"
00071 #include "ctrump/ast/source-string.h"
00072 #include "ctrump/analyzer/loop.h"
00073 #include "ctrump/analyzer/cfg.h"
00074 #include "ctrump/ast/expr-code.h"
00075 #include "ctrump/ast/abi.h"
00076 #include "ctrump/common/dll.h"
00077 
00078 #ifdef __cplusplus
00079 extern "C" {
00080 #endif
00081 
00082 struct ctrump_expr;
00083 struct ctrump_initializer_list;
00084 struct ctrump_declarator;
00085 struct ctrump_stmt;
00086 struct ctrump_decl;
00087 struct ctrump_decl_specifier;
00088 struct ctrump_translation_unit;
00089 
00093 enum ctrump_designator_code {
00094     CTRUMP_DESIGNATOR_IDENT,    
00095     CTRUMP_DESIGNATOR_INDEX,    
00096 };
00097 
00101 enum ctrump_initializer_code {
00102     CTRUMP_INITIALIZER_EMPTY,   
00103     CTRUMP_INITIALIZER_EXPR,    
00104     CTRUMP_INITIALIZER_NESTED   
00105 };
00106 
00110 struct ctrump_initializer {
00111     enum ctrump_initializer_code code; 
00112     union {
00113         struct ctrump_expr *expr; 
00114         struct ctrump_initializer_list *nest; 
00115     }u;
00116 };
00117 
00121 struct ctrump_designator_index {
00122     struct ctrump_location lbr_loc; 
00123     struct ctrump_location rbr_loc; 
00124     struct ctrump_expr *index;      
00125 };
00126 
00130 struct ctrump_designator_ident {
00131     struct ctrump_location dot_loc; 
00132     struct ctrump_location name_loc; 
00133     const struct ctrump_symbol *ident; 
00134 };
00135 
00139 struct ctrump_designator {
00140     enum ctrump_designator_code code;
00141     union {
00142         struct ctrump_designator_index index; 
00143         struct ctrump_designator_ident ident; 
00144     }u;
00145 };
00146 
00150 struct ctrump_initializer_list_elem {
00151     struct ctrump_location left_comma_loc; 
00152     struct ctrump_location eq_loc;         
00153     int num_designator;         
00154     struct ctrump_designator *designators_list; 
00155     struct ctrump_initializer initializer;      
00156 };
00157 
00158 #define CTRUMP_INITIALIZER_HAVE_LAST_COMMA (1<<0) 
00163 struct ctrump_initializer_list {
00164     int id;
00165     struct ctrump_location lbr_loc; 
00166     struct ctrump_location last_comma_loc; 
00167     struct ctrump_location rbr_loc;        
00168     int hints_for_printer;                 
00169     int num_elem;                          
00170     struct ctrump_initializer_list_elem *elems; 
00171 };
00172 
00176 struct ctrump_record_definition {
00177     struct ctrump_location lbr_loc; 
00178     struct ctrump_location rbr_loc; 
00179     int num_decl;               
00180     int num_field;              
00181     struct ctrump_gccext_attribute attr; 
00182     struct ctrump_struct_decl *decls;    
00183     
00184     struct ctrump_texpr *record_type; 
00185 };
00186 
00190 struct ctrump_named_record_definition {
00191     struct ctrump_location kwd_loc; 
00192     struct ctrump_location name_loc; 
00193     const struct ctrump_symbol *name; 
00194     struct ctrump_record_definition def; 
00195 };
00196 
00200 struct ctrump_anon_record_definition {
00201     struct ctrump_location kwd_loc; 
00202     struct ctrump_record_definition def; 
00203 };
00204 
00208 struct ctrump_typespec_record_name {
00209     struct ctrump_location kwd_loc; 
00210     struct ctrump_location name_loc; 
00211     const struct ctrump_symbol *name; 
00212     struct ctrump_texpr *texpr;       
00213 };
00214 
00218 struct ctrump_typespec_enum_name {
00219     struct ctrump_location kwd_loc; 
00220     struct ctrump_location name_loc; 
00221     const struct ctrump_symbol *name; 
00222     struct ctrump_texpr *texpr;       
00223 };
00224 
00228 struct ctrump_enum_list_elem {
00229     struct ctrump_location name_loc; 
00230     struct ctrump_location eq_loc;   
00231     struct ctrump_location comma_loc; 
00232     const struct ctrump_symbol *name; 
00233     struct ctrump_expr *value;  
00234 };
00235 
00236 
00237 #define CTRUMP_ENUM_LIST_HAVE_LAST_COMMA (1<<0)
00238 
00242 struct ctrump_enum_list {
00243     struct ctrump_location lbr_loc; 
00244     struct ctrump_location rbr_loc; 
00245     struct ctrump_location comma_loc; 
00246     int flags;                        
00247     int num_elem;                     
00248     struct ctrump_enum_list_elem *elems; 
00249 };
00250 
00254 struct ctrump_anon_enum_definition {
00255     struct ctrump_location kwd_loc; 
00256     struct ctrump_enum_list list;   
00257 };
00258 
00262 struct ctrump_named_enum_definition {
00263     struct ctrump_location kwd_loc; 
00264     struct ctrump_location name_loc; 
00265     const struct ctrump_symbol *name; 
00266     struct ctrump_enum_list list;     
00267 };
00268 
00269 
00273 enum ctrump_typespec_code {
00274     CTRUMP_TYPESPEC_BUILTIN, 
00275     CTRUMP_TYPESPEC_UNTYPED_SIGNED_INT, 
00276     CTRUMP_TYPESPEC_TYPEDEF_NAME, 
00277 
00278     CTRUMP_TYPESPEC_STRUCT_NAME, 
00279     CTRUMP_TYPESPEC_STRUCT_DEFINITION, 
00280     CTRUMP_TYPESPEC_UNION_NAME, 
00281     CTRUMP_TYPESPEC_UNION_DEFINITION, 
00282     CTRUMP_TYPESPEC_ANON_STRUCT_DEFINITION, 
00283     CTRUMP_TYPESPEC_ANON_UNION_DEFINITION, 
00284 
00285     CTRUMP_TYPESPEC_ENUM_NAME,  
00286     CTRUMP_TYPESPEC_ENUM_DEFINITION,  
00287     CTRUMP_TYPESPEC_ANON_ENUM_DEFINITION 
00288 };
00289 
00293 struct ctrump_typespec_typedef_name {
00294     struct ctrump_location loc; 
00295     const struct ctrump_symbol *name; 
00296     struct ctrump_texpr *texpr;       
00297 };
00298 
00302 struct ctrump_typespec_builtin {
00303     struct ctrump_location loc; 
00304     struct ctrump_texpr *texpr; 
00305 };
00306 
00310 struct ctrump_typespec {
00311     enum ctrump_typespec_code code;
00312     union {
00313         struct ctrump_typespec_builtin builtin; 
00314         struct ctrump_typespec_typedef_name typedef_name; 
00315 
00316         struct ctrump_typespec_record_name struct_name; 
00317         struct ctrump_typespec_record_name union_name;  
00318         struct ctrump_anon_record_definition anon_struct_definition; 
00319         struct ctrump_anon_record_definition anon_union_definition; 
00320         struct ctrump_named_record_definition struct_definition; 
00321         struct ctrump_named_record_definition union_definition; 
00322 
00323         struct ctrump_typespec_enum_name enum_name; 
00324         struct ctrump_named_enum_definition enum_definition; 
00325         struct ctrump_anon_enum_definition anon_enum_definition; 
00326     } u;
00327 };
00328 
00332 enum ctrump_func_specifier {
00333     CTRUMP_FUNC_SPEC_INLINE,
00334     CTRUMP_FUNC_SPEC_UNSPECIFIED
00335 };
00336 
00340 enum ctrump_stor_class {
00341     CTRUMP_STOR_CLASS_EXTERN,   
00342     CTRUMP_STOR_CLASS_STATIC,   
00343     CTRUMP_STOR_CLASS_AUTO,     
00344     CTRUMP_STOR_CLASS_REGISTER, 
00345     CTRUMP_STOR_CLASS_TYPEDEF,  
00346     CTRUMP_STOR_CLASS_AUTO_UNSPECIFIED, 
00347     CTRUMP_STOR_CLASS_EXTDEF,   
00348     CTRUMP_STOR_CLASS_ARGMENT,  
00349     CTRUMP_STOR_CLASS_FIELD     
00350 };
00351 
00356 struct ctrump_decl_specifier {
00357     struct ctrump_location begin; 
00358     enum ctrump_stor_class stor_class; 
00359     enum ctrump_func_specifier func_spec; 
00360     int qual_flags;                       
00361     struct ctrump_gccext_attribute attr;  
00362     struct ctrump_typespec type_spec;     
00363 };
00364 
00370 CTRUMP_EXTDEF extern int ctrump_expr_prec_table[];
00371 
00375 struct ctrump_binary_expr {
00376     struct ctrump_location op_loc; 
00377     struct ctrump_expr *lhs;       
00378     struct ctrump_expr *rhs;       
00379 };
00380 
00384 struct ctrump_cond_expr {
00385     struct ctrump_location question_loc; 
00386     struct ctrump_location colon_loc;    
00387     struct ctrump_expr *cond;            
00388     struct ctrump_expr *then_;           
00389     struct ctrump_expr *else_;           
00390 };
00391 
00395 struct ctrump_call_expr {
00396     struct ctrump_expr *func_expr; 
00397     int num_args;                  
00398     struct ctrump_location lpar_loc; 
00399     struct ctrump_location rpar_loc; 
00400     struct ctrump_expr *args;   
00401 };
00402 
00406 struct ctrump_var {
00407     int id;
00408     enum ctrump_stor_class stor_class; 
00409     struct ctrump_texpr *type;         
00410     int var_aligned;                   
00411     int addressed;                     
00412     const struct ctrump_symbol *name;  
00413 };
00414 
00418 struct ctrump_varref_expr {
00419     struct ctrump_location loc; 
00420     struct ctrump_var *var;     
00421     struct ctrump_pdg_node *pdg; 
00422 };
00423 
00427 struct ctrump_typename {
00428     struct ctrump_location lpar_loc; 
00429     struct ctrump_location rpar_loc; 
00430     struct ctrump_decl_specifier spec; 
00431     struct ctrump_declarator *abstract_decl; 
00432 };
00433 
00437 struct ctrump_cast_expr {
00438     struct ctrump_expr *expr;   
00439     struct ctrump_texpr *cast_to; 
00440     struct ctrump_typename typename_; 
00441 };
00442 
00446 struct ctrump_implicit_cast_expr {
00447     struct ctrump_expr *expr;   
00448     struct ctrump_texpr *cast_to; 
00449 };
00450 
00454 struct ctrump_initializer_expr {
00455     struct ctrump_typename typename_; 
00456     struct ctrump_initializer_list initializer; 
00457 };
00458 
00462 struct ctrump_macro_expand_expr {
00463     struct ctrump_expr *expanded;
00464 };
00465 
00469 struct ctrump_sizeof_type {
00470     struct ctrump_location sizeof_id_loc; 
00471     struct ctrump_typename typename_;     
00472     struct ctrump_texpr *texpr;           
00473 };
00474 
00478 struct ctrump_member_ref {
00479     struct ctrump_location op_loc; 
00480     struct ctrump_location symbol_loc; 
00481     struct ctrump_expr *obj_expr;      
00482     const struct ctrump_symbol *member_name; 
00483 };
00484 
00488 struct ctrump_string_literal {
00489     struct ctrump_location loc; 
00490     int is_wide;                
00491     struct ctrump_source_string literal; 
00492 };
00493 
00497 struct ctrump_string_literal_list {
00498     int num_str_literal;
00499     struct ctrump_string_literal *literals; 
00500 };
00501 
00505 struct ctrump_arr_ref_expr {
00506     struct ctrump_location lbr_loc; 
00507     struct ctrump_location rbr_loc; 
00508     struct ctrump_expr *array;      
00509     struct ctrump_expr *subscript;  
00510 };
00511 
00516 struct ctrump_paren_expr {
00517     struct ctrump_location lpar_loc; 
00518     struct ctrump_location rpar_loc; 
00519     struct ctrump_expr *expr;        
00520 };
00521 
00525 struct ctrump_unary_expr {
00526     struct ctrump_location op_loc; 
00527     struct ctrump_expr *expr;      
00528 };
00529 
00533 struct ctrump_float_literal {
00534     struct ctrump_location loc; 
00535     struct ctrump_source_string literal; 
00536 };
00537 
00541 struct ctrump_integer_literal {
00542     struct ctrump_location loc; 
00543     struct ctrump_source_string literal; 
00544     int value;                           
00545 };
00546 
00547 
00562 struct ctrump_ivtmp {
00563     struct ctrump_expr *original_expr;
00564     
00565 };
00566 
00570 struct ctrump_expr {
00571     int id;
00572     enum ctrump_expr_code code; 
00574     struct ctrump_source_string source_text; 
00575     struct ctrump_texpr *type; 
00577     union {
00578         struct ctrump_binary_expr binary; 
00579         struct ctrump_arr_ref_expr arr_ref; 
00580         struct ctrump_paren_expr paren;    
00581         struct ctrump_unary_expr unary; 
00582         struct ctrump_cond_expr cond;     
00583         struct ctrump_call_expr call;     
00584         struct ctrump_member_ref member_ref; 
00585         struct ctrump_float_literal float_literal; 
00586         struct ctrump_float_literal double_literal; 
00587         struct ctrump_float_literal long_double_literal; 
00588         struct ctrump_integer_literal sint_literal;       
00589         struct ctrump_integer_literal uint_literal;       
00590         struct ctrump_integer_literal slong_literal;     
00591         struct ctrump_integer_literal ulong_literal;     
00592         struct ctrump_integer_literal sllong_literal;   
00593         struct ctrump_integer_literal ullong_literal;   
00594         struct ctrump_varref_expr varref; 
00595         struct ctrump_string_literal_list str_literal; 
00596         struct ctrump_cast_expr cast; 
00597         struct ctrump_implicit_cast_expr implicit_cast; 
00598         struct ctrump_initializer_expr initializer; 
00599         struct ctrump_sizeof_type sizeof_type; 
00600 
00601         struct ctrump_ivtmp ivtmp; 
00602 
00603         struct ctrump_macro_expand_expr macro_expand; 
00604         char *text;                        
00605     } u;
00606 };
00607 
00611 enum ctrump_declarator_code {
00612     CTRUMP_DECLARATOR_IDENTIFIER, 
00613     CTRUMP_DECLARATOR_EMPTY,   
00614     CTRUMP_DECLARATOR_POINTER,  
00615     CTRUMP_DECLARATOR_ARRAY,    
00616     CTRUMP_DECLARATOR_VARLEN_ARRAY,    
00617     CTRUMP_DECLARATOR_INCOMPLETE_ARRAY,    
00618     CTRUMP_DECLARATOR_PARAM_TYPELIST, 
00619     CTRUMP_DECLARATOR_PARAM_IDENTIFIER_LIST, 
00620     CTRUMP_DECLARATOR_PAREN                 
00621 };
00622 
00623 struct ctrump_declarator;
00624 
00635 struct ctrump_declarator_pointer {
00636     struct ctrump_declarator_node *decl; 
00637     struct ctrump_location star_loc;     
00638     int qual_flags;                      
00639     struct ctrump_gccext_attribute attr; 
00640 };
00641 
00651 struct ctrump_declarator_array {
00652     struct ctrump_location lbr_loc; 
00653     struct ctrump_location rbr_loc; 
00654     int qual_flags;                 
00655     struct ctrump_declarator_node *decl; 
00656     struct ctrump_expr size;             
00657 };
00658 
00663 struct ctrump_declarator_param {
00664     struct ctrump_location left_comma_loc; 
00665     struct ctrump_decl_specifier decl_spec; 
00666     struct ctrump_declarator *decl;         
00667 };
00668 
00682 struct ctrump_declarator_param_typelist {
00683     struct ctrump_location lpar_loc; 
00684     struct ctrump_location unspec_comma_loc; 
00685     struct ctrump_location unspec_arg_loc;   
00686     struct ctrump_location rpar_loc;         
00687     struct ctrump_declarator_node *decl;     
00688     int num_args;                            
00689     int has_unspecified_arg;                 
00690     struct ctrump_declarator_param *args;    
00691 };
00692 
00697 struct ctrump_declarator_idlist_param {
00698     struct ctrump_location comma_loc; 
00699     struct ctrump_location id_loc;    
00700     struct ctrump_symbol *name;   
00701 };
00702 
00712 struct ctrump_declarator_param_idlist {
00713     struct ctrump_location lpar_loc; 
00714     struct ctrump_location rpar_loc; 
00715     int num_args;                    
00717     struct ctrump_declarator_node *decl;                
00718     struct ctrump_declarator_idlist_param *identifiers; 
00719 };
00720 
00729 struct ctrump_declarator_identifier {
00730     struct ctrump_location loc; 
00731     const struct ctrump_symbol *identifier; 
00732 };
00733 
00743 struct ctrump_declarator_varlen_array {
00744     struct ctrump_location lbr_loc; 
00745     struct ctrump_location rbr_loc; 
00746     struct ctrump_location star_loc; 
00747     int qual_flags;                  
00748     struct ctrump_declarator_node *decl; 
00749 };
00750 
00760 struct ctrump_declarator_incomplete_array {
00761     struct ctrump_location lbr_loc; 
00762     struct ctrump_location rbr_loc; 
00763     int qual_flags;                 
00764     struct ctrump_declarator_node *decl; 
00765 };
00766 
00771 struct ctrump_declarator_paren {
00772     struct ctrump_location lpar_loc; 
00773     struct ctrump_location rpar_loc; 
00774     struct ctrump_declarator_node *decl; 
00775 };
00776 
00780 struct ctrump_declarator_node {
00781     int id;
00782     enum ctrump_declarator_code code;
00783     union {
00784         struct ctrump_declarator_identifier identifier; 
00785         struct ctrump_declarator_pointer pointer; 
00786         struct ctrump_declarator_array array;     
00787         struct ctrump_declarator_varlen_array varlen_array; 
00788         struct ctrump_declarator_param_typelist param_typelist; 
00789         struct ctrump_declarator_param_idlist param_id_list; 
00790         struct ctrump_declarator_incomplete_array incomplete_array; 
00791         struct ctrump_declarator_paren paren;            
00792     }u;
00793 };
00794 
00798 struct ctrump_declarator {
00799     int id;
00800     struct ctrump_gccext_attribute attr; 
00801     struct ctrump_declarator_node nodes;
00802     struct ctrump_source_string comment;
00803 };
00804 
00808 struct ctrump_decl_with_init {
00809     struct ctrump_declarator *decl;  
00810     struct ctrump_var *declared_var; 
00811     struct ctrump_location eq_loc; 
00812     struct ctrump_initializer initializer; 
00813 };
00814 
00818 struct ctrump_decl {
00819     struct ctrump_location semi_loc; 
00821     
00822     struct ctrump_decl_specifier spec; 
00824     
00825     int num_decls;                       
00826     struct ctrump_decl_with_init *decls; 
00827 };
00828 
00832 struct ctrump_struct_declarator {
00833     struct ctrump_location colon_loc;  
00834     struct ctrump_declarator *decl; 
00835     struct ctrump_expr *bitfield_expr; 
00836 };
00837 
00841 enum ctrump_struct_decl_code {
00842     CTRUMP_STRUCT_DECL_EMPTY,   
00843     CTRUMP_STRUCT_DECL_FIELDS   
00844 };
00845 
00849 struct ctrump_struct_decl_decl {
00850     
00851     struct ctrump_decl_specifier spec; 
00852     int num_decls;                     
00853     struct ctrump_struct_declarator *decls; 
00854 };
00855 
00859 struct ctrump_struct_decl {
00860     enum ctrump_struct_decl_code code; 
00861     struct ctrump_location semi_loc;   
00863     union {
00864         struct ctrump_struct_decl_decl decl; 
00865     } u;
00866 };
00867 
00871 struct ctrump_ifdef_stmt {
00872     int true_block_index;
00873     int num_block;
00874     struct ctrump_source_string *cond_source_text; 
00875     struct ctrump_source_string *body_source_text; 
00876     struct ctrump_stmt *body;
00877 };
00878 
00882 enum ctrump_stmt_code {
00883     CTRUMP_STMT_LABELED,        
00884     CTRUMP_STMT_CASE,           
00885     CTRUMP_STMT_DEFAULT,        
00886     CTRUMP_STMT_COMPOUND,       
00887     CTRUMP_STMT_EXPR,           
00888     CTRUMP_STMT_DECL,           
00889     CTRUMP_STMT_IF,             
00890     CTRUMP_STMT_IF_ELSE,        
00891     CTRUMP_STMT_SWITCH,         
00892     CTRUMP_STMT_FOR,            
00893     CTRUMP_STMT_FOR_DECL,       
00894     CTRUMP_STMT_WHILE,          
00895     CTRUMP_STMT_DO_WHILE,       
00896     CTRUMP_STMT_GOTO,           
00897     CTRUMP_STMT_CONTINUE,       
00898     CTRUMP_STMT_BREAK,          
00899     CTRUMP_STMT_RETURN_EXPR,    
00900     CTRUMP_STMT_RETURN,         
00901     CTRUMP_STMT_PRAGMA,         
00902     CTRUMP_STMT_SLASLA_COMMENT, 
00903     CTRUMP_STMT_SLAAST_COMMENT, 
00904     CTRUMP_STMT_IFDEF,          
00905     CTRUMP_STMT_ASM,            
00906     CTRUMP_STMT_DEFINE,         
00907     CTRUMP_STMT_UNDEF,          
00908     CTRUMP_STMT_NEWLINE,        
00909     CTRUMP_STMT_LIST,           
00910     CTRUMP_STMT_EMPTY           
00911 };
00912 
00916 struct ctrump_labeled_stmt {
00917     struct ctrump_location label_loc; 
00918     struct ctrump_location colon_loc; 
00919     const struct ctrump_symbol *label_symbol; 
00920     struct ctrump_stmt *stmt;                 
00921 };
00922 
00926 struct ctrump_case_stmt {
00927     struct ctrump_location kwd_loc; 
00928     struct ctrump_location colon_loc; 
00929     struct ctrump_expr val;           
00930     struct ctrump_stmt *stmt;         
00931 };
00932 
00936 struct ctrump_default_stmt { 
00937     struct ctrump_location kwd_loc; 
00938     struct ctrump_location colon_loc; 
00939     struct ctrump_stmt *stmt;         
00940 };
00941 
00945 struct ctrump_expr_stmt {
00946     struct ctrump_location semi_loc; 
00947     struct ctrump_expr expr;         
00948 };
00949 
00953 struct ctrump_if_stmt {
00954     struct ctrump_location kwd_loc; 
00955     struct ctrump_location lpar_loc; 
00956     struct ctrump_location rpar_loc; 
00957     struct ctrump_expr cond;         
00958     struct ctrump_stmt *body;        
00959 };
00960 
00964 struct ctrump_if_else_stmt {
00965     struct ctrump_location kwd_loc; 
00966     struct ctrump_location lpar_loc; 
00967     struct ctrump_location rpar_loc; 
00968     struct ctrump_location else_loc; 
00969     struct ctrump_expr cond;         
00970     struct ctrump_stmt *then_body;   
00971     struct ctrump_stmt *else_body;   
00972 };
00973 
00977 struct ctrump_switch_stmt {
00978     struct ctrump_location kwd_loc; 
00979     struct ctrump_location lpar_loc; 
00980     struct ctrump_location rpar_loc; 
00981     struct ctrump_expr cond;         
00982     struct ctrump_stmt *body;        
00983 };
00984 
00988 struct ctrump_for_stmt {
00989     struct ctrump_location kwd_loc; 
00990     struct ctrump_location lpar_loc; 
00991     struct ctrump_location rpar_loc; 
00992     struct ctrump_location semi_loc1; 
00993     struct ctrump_location semi_loc2; 
00995     struct ctrump_loop_cfg_info *loop_cfg; 
00996     struct ctrump_expr init;               
00997     struct ctrump_expr cond;               
00998     struct ctrump_expr iter;               
00999     struct ctrump_stmt *body;              
01000 };
01001 
01005 struct ctrump_for_decl_stmt {
01006     struct ctrump_location kwd_loc; 
01007     struct ctrump_location lpar_loc; 
01008     struct ctrump_location rpar_loc; 
01009     struct ctrump_location semi_loc; 
01010     struct ctrump_loop_cfg_info *loop_cfg; 
01011     struct ctrump_decl init;               
01012     struct ctrump_expr cond;               
01013     struct ctrump_expr iter;               
01014     struct ctrump_stmt *body;              
01015 };
01016 
01020 struct ctrump_while_stmt {
01021     struct ctrump_location kwd_loc; 
01022     struct ctrump_location lpar_loc; 
01023     struct ctrump_location rpar_loc; 
01024     struct ctrump_loop_cfg_info *loop_cfg; 
01025     struct ctrump_expr cond;               
01026     struct ctrump_stmt *body;              
01027 };
01028 
01032 struct ctrump_do_while_stmt {
01033     struct ctrump_location do_loc; 
01034     struct ctrump_location lpar_loc; 
01035     struct ctrump_location rpar_loc; 
01036     struct ctrump_location while_loc; 
01037     struct ctrump_location semi_loc;  
01039     struct ctrump_expr cond;    
01040     struct ctrump_stmt *body;   
01041 };
01042 
01046 struct ctrump_goto_stmt {
01047     struct ctrump_location kwd_loc; 
01048     struct ctrump_location label_loc; 
01049     struct ctrump_location semi_loc;  
01050     const struct ctrump_symbol *label; 
01051 };
01052 
01056 struct ctrump_return_expr_stmt {
01057     struct ctrump_location kwd_loc; 
01058     struct ctrump_location semi_loc; 
01059     struct ctrump_expr retval;       
01060 };
01061 
01065 struct ctrump_compound_stmt {
01066     int num_item;               
01067     struct ctrump_location lbr_loc; 
01068     struct ctrump_location rbr_loc; 
01069     struct ctrump_stmt *items;  
01070 };
01071 
01072 
01073 #define CTRUMP_ASM_HAVE_OUTPUT 0
01074 #define CTRUMP_ASM_HAVE_INPUT 1
01075 #define CTRUMP_ASM_HAVE_CLOBBER 2
01076 
01080 struct ctrump_asm_stmt_reg {
01081     struct ctrump_expr expr;
01082     struct ctrump_source_string reg_text;
01083 };
01084 
01088 struct ctrump_asm_stmt_clobber {
01089     struct ctrump_source_string reg_text;
01090 };
01091 
01095 struct ctrump_asm_stmt {
01096     int flags;
01097     struct ctrump_source_string inst_string;
01098     int num_input;
01099     int num_output;
01100     int num_clobber;
01101     struct ctrump_asm_stmt_reg *inputs; 
01102     struct ctrump_asm_stmt_reg *outputs; 
01103     struct ctrump_asm_stmt_clobber *clobbers; 
01104 };
01105 
01109 struct ctrump_continue_stmt {
01110     struct ctrump_location kwd_loc; 
01111     struct ctrump_location semi_loc; 
01112 };
01113 
01117 struct ctrump_break_stmt {
01118     struct ctrump_location kwd_loc; 
01119     struct ctrump_location semi_loc; 
01120 };
01121 
01125 struct ctrump_return_stmt {
01126     struct ctrump_location kwd_loc; 
01127     struct ctrump_location semi_loc; 
01128 };
01129 
01133 struct ctrump_empty_stmt {
01134     struct ctrump_location semi_loc; 
01135 };
01136 
01140 struct ctrump_stmt_list {
01141     int num_stmt;               
01142     struct ctrump_stmt *stmts;  
01143 };
01144 
01148 struct ctrump_stmt {
01149     int id;
01150     enum ctrump_stmt_code code; 
01151     struct ctrump_source_string source_text; 
01152     union {
01153         struct ctrump_labeled_stmt labeled; 
01154         struct ctrump_case_stmt case_;      
01155         struct ctrump_default_stmt default_; 
01156         struct ctrump_compound_stmt compound; 
01157         struct ctrump_expr_stmt expr;         
01158         struct ctrump_decl decl;               
01159         struct ctrump_if_stmt if_;            
01160         struct ctrump_if_else_stmt if_else;   
01161         struct ctrump_switch_stmt switch_;    
01162         struct ctrump_for_stmt for_;          
01163         struct ctrump_for_decl_stmt for_decl; 
01164         struct ctrump_while_stmt while_;      
01165         struct ctrump_do_while_stmt do_while; 
01166         struct ctrump_goto_stmt goto_;        
01167         struct ctrump_continue_stmt continue_; 
01168         struct ctrump_break_stmt break_; 
01169         struct ctrump_return_expr_stmt ret_expr;   
01170         struct ctrump_return_stmt return_;   
01171         struct ctrump_asm_stmt asm_; 
01172         struct ctrump_ifdef_stmt ifdef_stmt; 
01173         struct ctrump_empty_stmt empty;      
01174         struct ctrump_stmt_list stmt_list; 
01175     }u;
01176 };
01177 
01181 struct ctrump_fundef {
01182     int id;
01183     struct ctrump_decl_specifier decl_spec; 
01184     struct ctrump_declarator *decl;         
01185     int num_oldstyle_declaration;           
01186     struct ctrump_decl *oldstyle_decl_list; 
01187     struct ctrump_compound_stmt body;       
01188     struct ctrump_cfg *cfg;     
01189 };
01190 
01194 struct ctrump_ext_include {
01195     struct ctrump_translation_unit *file;
01196     int is_quote;
01197     struct ctrump_source_string include_filename;
01198 };
01199 
01203 struct ctrump_ext_include_path {
01204     char *path_str;             
01205     int is_quote;               
01206 };
01207 
01211 struct ctrump_ext_ifdef_block {
01212     int true_block_index;
01213     int num_block;
01214 
01215     struct ctrump_source_string *cond_source_text; 
01216     struct ctrump_source_string *body_source_text; 
01217     struct ctrump_translation_unit *body;
01218 };
01219 
01224 struct ctrump_ext_gcc_cpp_note {
01225     int line;                   
01226     char *path_str;             
01227     int num_digit;              
01228     int *digits;                
01229 };
01230 
01234 enum ctrump_extdef_code {
01235     CTRUMP_EXT_FUNCTION_DEFINITION, 
01236     CTRUMP_EXT_OBJECT_DEFINITION, 
01237     CTRUMP_EXT_EMPTY_DEFINITION,  
01238     CTRUMP_EXT_INCLUDE,           
01239     CTRUMP_EXT_IFDEF_BLOCK,       
01240     CTRUMP_EXT_DEFINE,            
01241     CTRUMP_EXT_UNDEF,             
01242 
01243     CTRUMP_EXT_INCLUDE_PATH,      
01244     CTRUMP_EXT_NEWLINE,           
01245 
01246     
01247     CTRUMP_EXT_SLASLA_COMMENT,  
01248     CTRUMP_EXT_SLAAST_COMMENT,   
01249     CTRUMP_EXT_GCC_CPP_NOTE      
01250 };
01251 
01255 struct ctrump_extdecl {
01256     enum ctrump_extdef_code code; 
01257     struct ctrump_source_string source_text; 
01258     struct ctrump_location loc;              
01259     union {
01260         struct ctrump_ext_ifdef_block ifdef_block; 
01261         struct ctrump_fundef func_def; 
01262         struct ctrump_decl obj_def;    
01263         struct ctrump_ext_include include; 
01264         struct ctrump_ext_include_path include_path; 
01265         struct ctrump_ext_gcc_cpp_note gcc_cpp_note; 
01266     }u;
01267 };
01268 
01272 struct ctrump_translation_unit {
01273     int id;
01274     const char *filename;       
01275     struct ctrump_source_string source_text; 
01276     int num_decl;                            
01277     struct ctrump_extdecl *decls; 
01278 };
01279 
01283 CTRUMP_EXTDEF int ctrump_ast_fold_const_sint(const struct ctrump_expr *expr, int *is_const);
01284 
01285 
01293 CTRUMP_EXTDEF void ctrump_ast_fold_const_offset_sint(int *ret_offset, struct ctrump_expr **ret_expr,
01294                                                      struct ctrump_expr *expr);
01295 
01299 CTRUMP_EXTDEF struct ctrump_location ctrump_get_stmt_loc(const struct ctrump_stmt *stmt);
01300 
01305 CTRUMP_EXTDEF int ctrump_expr_occur_var(const struct ctrump_expr *expr, const struct ctrump_var *v);
01306 
01310 CTRUMP_EXTDEF int ctrump_print_expr_stderr(struct ctrump_expr *e, int is_print_internal);
01311 
01315 CTRUMP_EXTDEF int ctrump_print_translation_unit_stderr(struct ctrump_translation_unit *u);
01316 
01317 #ifdef __cplusplus
01318 }
01319 #endif
01320 #endif