and typeC = typeCbis wrap (* todo reput wrap3 *)
and typeCbis =
+ NoType (* for c++ only *)
| BaseType of baseType
| Pointer of fullType
and expression = (expressionbis * exp_info ref (* semantic: *)) wrap3
and exp_info = exp_type option * test
and exp_type = fullType (* Type_c.completed_and_simplified *) * local
- and local = LocalVar of parse_info | NotLocalVar (* cocci: *)
+ and local = LocalVar of parse_info | StaticLocalVar of parse_info
+ | NotLocalVar (* cocci: *)
and test = Test | NotTest (* cocci: *)
and expressionbis =
(* gccext: *)
| StatementExpr of compound wrap (* ( ) new scope *)
- | Constructor of fullType * initialiser wrap2 (* , *) list
+ | Constructor of fullType * initialiser
(* for unparser: *)
| ParenExpr of expression
+ (* for C++: *)
+ | New of argument
+ | Delete of expression
+
(* cppext: IfdefExpr TODO *)
- (* cppext: normmally just expression *)
+ (* cppext: normally just expression *)
and argument = (expression, weird_argument) Common.either
and weird_argument =
| ArgType of parameterType
and constExpression = expression (* => int *)
-
(* ------------------------------------------------------------------------- *)
(* C statement *)
(* ------------------------------------------------------------------------- *)
and declaration =
| DeclList of onedecl wrap2 (* , *) list wrap (* ; fakestart sto *)
(* cppext: *)
- | MacroDecl of (string * argument wrap2 list) wrap (* fakestart *)
+ (* bool is true if there is a ; at the end *)
+ | MacroDecl of (string * argument wrap2 list * bool) wrap (* fakestart *)
+ | MacroDeclInit of
+ (string * argument wrap2 list * initialiser) wrap (* fakestart *)
and onedecl =
- { v_namei: (name * (info (* = *) * initialiser) option) option;
+ { v_namei: (name * v_init) option;
v_type: fullType;
(* semantic: set in type annotated and used in cocci_vs_c
* when we transform some initialisation into affectation
v_local: local_decl; (* cocci: *)
v_attr: attribute list; (* gccext: *)
}
+ and v_init =
+ NoInit | ValInit of info * initialiser
+ | ConstrInit of argument wrap2 (* , *) list wrap
and storage = storagebis * bool (* gccext: inline or not *)
and storagebis = NoSto | StoTypedef | Sto of storageClass
and storageClass = Auto | Static | Register | Extern
| MetaTypeVal of fullType
| MetaInitVal of initialiser
+ | MetaInitListVal of initialiser wrap2 list
| MetaDeclVal of declaration
| MetaFieldVal of field
+ | MetaFieldListVal of field list
| MetaStmtVal of statement
(* Could also be in Lib_engine.metavars_binding2 with the ParenVal,
(* bugfix: because of string->name, the ii can be deeper *)
let ii = get_local_ii_of_tybis_inlining_ii_of_name ty in
match ii with
- | ii::_ -> ii.pinfo
- | [] -> failwith "type has no text; need to think again"
+ | ii::_ -> Some ii.pinfo
+ | [] -> None
(* only Label and Goto have name *)
let get_local_ii_of_st_inlining_ii_of_name st =