aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Analysis/PathSensitive/BasicValueFactory.h
AgeCommit message (Collapse)Author
2010-01-25Split libAnalysis into two libraries: libAnalysis and libChecker.Ted Kremenek
(1) libAnalysis is a generic analysis library that can be used by Sema. It defines the CFG, basic dataflow analysis primitives, and inexpensive flow-sensitive analyses (e.g. LiveVariables). (2) libChecker contains the guts of the static analyzer, incuding the path-sensitive analysis engine and domain-specific checks. Now any clients that want to use the frontend to build their own tools don't need to link in the entire static analyzer. This change exposes various obvious cleanups that can be made to the layout of files and headers in libChecker. More changes pending. :) This change also exposed a layering violation between AnalysisContext and MemRegion. BlockInvocationContext shouldn't explicitly know about BlockDataRegions. For now I've removed the BlockDataRegion* from BlockInvocationContext (removing context-sensitivity; although this wasn't used yet). We need to have a better way to extend BlockInvocationContext (and any LocationContext) to add context-sensitivty. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94406 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-25Fix <rdar://problem/7249327> by allowing silent conversions between signed ↵Ted Kremenek
and unsigned integer values for symbolic values. This is an intermediate solution (i.e. hack) until we support extension/truncation of symbolic integers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82737 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09Remove tabs, and whitespace cleanups.Mike Stump
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-06Implement lazy "copying" of structures and arrays in RegionStore. WhileTed Kremenek
RegionStore already lazily abstracted the contents of arrays and structs, when doing an assignment from one array/struct to another we did an explicit element-wise copy, which resulted in a loss of laziness and huge performance problem when analyzing many code bases. Now RegionStoreManager handles such assignments using a new SVal could 'LazyCompoundSVal', which basically means the value of a given struct or array (a MemRegion*) in a specific state (GRState). When we do a load from a field whose encompassing struct binds to a LazyCompoundSVal, we essentially do a field lookup in the original structure. This means we have essentially zero copying of data for structs/arrays and everything stays lazy. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78268 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-05If the UnaryOperator has non-location type, use its type to create theZhongxing Xu
constant value. If the UnaryOperator has location type, create the constant with int type and pointer width. This fixes the bug that all pointer increments 'p++' evaluated to Unknown. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78147 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-11Implement analyzer support for OSCompareAndSwap. This required pushing "tagged"Ted Kremenek
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68845 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-26analyzer infrastructure: make a bunch of changes to symbolic expressions thatTed Kremenek
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67731 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13Fix typo.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66905 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13Fix failure reported by Sebastian of test/Analysis/ptr-arith.c when the targetTed Kremenek
is 64-bit. I used his suggestion of doing a direct bitwidth/signedness conversion of the 'offset' instead of just changing the sign. For more information, see: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2009-March/004587.html git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66892 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11Add utility method to BasicValueFactory to convert an APSInt to one of a ↵Ted Kremenek
different sign. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66637 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17BasicValueFactory: getMinValue/getMaxValue can be applied to any location ↵Ted Kremenek
type as specified by Loc::IsLocType(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64832 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17BasicValueFactory: getMaxValue and getMinValue now also handle 'block' pointers.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64786 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-16Modify getMaxValue/getMinValue to take pointer values as well.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64682 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-16BasicValueFactory: Add utility methods 'Add1' and 'Sub1' to get a persistent ↵Ted Kremenek
APSInt value that is 1 greater or 1 less than the provided value. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64678 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-16BasicValueFactory: Add getMaxValue and getMinValue variants that take QualTypes.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64677 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-30Fix a couple bugs:Ted Kremenek
- 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> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63347 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05Rename SymbolID to SymbolRef. This is a precursor to some overhauling of ↵Ted Kremenek
the representation of symbolic values. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60575 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22Initial support for checking out of bound memory access. Only support Zhongxing Xu
ConcreteInt index for now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59869 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-15Add isUnsigned option.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59355 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-30Added iterators to nonloc::CompoundSVal.Ted Kremenek
Added pretty-printing for nonloc::CompoundSVal. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58442 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-30CompoundVal now uses an ImmutableList<SVal> to store its set of SVals. This ↵Ted Kremenek
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58437 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-30Add CompoundVal and CompoundValData for representing the value of InitListExpr.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58418 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-17This patch did the following renaming. There should be no functional changes.Zhongxing Xu
RVal => SVal LVal => Loc NonLVal => NonLoc lval => loc nonlval => nonloc git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57671 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-18Implement second part of PR 2600: NSError** parameter may be null, and ↵Ted Kremenek
should be checked before being dereferenced. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56318 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-29Add lval::ArrayOffset, which represent the locations of entries in an array.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50453 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-29Added lval::FieldOffset, which represents symbolic lvalues for field offsets ↵Ted Kremenek
from other Lvalues. This removes the failure in null-deref-ps.c (test suite). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50449 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-22Added "nonlval::LValAsInteger" to represent abstract LVals casted to ↵Ted Kremenek
integers, allowing us to track lvals when they are casted back to pointers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50108 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-07Renamed ValueManager to BasicValueFactory.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48025 91177308-0d34-0410-b5e6-96231b3b80d8