Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions CodeHawk/CHB/bchcil/bCHCilToCBasic.ml
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,16 @@ and cil_fieldinfo_to_bfieldinfo (f: GoblintCil.fieldinfo): bfieldinfo_t = {
}


and cil_eitem_to_beitem (i: (string * GoblintCil.exp * GoblintCil.location)): beitem_t =
let (ename, eexp, eloc) = i in
(ename, cil_exp_to_bexp eexp, cil_location_to_b_location eloc)
and cil_eitem_to_beitem
(i: (string
* GoblintCil.attributes
* GoblintCil.exp
* GoblintCil.location)): beitem_t =
let (ename, attrs, eexp, eloc) = i in
(ename,
cil_attributes_to_b_attributes attrs,
cil_exp_to_bexp eexp,
cil_location_to_b_location eloc)


and cil_enuminfo_to_benuminfo (e: GoblintCil.enuminfo): benuminfo_t = {
Expand Down
7 changes: 4 additions & 3 deletions CodeHawk/CHB/bchlib/bCHBCDictionary.ml
Original file line number Diff line number Diff line change
Expand Up @@ -720,16 +720,17 @@ object (self)
}

method index_enumitem (eitem: beitem_t) =
let (name, exp, loc) = eitem in
let (name, attrs, exp, loc) = eitem in
let tags = [name] in
let args = [self#index_exp exp; self#index_location loc] in
let args =
[self#index_exp exp; self#index_location loc; self#index_attributes attrs] in
enumitem_table#add (tags, args)

method get_enumitem (index: int): beitem_t =
let (tags, args) = enumitem_table#retrieve index in
let t = t "beitem_t" tags in
let a = a "beitem_t" args in
(t 0, self#get_exp (a 0), self#get_location (a 1))
(t 0, self#get_attributes (a 2), self#get_exp (a 0), self#get_location (a 1))

method index_enuminfo (einfo: benuminfo_t) =
let tags = [einfo.bename; ikind_mfts#ts einfo.bekind] in
Expand Down
2 changes: 1 addition & 1 deletion CodeHawk/CHB/bchlib/bCHBCTypes.mli
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ and bfieldinfo_t = {
bfieldlayout: fieldlayout_t option
}

and beitem_t = string * bexp_t * b_location_t
and beitem_t = string * b_attributes_t * bexp_t * b_location_t

and benuminfo_t = {
bename: string;
Expand Down
4 changes: 2 additions & 2 deletions CodeHawk/CHC/cchcil/cHCilDeclarations.ml
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,12 @@ object (self)
compinfo_table#add (tags, args)

method index_enumitem (eitem: enumitem) =
let (name, exp, loc) = eitem in
let (name, attrs, exp, loc) = eitem in
let tags = [name] in
let locix_r = self#index_location loc in
match locix_r with
| Ok locix ->
let args = [cd#index_exp exp; locix] in
let args = [cd#index_exp exp; locix; cd#index_attributes attrs] in
enumitem_table#add (tags, args)
| Error e ->
begin
Expand Down
2 changes: 1 addition & 1 deletion CodeHawk/CHC/cchcil/cHCilTypes.ml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ open CHTraceResult
open CHXmlDocument

type funarg = string * typ * attributes
type enumitem = string * exp * location
type enumitem = string * attributes * exp * location

class type cildictionary_int =
object
Expand Down
2 changes: 1 addition & 1 deletion CodeHawk/CHC/cchcil/cHCilTypes.mli
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ open CHXmlDocument


type funarg = string * typ * attributes
type enumitem = string * exp * location
type enumitem = string * attributes * exp * location


class type cildictionary_int =
Expand Down
2 changes: 1 addition & 1 deletion CodeHawk/CHC/cchlib/cCHBasicTypes.mli
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ and fieldinfo = {
floc : location
}

and eitem = string * exp * location
and eitem = string * attributes * exp * location

and enuminfo = {
ename : string ;
Expand Down
13 changes: 8 additions & 5 deletions CodeHawk/CHC/cchlib/cCHDeclarations.ml
Original file line number Diff line number Diff line change
Expand Up @@ -237,17 +237,20 @@ object (self)
cattr = cd#get_attributes (a 2);
cfields = List.map self#get_fieldinfo (get_list_suffix args 3) }

method index_enumitem (eitem:enumitem) =
let (name,exp,loc) = eitem in
method index_enumitem (eitem: enumitem) =
let (name, attrs, exp, loc) = eitem in
let tags = [name] in
let args = [cd#index_exp exp; self#index_location loc] in
enumitem_table#add (tags,args)
let args = [
cd#index_exp exp;
self#index_location loc;
cd#index_attributes attrs] in
enumitem_table#add (tags, args)

method get_enumitem (index:int):enumitem =
let (tags,args) = enumitem_table#retrieve index in
let t = t "enumitem" tags in
let a = a "enumitem" args in
(t 0, cd#get_exp (a 0), self#get_location (a 1))
(t 0, cd#get_attributes (a 2), cd#get_exp (a 0), self#get_location (a 1))

method index_enuminfo (einfo:enuminfo) =
let tags = [einfo.ename; ikind_mfts#ts einfo.ekind] in
Expand Down
2 changes: 1 addition & 1 deletion CodeHawk/CHC/cchlib/cCHLibTypes.mli
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class type cdictionary_int =

(** {1 Declarations} *)

type enumitem = string * exp * location
type enumitem = string * attributes * exp * location

class type cdeclarations_int =
object
Expand Down
6 changes: 3 additions & 3 deletions CodeHawk/CHC/cchlib/cCHTypesCompare.ml
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,9 @@ and exp_compare (e1:exp) (e2:exp) =
l0


and eitem_compare (eitem1:eitem) (eitem2:eitem) =
let (iname1,iexp1,_) = eitem1 in
let (iname2,iexp2,_) = eitem2 in
and eitem_compare (eitem1: eitem) (eitem2: eitem) =
let (iname1,_, iexp1, _) = eitem1 in
let (iname2,_, iexp2, _) = eitem2 in
let l0 = Stdlib.compare iname1 iname2 in
if l0 = 0 then
exp_compare iexp1 iexp2
Expand Down
6 changes: 3 additions & 3 deletions CodeHawk/CHC/cchlib/cCHTypesUtil.ml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ let get_typ_attributes (t:typ) =

let is_enum_constant (ename:string) (exp:exp) =
let einfo = fenv#get_enum ename in
let eexps = List.map (fun (_,e,_) -> e) einfo.eitems in
let eexps = List.map (fun (_, _, e, _) -> e) einfo.eitems in
List.exists (fun e -> (exp_compare e exp) = 0) eexps


Expand Down Expand Up @@ -537,9 +537,9 @@ let const_fits_kind (c:constant) (target_ik:ikind) =
| _ -> false


let enum_fits_kind (ename:string) (target_ik:ikind) =
let enum_fits_kind (ename: string) (target_ik:ikind) =
let einfo = fenv#get_enum ename in
List.for_all (fun (_, e, _) ->
List.for_all (fun (_, _, e, _) ->
match e with
| Const c -> const_fits_kind c target_ik
| _ -> false) einfo.eitems
Expand Down
Loading