123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354(**************************************************************************)(* *)(* This file is part of Frama-C. *)(* *)(* Copyright (C) 2007-2024 *)(* CEA (Commissariat à l'énergie atomique et aux énergies *)(* alternatives) *)(* *)(* you can redistribute it and/or modify it under the terms of the GNU *)(* Lesser General Public License as published by the Free Software *)(* Foundation, version 2.1. *)(* *)(* It is distributed in the hope that it will be useful, *)(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)(* GNU Lesser General Public License for more details. *)(* *)(* See the GNU Lesser General Public License version 2.1 *)(* for more details (enclosed in the file licenses/LGPLv2.1). *)(* *)(**************************************************************************)openAnnotopenMemoryletrecadd_lval(m:map)(p:path):node=matchp.stepwith|Varx->add_rootmx|Field(lv,fd)->Memory.add_fieldm(add_lvalmlv)fd|Index(lv,n)->Memory.add_indexm(add_lvalmlv)lv.typn|Stare|Cast(_,e)->add_pointerme|Shift_|AddrOf_->Options.error~source:(fstp.loc)"Unexpected expression (l-value expected)";Memory.new_chunkm()andadd_pointer(m:map)(p:path):Memory.node=matchadd_expmpwith|None->Memory.new_chunkm()|Somer->randadd_exp(m:map)(p:path):Memory.nodeoption=matchp.stepwith|(Var_|Field_|Index_|Star_|Cast_)->letr=add_lvalmpinadd_valuemrp.typ|AddrOfp->Some(add_lvalmp)|Shiftp->add_expmpletadd_region(m:map)(r:Annot.region)=letrs=List.map(add_lvalm)r.rpathinmerge_allm@@matchr.rnamewith|None->rs|Somea->add_labelma::rs