Skip to content

Commit aada3a5

Browse files
committed
CHC: change in MemoryAddress representation
1 parent c182a84 commit aada3a5

18 files changed

Lines changed: 35 additions & 31 deletions

CodeHawk/CHC/cchanalyze/cCHAnalysisTypes.mli

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ object
130130
method mk_stack_address_value: varinfo -> offset -> typ -> variable_t
131131
method mk_memory_address_value: int -> offset -> variable_t
132132
method mk_string_address: string -> offset -> typ -> variable_t
133+
method mk_initial_value: variable_t -> typ -> variable_type_t -> variable_t
133134

134135
method mk_function_return_value:
135136
location
@@ -246,6 +247,7 @@ object
246247
method get_indicator: variable_t -> int (* augmentation variable *)
247248

248249
method get_initial_parameter_vinfo: variable_t -> varinfo * offset
250+
method get_memory_address_wrapped_value: variable_t -> variable_t option
249251

250252
(** {1 Predicates} *)
251253

@@ -258,6 +260,8 @@ object
258260
method is_memory_variable: variable_t -> bool
259261
method is_string_literal_address: variable_t -> bool
260262
method is_memory_address: variable_t -> bool
263+
method is_mut_memory_address: variable_t -> bool
264+
method is_ref_memory_address: variable_t -> bool
261265
method is_fixed_xpr: xpr_t -> bool
262266
method is_initial_value: variable_t -> bool
263267
method is_initial_parameter_value: variable_t -> bool

CodeHawk/CHC/cchanalyze/cCHExpTranslator.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ object (self)
664664
match memref#get_base with
665665
| CStackAddress v -> v
666666
| CGlobalAddress v -> v
667-
| CBaseVar (v, _, _) -> v
667+
| CBaseVar (v, _) -> v
668668
| _ ->
669669
raise
670670
(CCHFailure

CodeHawk/CHC/cchanalyze/cCHNumericalConstraints.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ open CHPretty
3636
open CHUtils
3737

3838
(* cchlib *)
39-
open CCHUtilities
39+
(* open CCHUtilities *)
4040

4141
(* cchanalyze *)
4242
open CCHAnalysisTypes
@@ -133,7 +133,7 @@ object (self)
133133
let _ =
134134
if coeff1#equal numerical_zero || coeff2#equal numerical_zero then
135135
raise
136-
(CCHFailure
136+
(CHCommon.CHFailure
137137
(LBLOCK [
138138
STR "Internal error in elimination of ";
139139
v#toPretty;

CodeHawk/CHC/cchanalyze/cCHPOCheckAllocationBase.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ object (self)
151151
let deps = DLocal [invindex] in
152152
let msg = "address of stack variable: " ^ vinfo.vname in
153153
Some (deps,msg)
154-
| CBaseVar (v, _, _) -> self#var_is_stack_memory invindex v
154+
| CBaseVar (v, _) -> self#var_is_stack_memory invindex v
155155
| _ -> None
156156

157157
method private var_is_stack_memory (invindex: int) (v: variable_t) =
@@ -413,7 +413,7 @@ object (self)
413413
method private memref_implies_delegation
414414
(invindex: int) (memref: memory_reference_int) =
415415
match memref#get_base with
416-
| CBaseVar (v, _, _) -> self#var_implies_delegation invindex v
416+
| CBaseVar (v, _) -> self#var_implies_delegation invindex v
417417
| _ -> None
418418

419419
method private var_implies_delegation (invindex: int) (v: variable_t) =

CodeHawk/CHC/cchanalyze/cCHPOCheckInScope.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ object (self)
133133
let (vinfo, offset) = poq#env#get_global_variable gvar in
134134
let msg = self#var_address_to_string vinfo offset in
135135
Some (deps, msg)
136-
| CBaseVar (v, _, _) -> self#var_implies_safe invindex v
136+
| CBaseVar (v, _) -> self#var_implies_safe invindex v
137137
| _ -> None
138138

139139
method private var_implies_safe (invindex: int) (v: variable_t) =

CodeHawk/CHC/cchanalyze/cCHPOCheckIntOverflow.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ object (self)
175175
let (memref, _offset) = poq#env#get_memory_address v in
176176
begin
177177
match memref#get_base with
178-
| CBaseVar (bv, _, _) ->
178+
| CBaseVar (bv, _) ->
179179
let _ =
180180
poq#set_diagnostic_arg
181181
arg ("base var: " ^ (p2s bv#toPretty)) in

CodeHawk/CHC/cchanalyze/cCHPOCheckIntUnderflow.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ object (self)
878878
let (memref, _offset) = poq#env#get_memory_address v in
879879
begin
880880
match memref#get_base with
881-
| CBaseVar (bv, _, _) ->
881+
| CBaseVar (bv, _) ->
882882
let _ =
883883
poq#set_diagnostic_arg
884884
arg ("base var: " ^ (p2s bv#toPretty)) in

CodeHawk/CHC/cchanalyze/cCHPOCheckLocallyInitialized.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ object (self)
123123
^ vinfo.vname in
124124
let site = Some (__FILE__, __LINE__, mname) in
125125
Some (deps, msg, site)
126-
| CBaseVar (bvar, _, _) ->
126+
| CBaseVar (bvar, _) ->
127127
self#memlval_memref_basevar_implies_safe invindex bvar
128128
| _ ->
129129
begin

CodeHawk/CHC/cchanalyze/cCHPOCheckLowerBound.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ object (self)
9090
let (vinfo, _offset) = poq#env#get_local_variable svar in
9191
let msg = "address of stack variable: " ^ vinfo.vname in
9292
Some (deps, msg)
93-
| CBaseVar (svar, _, _) ->
93+
| CBaseVar (svar, _) ->
9494
let msg =
9595
"address of externally provided variable/field: "
9696
^ svar#getName#getBaseName in
@@ -255,7 +255,7 @@ object (self)
255255
None
256256
| _ -> None
257257
end
258-
| CBaseVar (v, _, _) ->
258+
| CBaseVar (v, _) ->
259259
self#var_offset_implies_universal_violation invindex v xoffset
260260
| _ -> None
261261

CodeHawk/CHC/cchanalyze/cCHPOCheckNoOverlap.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ object (self)
106106
let memref = poq#env#get_memory_reference v in
107107
let _ = poq#set_diagnostic_arg arg (self#memref_to_string memref) in
108108
match memref#get_base with
109-
| CBaseVar (basevar, _, _) -> self#is_alloca_address arg basevar invindex
109+
| CBaseVar (basevar, _) -> self#is_alloca_address arg basevar invindex
110110
| _ -> None
111111
else
112112
None
@@ -135,7 +135,7 @@ object (self)
135135
let memref = poq#env#get_memory_reference v in
136136
let _ = poq#set_diagnostic_arg arg (self#memref_to_string memref) in
137137
match memref#get_base with
138-
| CBaseVar (basevar, _, _) ->
138+
| CBaseVar (basevar, _) ->
139139
if poq#is_api_expression (XVar basevar) then
140140
let xapi = poq#get_api_expression (XVar basevar) in
141141
let deps = DLocal [invindex] in

0 commit comments

Comments
 (0)