summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/SVals.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Implement analyzer support for OSCompareAndSwap. This required pushing "tagged"Ted Kremenek2009-04-111-0/+4
| | | | | | | | | ProgramPoints all the way through to GRCoreEngine. NSString.m now fails with RegionStoreManager because of the void** cast. Disabling use of region store for that test for now. llvm-svn: 68845
* Move a few more NonLoc static functions to ValueManager.Ted Kremenek2009-04-101-9/+8
| | | | llvm-svn: 68800
* Add prototype for CodeTextRegion.Zhongxing Xu2009-04-101-0/+24
| | | | | | | | A CodeTextRegion wraps two kinds of data: FunctionDecl* or SymbolRef. The latter comes from the symbolic function pointer that are generated from function calls or input data. llvm-svn: 68777
* Finally nuke loc::SymbolVal.Zhongxing Xu2009-04-101-7/+0
| | | | llvm-svn: 68771
* - Move ownership of MemRegionManager into ValueManager.Ted Kremenek2009-04-091-9/+8
| | | | | | | - Pull SVal::GetConjuredSymbol() and friends into ValueManager. This greatly simplifies the calling interface to clients. llvm-svn: 68731
* Remove SVal::MakeZero and replace it with ValueManager::makeZeroVal.Ted Kremenek2009-04-091-1/+1
| | | | llvm-svn: 68711
* stop using loc::SymbolVal and clean up code with new API.Zhongxing Xu2009-04-091-2/+0
| | | | llvm-svn: 68703
* Add a new method because sometimes the type of the conjured symbol is not theZhongxing Xu2009-04-091-0/+13
| | | | | | type of the expression where we create the symbol. llvm-svn: 68692
* Create a symbolic region instead of a loc::SymbolVal. This is a continued stepZhongxing Xu2009-04-091-13/+10
| | | | | | to eliminate the use of loc::SymbolVal. llvm-svn: 68685
* Enhance analyzer reasoning about sending messages to nil. A nil receiver ↵Ted Kremenek2009-04-081-0/+20
| | | | | | returns 0 for scalars of size <= sizeof(void*). llvm-svn: 68629
* This is the first step to gradually remove the use of loc::SymbolVal. NowZhongxing Xu2009-04-031-2/+3
| | | | | | | | when creating symbolic values, we distinguish between location and non-location values. For location values, we create a symbolic region instead of a loc::SymbolVal. llvm-svn: 68373
* Remove dead code.Ted Kremenek2009-03-301-103/+0
| | | | llvm-svn: 68063
* analyzer infrastructure: make a bunch of changes to symbolic expressions thatTed Kremenek2009-03-261-109/+107
| | | | | | | | | | | | | | | | Zhongxing and I discussed by email. Main changes: - Removed SymIntConstraintVal and SymIntConstraint - Added SymExpr as a parent class to SymbolData, SymSymExpr, SymIntExpr - Added nonloc::SymExprVal to wrap SymExpr - SymbolRef is now just a typedef of 'const SymbolData*' - Bunch of minor code cleanups in how some methods were invoked (no functionality change) This changes are part of a long-term plan to have full symbolic expression trees. This will be useful for lazily evaluating complicated expressions. llvm-svn: 67731
* This patch adds two more SymbolData subclasses: SymIntExpr and SymSymExpr, forZhongxing Xu2009-03-251-0/+17
| | | | | | | | representing symbolic expressions like 'x'+3 and 'x'+'y'. The design is subjected to change later when we fix the class hierarchy of symbolic expressions. llvm-svn: 67678
* GRExprEngine:Ted Kremenek2009-03-201-0/+17
| | | | | | | | - Conjure symbols at '--' and '++' unary operations - Add utility method SVal::GetConjuredSymbolVal() and constify some arguments along the way. llvm-svn: 67395
* Fix crash reported in <rdar://problem/6695527>. We now haveTed Kremenek2009-03-181-3/+10
| | | | | | | | | SVal::GetRValueSymbolVal do the checking if we can symbolicate a type instead of having BasicStoreManager do it (which wasn't always doing the check consistently). Having this check in SVal::GetRValueSymbolVal keeps the check in one centralized place. llvm-svn: 67245
* Remove some now-unneeded calls to llvm::errs().flush().Daniel Dunbar2009-03-101-1/+1
| | | | llvm-svn: 66555
* Rework use of loc::SymbolVal in the retain/release checker to use the new methodTed Kremenek2009-03-031-0/+36
| | | | | | | | | | | SVal::getAsLocSymbol(). This simplifies the code and allows the retain/release checker to (I believe) also correctly reason about location symbols wrapped in SymbolicRegions. Along the way I cleaned up SymbolRef a little, disallowing implicit casts to 'unsigned'. llvm-svn: 65972
* Fix case where we should use dyn_cast instead of cast.Ted Kremenek2009-03-031-1/+1
| | | | llvm-svn: 65956
* Fix a couple bugs:Ted Kremenek2009-01-301-4/+3
| | | | | | | | | | | | | | - NonLoc::MakeVal() would use sizeof(unsigned) (literally) instead of consulting ASTContext for the size (in bits) of 'int'. While it worked, it was a conflation of concepts and using ASTContext.IntTy is 100% correct. - RegionStore::getSizeInElements() no longer assumes that a VarRegion has the type "ConstantArray", and handles the case when uses use ordinary variables as if they were arrays. - Fixed ElementRegion::getRValueType() to just return the rvalue type of its "array region" in the case the array didn't have ArrayType. - All of this fixes <rdar://problem/6541136> llvm-svn: 63347
* Static analyzer: Remove a bunch of outdated SymbolData objects andTed Kremenek2009-01-221-31/+7
| | | | | | | | | | | | | | | | | | | | their associated APIs. We no longer need separate SymbolData objects for fields, variables, etc. Instead, we now associated symbols with the "rvalue" of a MemRegion (i.e., the value stored at that region). Now we only have two kinds of SymbolData objects: SymbolRegionRValue and SymbolConjured. This cleanup also makes the distinction between a SymbolicRegion and a symbolic value that is a location much clearer. A SymbolicRegion represents a chunk of symbolic memory, while a symbolic location is just a "pointer" with different possible values. Without any specific knowledge, a symbolic location resolves (i.e., via a dereference) to a SymbolicRegion. In the future, when we do better alias reasoning, a symbolic location can become an alias for another location, thus merging the constraints on the referred SymbolicRegion with the other region. llvm-svn: 62769
* Lazy bingding for region-store manager.Zhongxing Xu2008-12-201-0/+15
| | | | | | | | | | | | | * Now Bind() methods take and return GRState* because binding could also alter GDM. * No variables are initialized except those declared with initial values. * failed C test cases are due to bugs in RemoveDeadBindings(), which removes constraints that is still alive. This will be fixed in later patch. * default value of array and struct regions will be implemented in later patch. llvm-svn: 61274
* Add utility method. Remove an unused method.Zhongxing Xu2008-12-091-0/+2
| | | | llvm-svn: 60758
* Rename SymbolID to SymbolRef. This is a precursor to some overhauling of ↵Ted Kremenek2008-12-051-2/+2
| | | | | | the representation of symbolic values. llvm-svn: 60575
* Add utility methods.Zhongxing Xu2008-11-241-0/+9
| | | | llvm-svn: 59956
* Add getSize() support for StringRegion.Zhongxing Xu2008-11-241-0/+5
| | | | llvm-svn: 59930
* Initial support for checking out of bound memory access. Only support Zhongxing Xu2008-11-221-0/+5
| | | | | | ConcreteInt index for now. llvm-svn: 59869
* Add SymbolData for array elements and struct fields.Zhongxing Xu2008-11-191-0/+16
| | | | llvm-svn: 59618
* Flush llvm::errs() when printing out SVals.Ted Kremenek2008-11-151-1/+1
| | | | llvm-svn: 59334
* Pretty-printing for SVals now mainly uses llvm::raw_ostream. We have an ↵Ted Kremenek2008-10-301-125/+9
| | | | | | adapter for std::ostream, but this will be removed in the future. llvm-svn: 58445
* Added iterators to nonloc::CompoundSVal.Ted Kremenek2008-10-301-0/+21
| | | | | | Added pretty-printing for nonloc::CompoundSVal. llvm-svn: 58442
* 80 col violation.Ted Kremenek2008-10-301-3/+3
| | | | llvm-svn: 58441
* CompoundVal now uses an ImmutableList<SVal> to store its set of SVals. This ↵Ted Kremenek2008-10-301-3/+8
| | | | | | change was motivated by the need to allow state-splitting in GRExprEngine::VisitInitListExpr. As a side-benefit, we no longer need to perform any copies of SVals when creating a CompoundSVal, and the profiling of CompoundSVal is now constant time. llvm-svn: 58437
* Add CompoundVal and CompoundValData for representing the value of InitListExpr.Zhongxing Xu2008-10-301-0/+5
| | | | llvm-svn: 58418
* - Fix type-punning warning in SVals.cpp by using a real iterator class for ↵Ted Kremenek2008-10-271-11/+11
| | | | | | | | symbol_iterator. - Add symbol_iterator support for SymbolicRegions. llvm-svn: 58300
* Remove loc::StringLiteralVal. Now we allocate regions for string literals in ↵Zhongxing Xu2008-10-261-16/+0
| | | | | | the Store. llvm-svn: 58182
* Add printing with llvm::raw_ostream methods to SVals.Zhongxing Xu2008-10-241-0/+131
| | | | llvm-svn: 58073
* Rename:Zhongxing Xu2008-10-211-0/+399
RValues.h/cpp => SVals.h/cpp llvm-svn: 57893
OpenPOWER on IntegriCloud