summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/RegionStore.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Enhance RegionStoreManager to handle 'Retrieve's from SymbolicRegions. We ↵Ted Kremenek2009-07-141-2/+8
| | | | | | do this by silently wrapping the region with an ElementRegion. This fixes the failures in misc-ps-region-store.m. llvm-svn: 75679
* Instead of recovering from a wrong invalidation, this patch aims to Zhongxing Xu2009-07-141-0/+32
| | | | | | | | invalidate the region correctly. It uses the cast-to type to invalidate the region when available. To avoid invalid cast-to type like 'void*' or 'id', region store now only records non-generic casts of regions. llvm-svn: 75580
* Tidy pretty-printing for SVals, using 'dump()' instead of 'printStdErr()', ↵Ted Kremenek2009-07-131-4/+2
| | | | | | and implementing operator<< support for llvm::raw_ostream. llvm-svn: 75560
* Change pretty-printing API for SymExprs and MemRegions to use a naming ↵Ted Kremenek2009-07-131-1/+1
| | | | | | convention and style similar to other elements in Clang. llvm-svn: 75548
* Restructure RegionStoreManager::EvalBinOp() as a switch dispatch over differentTed Kremenek2009-07-111-33/+59
| | | | | | | MemRegion kinds. This allows the compiler to identify what MemRegions we don't handle for pointer arithmetic. llvm-svn: 75326
* Restructure RegionStoreManager::getSizeInElements() to use a switch statementTed Kremenek2009-07-101-52/+67
| | | | | | | over the types of MemRegions. This allows the compiler to warn us which regions are not handled, and also is a little faster. llvm-svn: 75304
* Move the new 'CastRegion' implementation from RegionStoreManager to StoreManagerTed Kremenek2009-07-061-81/+3
| | | | | | | (its superclass). This will allow us to experiment with using the new CastRegion with BasicStoreManager, and gradually phase out the old implementation. llvm-svn: 74851
* remove utility methods that are not very useful.Zhongxing Xu2009-07-031-1/+1
| | | | llvm-svn: 74762
* Remove unused method.Ted Kremenek2009-07-031-3/+0
| | | | llvm-svn: 74751
* Replace guarded calls in RegionStoreManager toTed Kremenek2009-07-021-21/+7
| | | | | | | | | ValueManager::getRegionValueSymbolVal() with unguarded calls to ValueManager::getRegionValueSymbolValOrUnknown(). This changes centralizes the decision of what values to symbolicate in SymbolManager rather than having it scatter in RegionStoreManager. llvm-svn: 74730
* Enhance RegionStore to lazily symbolicate fields and array elements forTed Kremenek2009-07-021-2/+6
| | | | | | structures passed-by-value as function arguments. llvm-svn: 74729
* StoreManagers: Use 'hasGlobalsStorage()' and 'hasParametersStorage()' instead ofTed Kremenek2009-07-021-2/+1
| | | | | | | directly consulting if a VarDecl is an implicit or actual parameter, a global, etc. llvm-svn: 74716
* Minor code cleanup: pull variables into scope of 'if' statement, limiting theirTed Kremenek2009-07-011-10/+8
| | | | | | actual lifetime to their logical lifetime. llvm-svn: 74665
* Add a FIXME to RegionStore, do some minor code cleanup, and get RegionStore toTed Kremenek2009-07-011-11/+23
| | | | | | | | pass misc-ps.m. Currently RegionStore/BasicStore don't do any special reasoning about clang-style vectors, so we should return UnknownVal (in all cases) when accessing their values via an array. llvm-svn: 74660
* add fixme.Zhongxing Xu2009-07-011-0/+1
| | | | llvm-svn: 74581
* When retrieving element region, if its super region has binding, returnZhongxing Xu2009-06-301-5/+24
| | | | | | | | | | | unknown for it. Mark the super region of a live region as live, if the live region is pointed to by a live pointer variable. These fixes xfail_regionstore_wine_crash.c. llvm-svn: 74524
* De-ASTContext-ify DeclContext.Argyrios Kyrtzidis2009-06-301-4/+2
| | | | | | | Remove ASTContext parameter from DeclContext's methods. This change cascaded down to other Decl's methods and changes to call sites started "escalating". Timings using pre-tokenized "cocoa.h" showed only a ~1% increase in time run between and after this commit. llvm-svn: 74506
* Adjust retrieve handler priority. If a field is of array type, it should be Zhongxing Xu2009-06-281-6/+6
| | | | | | handled by RetrieveArray(). llvm-svn: 74409
* Do not crash on binding concrete integer location.Zhongxing Xu2009-06-281-0/+3
| | | | llvm-svn: 74407
* Update method signature.Ted Kremenek2009-06-261-2/+3
| | | | llvm-svn: 74244
* Introduce a new concept to the static analyzer: SValuator.Ted Kremenek2009-06-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | GRTransferFuncs had the conflated role of both constructing SVals (symbolic expressions) as well as handling checker-specific logic. Now SValuator has the role of constructing SVals from expressions and GRTransferFuncs just handles checker-specific logic. The motivation is by separating these two concepts we will be able to much more easily create richer constraint-generating logic without coupling it to the main checker transfer function logic. We now have one implementation of SValuator: SimpleSValuator. SimpleSValuator is essentially the SVal-related logic that was in GRSimpleVals (which is removed in this patch). This includes the logic for EvalBinOp, EvalCast, etc. Because SValuator has a narrower role than the old GRTransferFuncs, the interfaces are much simpler, and so is the implementation of SimpleSValuator compared to GRSimpleVals. I also did a line-by-line review of SVal-related logic in GRSimpleVals and cleaned it up while moving it over to SimpleSValuator. As a consequence of removing GRSimpleVals, there is no longer a '-checker-simple' option. The '-checker-cfref' did everything that option did but also ran the retain/release checker. Of course a user may not always wish to run the retain/release checker, nor do we wish core analysis logic buried in the checker-specific logic. The next step is to refactor the logic in CFRefCount.cpp to separate out these pieces into the core analysis engine. llvm-svn: 74229
* remove RegionKills GDM. Now UnknownVal is bound to regions explicitly.Zhongxing Xu2009-06-251-44/+5
| | | | llvm-svn: 74168
* Move element region retrieving logic into a separate function.Zhongxing Xu2009-06-251-31/+58
| | | | llvm-svn: 74166
* Move all logic for retrieving ElementRegion binding into a separate method.Zhongxing Xu2009-06-251-10/+54
| | | | | | Revert to setting default value approach for handling struct initialization. llvm-svn: 74160
* Remove uses of std::ostream from libAnalysis.Ted Kremenek2009-06-241-9/+5
| | | | llvm-svn: 74136
* use a concrete type instead of a trait type to make code more readable.Zhongxing Xu2009-06-241-2/+1
| | | | llvm-svn: 74047
* RegionStore: revert to the default value approach for array initialization.Zhongxing Xu2009-06-241-8/+5
| | | | llvm-svn: 74043
* - Add MemRegion::getMemorySpace()Ted Kremenek2009-06-231-1/+1
| | | | | | | | | | - Change implementation of MemRegion::hasStackStorage()/hasHeapStorage() to use 'getMemorySpace()'. This avoids a double traversal up the region hierarchy and is simpler. - Add MemRegion::hasHeapOrStackStorage() as a slightly more efficient alternative to 'hasStackStorage() || hasHeapStorage()'. llvm-svn: 73977
* Move 'hasStackStorage()' and 'hasHeapStorage()' from MemRegionManager to ↵Ted Kremenek2009-06-231-1/+1
| | | | | | MemRegion. llvm-svn: 73973
* Move all factory methods from SVal to ValueManager. API cleanup!Zhongxing Xu2009-06-231-18/+18
| | | | llvm-svn: 73954
* ValueManager::makeNonLoc -> ValueManager::makeIntValZhongxing Xu2009-06-231-3/+3
| | | | | | Clean up code with ValueManager. llvm-svn: 73951
* If the init list is fewer than the struct fields, bind the rest fields to 0Zhongxing Xu2009-06-231-11/+16
| | | | | | explicitly. Make 0 value with the field type. llvm-svn: 73949
* Instead of setting the default value of the array region, bind the rest of theZhongxing Xu2009-06-231-17/+19
| | | | | | array elements to 0 explicitly. Create 0 values with the element type. llvm-svn: 73946
* Remove duplicated methods.Zhongxing Xu2009-06-231-1/+1
| | | | llvm-svn: 73940
* add a fixme.Zhongxing Xu2009-06-231-0/+2
| | | | llvm-svn: 73939
* Allow CodeTextRegion to be cast to 'void *'.Zhongxing Xu2009-06-221-1/+3
| | | | llvm-svn: 73880
* Return UnknownVal for pointer arithmetic on struct fields.Zhongxing Xu2009-06-211-1/+6
| | | | llvm-svn: 73851
* If the SymbolicRegion was cast to another type, use that type to create the Zhongxing Xu2009-06-191-3/+9
| | | | | | ElementRegion. llvm-svn: 73754
* When casting region, if we do not create an element region, record the cast-to Zhongxing Xu2009-06-181-6/+18
| | | | | | | | | type. When retrieving the region value, if we are going to create a symbol value, use the cast-to type if possible. llvm-svn: 73690
* First step toward fixing <rdar://problem/6613046> refactor clang objc type ↵Steve Naroff2009-06-171-1/+1
| | | | | | | | | | | | 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. llvm-svn: 73649
* Start moving in the direction of removing GRStateRef. Now eachTed Kremenek2009-06-171-188/+208
| | | | | | | | 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. llvm-svn: 73644
* RegionStoreManager:Ted Kremenek2009-06-161-198/+272
| | | | | | | | | | - 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. llvm-svn: 73572
* Use canonical type for building ElementRegion. Otherwise ElementRegions cannotZhongxing Xu2009-06-161-10/+13
| | | | | | be unique. llvm-svn: 73482
* Stop tracking non-compound value for struct. It may be caused by imprecise castZhongxing Xu2009-06-131-2/+4
| | | | | | logic. llvm-svn: 73279
* use getAsPointerType() method.Zhongxing Xu2009-06-121-1/+1
| | | | llvm-svn: 73218
* Bind the mistakenly generated nonloc::SymbolVal to struct correctly. See theZhongxing Xu2009-06-111-0/+3
| | | | | | comments for added test case for details. llvm-svn: 73189
* Use more robust getAsRecordType() method.Zhongxing Xu2009-06-111-1/+1
| | | | llvm-svn: 73186
* Treat AllocaRegion as SymbolicRegion in RegionStore::Retrieve().Zhongxing Xu2009-05-201-2/+5
| | | | llvm-svn: 72166
* * API change: we need to pass GRState to GRExprEngine::EvalBinOp() becauseZhongxing Xu2009-05-201-5/+18
| | | | | | | | 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. llvm-svn: 72164
* Silence a Release-Asserts warning.Daniel Dunbar2009-05-181-0/+1
| | | | llvm-svn: 72013
OpenPOWER on IntegriCloud