aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Analysis/PathSensitive/GRExprEngine.h
AgeCommit message (Collapse)Author
2008-11-08Add a boilerplate for out-of-bound array checking. This has no real function ↵Zhongxing Xu
currently. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58886 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-07Finish the implementation of VisitCompoundLiteralExpr. As VisitInitListExpr is Zhongxing Xu
available, things get much simplified. One addition is that CompoundLiteralExpr can appear both in rvalue and lvalue context. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58837 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-30Rename:Zhongxing Xu
- SetSVal(GRState*, Loc, SVal) => BindLoc - SetSVal(GRState*, Expr*, SVal) => BindExpr git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58421 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-30Implement VisitInitListExpr(). InitListExpr will have a nonloc::CompoundVal ↵Zhongxing Xu
value. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58419 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-28Improve our handling of (C++) references within Clang. Specifically:Douglas Gregor
- Do not allow expressions to ever have reference type - Extend Expr::isLvalue to handle more cases where having written a reference into the source implies that the expression is an lvalue (e.g., function calls, C++ casts). - Make GRExprEngine::VisitCall treat the call arguments as lvalues when they are being bound to a reference parameter. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58306 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27Added preliminary support for CompoundLiterals in the static analyzer:Ted Kremenek
- GRExprEngine::VisitCompoundLiteral... (1) visits the initializer list (generating ExplodedNodes) (2) creates a CompoundMemRegion for the literal (3) creates a new state with the bound literal values using GRStateManager::BindCompoundLiteral - GRStateManager::BindCompoundLiteral simply calls StoreManager::BindCompoundLiteral to get a new store and returns a persistent GRState with that store. - BasicStore::BindCompoundLiteral simply returns the same store, as it doesn't handle field sensitivity - RegionStore::BindCompoundLiteral currently fires an assert (pending discussion of how to best implement mappings for CompoundLiteralRegion). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58277 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24Make the analyzer store (memory model) a command line option.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58056 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21Change signature for CheckDivideZero.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57876 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-10-17Remove lval::FieldOffset, lval::ArrayOffset. These will be replaced with ↵Ted Kremenek
regions. Remove GRExprEngine::getLVal and RValues::MakeVal. Enhance StoreManager "GetLValue" methods to dispatch for specific kinds of lvalue queries, as opposed to interogating the expression tree (GRExprEngine already does this). Added FIXMEs. In particular, we no longer "assume" that a base pointer in a field/array access is null (this logic was removed). Perhaps we should do this when fetching the lvalue for fields and array elements? git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57657 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-17Add transfer function support for ObjCIvarRefExpr.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57654 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-16This is the first step to build a better evaluation model for GRExprEngine. AZhongxing Xu
new VisitLValue method is added to replace the old VisitLVal. The semantics model becomes more explicit to separate rvalue evaluation from lvalue evaluation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57627 91177308-0d34-0410-b5e6-96231b3b80d8
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-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-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-18Change implementation of NSError** coding-style check to be invoked at the ↵Ted Kremenek
end of the retain/release analysis. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56312 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-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-07-22Moved registration of basic path-sensitive checks from GRSimpleVals.cpp to ↵Ted Kremenek
GRExprEngineInternalChecks.cpp. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53909 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-18Renamed deterministic EvalBinOp to DetermEvalBinOpNN. This name mangling is ↵Ted Kremenek
unfortunately needed because virtual methods with the same name can be hidden by subclasses. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53751 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-18Remove dead method.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53748 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-05-29- Move ObjC Expresssion AST's from Expr.h => ExprObjC.hSteve Naroff
- #include ExprObjC.h in many places git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51703 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-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-01When processing "release", "retain", and "autorelease" messages return theTed Kremenek
lval passed as an argument. Fix: Inverted diagnostic messages. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50513 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-30Teach more of the static analyzer about ObjCQualifiedIdType.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50494 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-29Major rewrite/refactoring of static analysis engine. We now useTed Kremenek
EvalStore/EvalLoad to handle all loads/stores from symbolic memory, allowing us to do checks for null dereferences, etc., at any arbitrary load/store (these were missed checks before). This also resulted in some major cleanups, some conceptual, and others just in the structure of the code. This temporarily introduces a regression in the test suite (null-deref-ps.c) before I add a new LVal type for structure fields. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50443 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-24More boilerplate for handling specialized-transfer function logic for dead ↵Ted Kremenek
symbols. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50233 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-24Added initial boilerplate in GRExprEngine to allow checker-specific transferTed Kremenek
function logic to act when symbols become dead. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50221 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-23Fixed: <rdar://problem/5881148>Ted Kremenek
Problem: In the recently refactored VisitDeref (which processes dereferences), we were incorrectly skipping the node just generated for the subexpression of the dereference. This was a horrible regression. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50176 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-22Rewrote VisitDeclStmt to properly handle initializers that can do anything.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50112 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-22Add VisitArraySubscriptExpr.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50090 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-21Added support for detected bad dereferences involving MemberExprs, e.g. x->f ↵Ted Kremenek
where "x" is NULL. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50071 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18Added "EvalAssume" virtual method to GRTransferFuncs; this is for evaluatingTed Kremenek
the checker-specific logic of symbolic assumptions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49910 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16Handle ReturnStmts by dispatching to "EvalReturn" in the transfer function ↵Ted Kremenek
object. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49826 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16Small tweaks to EvalStore: pass an "RVal" instead of "LVal" for the TargetLV toTed Kremenek
represent possible stores to "Unknown." git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49811 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16Hook up "EvalStore" from GRTransferFuncs to GRExprEngine.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49804 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16Take first step to migrating handling of "stores" to values from GRExprEngineTed Kremenek
to the plug-in GRTransferFuncs object. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49801 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-15Added some comments to GRExprEngine. Reorder some of the method definitionsTed Kremenek
to start logically organizing them. Added initial plug-in transfer function support for Objective-C message expressions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49752 91177308-0d34-0410-b5e6-96231b3b80d8