aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/GRExprEngine.cpp
AgeCommit message (Collapse)Author
2008-10-04This is a big patch, but the functionality change is small and the rest of ↵Ted Kremenek
the patch consists of deltas due to API changes. This patch overhauls the "memory region" abstraction that was prototyped (but never really used) as part of the Store.h. This patch adds MemRegion.h and MemRegion.cpp, which defines the class MemRegion and its subclasses. This classes serve to define an abstract representation of memory, with regions being layered on other regions to to capture the relationships between fields and variables, variables and the address space they are allocated in, and so on. The main motivation of this patch is that key parts of the analyzer assumed that all value bindings were to VarDecls. In the future this won't be the case, and this patch removes lval::DeclVal and replaces it with lval::MemRegionVal. Now all pieces of the analyzer must reason about abstract memory blocks instead of just variables. There should be no functionality change from this patch, but it opens the door for significant improvements to the analyzer such as field-sensitivity and object-sensitivity, both which were on hold until the memory abstraction got generalized. The memory region abstraction also allows type-information to literally be affixed to a memory region. This will allow the some now redundant logic to be removed from the retain/release checker. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57042 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-01Add a QualType to ConjuredSymbol to represent the type and size of the symbol.Ted Kremenek
Use this updated interface when invalidating arguments passed by reference; the type of symbol is of the object passed by reference, not the reference itself. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56894 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30Revert last patch, but add a fixmeTed Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56832 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30Within the transfer function of UnaryOperatorExpr, handle implicit promotionsTed Kremenek
from the subexpression type to the expression type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56831 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-20Add PostStore, a new ProgramPoint to distinguish between 'stores' and other ↵Ted Kremenek
PostStmts. GRExprEngine: Use PostStore in EvalStore. Use a second version of EvalStore in EvalBinaryOperator to associate the store with the expression on the LHS. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56383 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-19Bug fix: for the base transfer function logic for casts, handle const casts ↵Ted Kremenek
as just propagating the value. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56368 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-19Add panic function "__assert_fail".Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56327 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-09-16ProgramPoint now takes the space of two pointers instead of one. This change wasTed Kremenek
motivated because it became clear that the number of subclasses of ProgramPoint would expand and we ran out of bits to represent a pointer variant. As a plus of this change, BlockEdge program points can now be represented explicitly without using a cache of CFGBlock* pairs in CFG. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56245 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-13Patch by Csaba Hruska!Ted Kremenek
"Here is a patch what replaces std::ostream with llvm::raw_ostream. This patch covers the AST library, but ignores Analysis lib." git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56185 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28Remove BasicStore.h (migrated function prototype for CreateBasicStore() to ↵Ted Kremenek
Store.h) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55519 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28Make store "Regions" and "Bindings" more abstract instead of concrete variants.Ted Kremenek
Their precise semantics will be implemented by a specific StoreManager. Use function pointer to create the StoreManager in GRStateManager. This matches how we create ConstraintsManager. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55514 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28Fixed analyzer caching bug involving the transfer function for loads.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55494 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28Fixed analyzer caching bug in DeclStmt.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55487 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27Refactor Assume logic into a separate class ConstraintManager.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55412 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-25Added 'extents' for Regions.Ted Kremenek
Added 'getExtent()' to StoreManager. Implemented 'getExtent()' for BasicStoreManager. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55321 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21Move the handling of DeclStmt from GRExprEngine to BasicStoreManager.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55144 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-19Patch by Zhongxing Xu!Ted Kremenek
This patch extends BasicStoreManager::getInitialStore() to include code that symbolicates input variables. It also removes redundant handling of ImplicitParamDecl, since it is a subclass of VarDecl. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54993 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-18Add ExplicitCastExpr to replace the current CastExpr, and have ↵Argyrios Kyrtzidis
ImplicitCastExpr and ExplicitCastExpr derive from a common base class (CastExpr): Expr -> CastExpr -> ExplicitCastExpr -> ImplicitCastExpr git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54955 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-16GRState:Ted Kremenek
- Remove ConstNotEq from GRState/GRStateManager (!= tracking uses GDM instead). - GRStateManager now can book-keep "contexts" (e.g., factory objects) for uses with data elements stored into the GDM. - Refactor pretty-printing of states to use GRState::Printer objects exclusively. This removed a huge amount of pretty-printing logic from GRExprEngine. CFRefCount - Simplified some API calls based on refinements to the GDM api. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54835 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-14Default initialize only pointers and integer types (for now).Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54798 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-13Renamed GRState::CheckerStatePrinter to GRState::Printer.Ted Kremenek
Updated checker state printer interface to allow transfer functions to return an arbitrary number of GRState::Printers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54762 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-13Rename ValueState -> GRState.Ted Kremenek
Rename ValueStateManager -> GRStateManager. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54721 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-13Initialize tracked local variables to undefined.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54716 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22Added path-sensitive checking for null pointer values passed to function ↵Ted Kremenek
arguments marked nonnull. This implements <rdar://problem/6069935> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53891 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-18Add panic function.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53755 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-18Created ValueStateSet class to manage the creation of multiple states by a ↵Ted Kremenek
method. Modified the new EvalBinOpNN to generate states instead of nodes. This is a much simpler interface and is what clients will want to do. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53750 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17Move GRTransferFunc* into ValueStateManager, and move the assumption logic ↵Ted Kremenek
there as well. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53743 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17Remove redundant logic.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53740 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17Begin major changes to EvalXXX methods in GRTransferFuncs. Currently some ↵Ted Kremenek
of the methods only return an RVal; we want them to be able to create an arbitrary number of states. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53739 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-11Refactored auditor interface within GRExprEngine and GRCoreEngine to use a ↵Ted Kremenek
"batch auditor" to dispatch to specialized auditors instead of having a separate vector for each audited Expr*. This not only provides a much cleaner implementation, but also allows us to install auditors for any expression. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53464 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-10Refactored most of the "Store" piece of ValueState into a Store type. TheTed Kremenek
current store implementation is now encapsulated by BasicStore. These changes prompted some long due constification of ValueState. Much of the diffs in this patch include adding "const" qualifiers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53423 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09Remove getParentMap() from GRExprEngine.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53343 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02Refactored some of the BugReporter interface so that data such as the ↵Ted Kremenek
ASTContext&, PathDiagnosticClient*, can be provided by an external source. Split BugReporter into BugReporter and GRBugReporter so checkers not based on GRExprEngine can still use the BugReporter mechanism. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53048 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-02GRExprEngine now expects the LiveVariables information to be provided by its ↵Ted Kremenek
creator. This allows an optimization in AnalysisConsumer where the same LiveVariables information is used between multiple analyses. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53046 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-20Modified the dead stores checker to...Ted Kremenek
1) Check if a dead store appears as a subexpression. For such cases, we emit a verbose diagnostic so that users aren't confused. This addresses: <rdar://problem/5968508> checker gives misleading report for dead store in loop 2) Don't emit a dead store warning when assigning a null value to a pointer. This is a common form of defensive programming. We may wish to make this an option to the the checker one day. This addresses the feature request in the following email: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-June/001978.html git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52555 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19Introduce initial transfer function support for __imag__ and __real__. We don'tTed Kremenek
have complex RValues yet, so this logic is only fully implemented when __imag__ and __real__ are used on non-complex types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52501 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-18Added a new ProgramPoint: PostPurgeDeadSymbols. This new program point ↵Ted Kremenek
distinguishes between the cases when we just evaluated the transfer function of a Stmt* (PostStmt) or performed a load (PostLoad). This solves a caching bug observed in a recent bug report. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52443 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17Change self/_cmd to be instances of ImplicitParamDecl instead of ParmVarDecl.Chris Lattner
Patch by David Chisnall! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52422 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-21Fixed bug in the transfer function for dereferences: the loaded value from ↵Ted Kremenek
EvalLoad should bind to the UnaryOperator*, not its subexpression. Added test case to exercise this fix when checking for uses of uninitialized values. Patch by Zhongxing Xu! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51377 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-17Micro-optimization when checking for panic functions.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51214 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-17Fix 80 col violation.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51213 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-17Added panic function _XCAssertionFailureHandler.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51212 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-09Rename IsPointerType to LVal::IsLValType, and update CFRefCount::EvalSummary ↵Ted Kremenek
to use IsLValType when conjuring symbols for return values (this fixes a bug with an assertion firing in the analyzer when two qualified objective-c types were compared). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50924 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-02Really noreturn on exceptions.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50579 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-01Added temporary fix for Obj-C exception handling in the static analyzer: ↵Ted Kremenek
treat these as panic functions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50535 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-01Added __assert_rtn to list of panic functions.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50530 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-01Added ziperr as a panic function. Eventually inter-procedural analysisTed Kremenek
should catch this one easily. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50526 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30Add placeholder code in the static analyzer for MemberExprs involving struct ↵Ted Kremenek
temporaries. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50502 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30Add workaround for __builtin_offsetof in the static analyzer.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50500 91177308-0d34-0410-b5e6-96231b3b80d8