//== RegionStore.cpp - Field-sensitive store model --------------*- C++ -*--==////// The LLVM Compiler Infrastructure//// This file is distributed under the University of Illinois Open Source// License. See LICENSE.TXT for details.////===----------------------------------------------------------------------===////// This file defines a basic region store model. In this model, we do have field// sensitivity. But we assume nothing about the heap shape. So recursive data// structures are largely ignored. Basically we do 1-limiting analysis.// Parameter pointers are assumed with no aliasing. Pointee objects of// parameters are created lazily.////===----------------------------------------------------------------------===//#include"clang/Analysis/PathSensitive/MemRegion.h"#include"clang/Analysis/PathSensitive/GRState.h"#include"clang/Analysis/PathSensitive/GRStateTrait.h"#include"clang/Analysis/Analyses/LiveVariables.h"#include"clang/Basic/TargetInfo.h"#include"llvm/ADT/ImmutableMap.h"#include"llvm/ADT/ImmutableList.h"#include"llvm/Support/raw_ostream.h"#include"llvm/Support/Compiler.h"usingnamespaceclang;// Actual Store type.typedefllvm::ImmutableMap<constMemRegion*,SVal>RegionBindingsTy;//===----------------------------------------------------------------------===//// Region "Views"//===----------------------------------------------------------------------===////// MemRegions can be layered on top of each other. This GDM entry tracks// what are the MemRegions that layer a given MemRegion.//typedefllvm::ImmutableSet<constMemRegion*>RegionViews;namespace{classVISIBILITY_HIDDENRegionViewMap{};}staticintRegionViewMapIndex=0;namespaceclang{template<>structGRStateTrait<RegionViewMap>:publicGRStatePartialTrait<llvm::ImmutableMap<constMemRegion*,RegionViews>>{staticvoid*GDMIndex(){return&RegionViewMapIndex;}};}// RegionCasts records the current cast type of a region.namespace{classVISIBILITY_HIDDENRegionCasts{};}staticintRegionCastsIndex=0;namespaceclang{template<>structGRStateTrait<RegionCasts>:publicGRStatePartialTrait<llvm::ImmutableMap<constMemRegion*,QualType>>{staticvoid*GDMIndex(){return&RegionCastsIndex;}};}//===----------------------------------------------------------------------===//// Region "Extents"//===----------------------------------------------------------------------===////// MemRegions represent chunks of memory with a size (their "extent"). This// GDM entry tracks the extents for regions. Extents are in bytes.//namespace{classVISIBILITY_HIDDENRegionExtents{};}staticintRegionExtentsIndex=0;namespaceclang{template<>structGRStateTrait<RegionExtents>:publicGRStatePartialTrait<llvm::ImmutableMap<constMemRegion*,SVal>>{staticvoid*