aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/RegionStore.cpp
AgeCommit message (Collapse)Author
2009-06-23Move 'hasStackStorage()' and 'hasHeapStorage()' from MemRegionManager to ↵Ted Kremenek
MemRegion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73973 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23Move all factory methods from SVal to ValueManager. API cleanup!Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73954 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23ValueManager::makeNonLoc -> ValueManager::makeIntValZhongxing Xu
Clean up code with ValueManager. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73951 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23If the init list is fewer than the struct fields, bind the rest fields to 0Zhongxing Xu
explicitly. Make 0 value with the field type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73949 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23Instead of setting the default value of the array region, bind the rest of theZhongxing Xu
array elements to 0 explicitly. Create 0 values with the element type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73946 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23Remove duplicated methods.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73940 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23add a fixme.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73939 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-22Allow CodeTextRegion to be cast to 'void *'.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73880 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21Return UnknownVal for pointer arithmetic on struct fields.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73851 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19If the SymbolicRegion was cast to another type, use that type to create the Zhongxing Xu
ElementRegion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73754 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18When casting region, if we do not create an element region, record the cast-to Zhongxing Xu
type. When retrieving the region value, if we are going to create a symbol value, use the cast-to type if possible. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73690 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17First step toward fixing <rdar://problem/6613046> refactor clang objc type ↵Steve Naroff
representation. Add a type (ObjCObjectPointerType) and remove a type (ObjCQualifiedIdType). This large/tedious patch is just a first step. Next step is to remove ObjCQualifiedInterfaceType. After that, I will remove the magic TypedefType for 'id' (installed by Sema). This work will enable various simplifications throughout clang (when dealing with ObjC types). No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73649 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17Start moving in the direction of removing GRStateRef. Now eachTed Kremenek
GRState object has a direct reference to its GRStateManager, making the functionality of GRStateRef redunandant. This will lead to some nice API cleanup and code shrinking across libAnalysis. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73644 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-16RegionStoreManager:Ted Kremenek
- Add "sections" to RegionStoreManager.cpp to delineate functionality. - Add new function "CreateFieldsOnlyRegionStoreManager" that uses the new RegionStoreFeatures class to use a reduced set of features from RegionStoreManager (in this case, only field-sensitivity). This isn't completely hooked up yet. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73572 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-16Use canonical type for building ElementRegion. Otherwise ElementRegions cannotZhongxing Xu
be unique. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73482 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-13Stop tracking non-compound value for struct. It may be caused by imprecise castZhongxing Xu
logic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73279 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12use getAsPointerType() method.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73218 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-11Bind the mistakenly generated nonloc::SymbolVal to struct correctly. See theZhongxing Xu
comments for added test case for details. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73189 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-11Use more robust getAsRecordType() method.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73186 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20Treat AllocaRegion as SymbolicRegion in RegionStore::Retrieve().Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72166 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20* API change: we need to pass GRState to GRExprEngine::EvalBinOp() becauseZhongxing Xu
RegionStore needs to know the type of alloca region. * RegionStoreManager::EvalBinOp() now converts the alloca region to its first element region, as what is done to symbolic region. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72164 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-18Silence a Release-Asserts warning.Daniel Dunbar
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72013 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-12Add logic for invalidating array region to CFRefCount.cpp. When invalidatingZhongxing Xu
array region, set its default value to conjured symbol. When retrieving its element, create new region value symbol for the element. Also fix some 80 columns violations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71548 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11When retrieving an ElementRegion, if its super region is a StringRegion,Zhongxing Xu
retrieve the string value. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71430 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-11Fix a bug that leads to infinite loop. Set the correct element type toZhongxing Xu
ElementRegion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71428 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-09When casting VarRegion, if the var type is aggregate type and the cast-toZhongxing Xu
pointee type is scalar type, create element region regardless with the sizes of types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71360 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-09Remove the rest TypedViewRegion processing code. There should be noZhongxing Xu
TypedViewRegion usage in region store. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71359 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-09When evaluating pointer arithmetic, if the base location is a symbolic region,Zhongxing Xu
convert it to the first element region. Also do not assume the array region is typed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71358 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-09Do not create a TypedViewRegion when the base struct region is a symbolicZhongxing Xu
region. In the future we may set the cast-to type as the same time. But for now, we simply leave it as it is. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71357 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-09Do not layer a TypedViewRegion when casting symbolic or alloca regions.Zhongxing Xu
Modify getLValueElement accordingly. Now we don't require base region to be a typed region. Do not create TypedViewRegion when base region is symbolic or alloca region. We can do so because each element region has its type information. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71355 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-09Remove the case for casting to compatible type in Zhongxing Xu
RegionStoreManager::CastRegion(). This case should be subsumed by others. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71353 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-09Rename:Zhongxing Xu
SymbolRegionRValue => SymbolRegionValue SymExpr::RegionRValue => SymExpr::RegionValueKind git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71322 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-09As discussed with Ted, rename TypedRegion::getObjectType() to Zhongxing Xu
TypedRegion::getValueType(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71321 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-09rename: MemRegion:Zhongxing Xu
RValueType => ObjectType LValueType => LocationType No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71304 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08Fix PR4182.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71288 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08Region store: when casting VarRegions, if the cast-to pointee type is Zhongxing Xu
incomplete, do not compute its size and return the original region. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71213 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08Replace the heuristic isSmallerThan with ASTContext::getTypeSize().Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71206 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08Replace getTypeWidth() with ASTContext::getTypeSize().Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71205 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-08Revert r71079.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71202 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06Improve RegionStoreManager::getSizeInElements()Zhongxing Xu
- add a static function getTypeWidth(), which computes the width of a type with the help of TargetInfo. - no-outofbounds.c now passes for region store. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71080 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06Add a GDM for recording the cast type of regions.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71076 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06Implement a heuristic type size comparison method for now.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71074 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06remove commented code.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71060 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-06Make StoreManager::CastRegion() virtual and implement a new CastRegion() forZhongxing Xu
RegionStore. This CastRegion() performs casts according to the kind of the region being cast instead of the type that is cast to. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71058 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-04Per conversations with Zhongxing, add an 'element type' toTed Kremenek
ElementRegion. I also removed 'ElementRegion::getArrayRegion', although we may need to add this back. This breaks a few test cases with RegionStore: - 'array-struct.c' triggers an infinite recursion in RegionStoreManager. Need to investigate. - misc-ps.m triggers a failure with RegionStoreManager as we now get the diagnostic: 'Line 159: Uninitialized or undefined return value returned to caller.' There were a bunch of places that needed to be edit RegionStoreManager, and we may not be passing all the correct 'element types' down from GRExprEngine. Zhongxing: When you get a chance, could you review this? I could have easily screwed up something basic in RegionStoreManager. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70830 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-03region store: make Retrieve() can retrieve embedded array correctly. AlsoZhongxing Xu
simplify the retrieve logic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70651 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-29SymbolicRegions may also be live roots.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70380 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-21Refactor 'BasicStoreManager::CastRegion' and 'RegionStoreManager::CastRegion'Ted Kremenek
into StoreManager::CastRegion. Both methods were practically identical, and this is core logic that is common to all StoreManagers since it defines the basic invariants of the abstract memory model. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69730 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-20Remove loc::FuncVal.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69577 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10Finally nuke loc::SymbolVal.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68771 91177308-0d34-0410-b5e6-96231b3b80d8