aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis
AgeCommit message (Collapse)Author
2009-11-28Remove unneeded includes.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90032 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-28lib/Analysis: Remove VISIBILITY_HIDDEN from definitions in anonymous namespaceKovarththanan Rajaratnam
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90028 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26Improve diagnostics in ReturnStackAddressChecker for returning a ↵Ted Kremenek
stack-allocated block. Implements the rest of <rdar://problem/7387385>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89940 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26Add a PostVisitBlockExpr() method to RetainReleaseChecker to query forTed Kremenek
the set of variables "captured" by a block. Until the analysis gets more sophisticated, for now we stop the retain count tracking of any objects (transitively) referenced by these variables. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89929 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26Teach RegionStoreManager::RemoveDeadBindings() about BlockDataRegions. Any ↵Ted Kremenek
VarRegion for a "captured" variable should also be considered live. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89928 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26Add iterators to BlockDataRegion that allow clients to iterate over the ↵Ted Kremenek
VarRegions for "captured" variables for a block. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89927 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26Added batch versions of GRState::scanReachableSymbols() so that clients can ↵Ted Kremenek
scan a collection of SVals or MemRegions all at once. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89926 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-26Enhance LiveVariables to understand that blocks can extend the liveness of a ↵Ted Kremenek
variable by "capturing" them in a BlockExpr. This required two changes: 1) Added 'getReferencedgetReferencedBlockVars()' to AnalysisContext so that clients can iterate over the "captured" variables in a block. 2) Modified LiveVariables to take an AnalysisContext& in its constructor and to call getReferencedgetReferencedBlockVars() when it processes a BlockExpr*. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89924 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-25Add missing case in switch statement.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89903 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-25Refine MemRegions for blocks. Add a new region calledTed Kremenek
'BlockDataRegion' to distinguish between the code associated with a block (which is represented by 'BlockTextRegion') and an instance of a block, which includes both code and data. 'BlockDataRegion' has an associated LocationContext, which can be used to eventually model the lifetime of a block object once LocationContexts can represent scopes (and iterations around a loop, etc.). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89900 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-25Remove recently added FIXME. The appropriate FIXME is already in ↵Ted Kremenek
MemRegionManager::getVarRegion(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89897 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-25Add FIXME.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89892 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-25Add post-visit Checker support in GRExprEngine for BlockExpr.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89890 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-25Add a new RetainReleaseChecker class (that subclasses CheckerVisitor) to ↵Ted Kremenek
extend the functionality of the retain/release checker using the new Checker interface. Pieces of CFRefCount will gradually be migrated to this new class over time. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89889 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-25Move RegisterChecks() to the end of the file. No functionality change.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89888 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-25Make RegisterInternalChecks() part of GRExprEngine's private implementation ↵Ted Kremenek
by making it a static function within GRExprEngine.cpp. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89884 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-25Register internal checks with GRExprEngine when it is constructed, not ↵Ted Kremenek
manually in AnalysisConsumer.cpp. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89883 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-25When dispatching to Checker objects in GRExprEngine::CheckerVisit(),Ted Kremenek
only stop processing the checkers after all the nodes for a current check have been processed. This (I believe) handles the case where PredSet (the input nodes) contains more than one node due to state bifurcation. Zhongxing: can you review this? git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89882 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-25Add really basic support for blocks in the retain/release checker. For now, ↵Ted Kremenek
anytime we pass a tracked object to a block call we stop tracking it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89831 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-25Allow building of CFGs for ASTs that contain BlockExprs.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89830 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-25Add transfer function support for BlockExpr.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89829 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-25Split CodeTextRegion into FunctionTextRegion and BlockTextRegion. This a ↵Ted Kremenek
precursor to having basic static analysis support for blocks. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89828 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-24For the nil-receiver checker, take into account the behavioral changes that ↵Ted Kremenek
got introduced in Mac OS X 10.5 and later, notably return values of double, float, etc., will not be garbage. Fixes <rdar://problem/6829160>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89809 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-24Cleanups and fixes to the nil-receiver checker, some of it fallout theTed Kremenek
initial transition of the nil-receiver checker to the Checker interface as done in r89745. Some important changes include: 1) We consolidate the BugType object used for nil receiver bug reports, and don't include the type of the returned value in the BugType (which would be wrong if a nil receiver bug was reported more than once) 2) Added a new (temporary) flag to CheckerContext: DoneEvauating. This is used by GRExprEngine when evaluating message expressions to not continue evaluating the message expression if this flag is set. This flag is currently set by the nil receiver checker. This is an intermediate solution to allow the nil-receiver checker to properly work as a plug-in outside of GRExprEngine. Basically, this flag indicates that the entire message expression has been evaluated, not just a precondition (which is what the nil-receiver checker does). This flag *should not* be repurposed for general use, but just to pull more things out of GRExprEngine that already in there as we devise a better interface in the Checker class. 3) Cleaned up the logic in the nil-receiver checker, making the control-flow a lot easier to read. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89804 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-24We can remove this file now.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89751 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-24Refactor undefined result checker. This is the last one.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89750 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-24Refactor NilReceiverStructRet and NilReceiverLargerThanVoidPtrRet into Zhongxing Xu
CallAndMessageChecker. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89745 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-24rename UndefinedArgChecker to CallAndMessageChecker.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89735 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-24Rename: UndefinedArgChecker.cpp => CallAndMessageChecker.cppZhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89734 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-24Enhance null dereference diagnostics by indicating what variable (if any) ↵Ted Kremenek
was dereferenced. Addresses <rdar://problem/7039161>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89726 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23After performing a bounds check in ArrayBoundChecker, record the fact that a ↵Ted Kremenek
bounds check succeeded by transitioning the ExplodedGraph. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89712 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23Clean up the Checker API a little more, resolving some hidden bugsTed Kremenek
along the way. Important changes: 1) To generate a sink node, use GenerateSink(); GenerateNode() is for generating regular transitions. This makes the API clearer and also allows us to use the 'bool' option to GenerateNode() for a different purpose. 2) GenerateNode() now automatically adds the generated node to the destination ExplodedNodeSet (autotransition) unless the client specifies otherwise with a bool flag. Several checkers did not call 'addTransition()' after calling 'GenerateNode()', causing the simulation path to be prematurely culled when a non-fail stop bug was encountered. 3) Add variants of GenerateNode()/GenerateSink() that take neither a Stmt* or a GRState*; most callers of GenerateNode() just pass in the same Stmt* as provided when the CheckerContext object is created; we can just use that the majority of the time. This cleanup also allows us to potentially coelesce the APIs for evaluating branches and end-of-paths (which currently directly use builders). 4) addTransition() no longer needs to be called except for a few cases. We now have a variant of addTransition() that takes a GRState*; this allows one to propagate the updated state without caring about generating a new node explicitly. This nicely cleaned up a bunch of cases that called autoTransition() with a bunch of conditional logic surround the call (that common logic has now been swallowed up by addTransition() itself). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89707 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23Provide out-of-line definition for destructor of Checker.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89688 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23Tweak UndefBranchChecker to register the most nested "undefined" expression ↵Ted Kremenek
with bugreporter::registerTrackNullOrUndefValue instead of the condition itself. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89682 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23Cleanup title/description of "undefined branch" BugType and add some test ↵Ted Kremenek
cases for this check. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89679 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23Fix CMake buildDouglas Gregor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89650 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23UndefBranchChecker: more bug reporter helper information emit.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89643 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-23Initial refactor of UndefBranchChecker. We still use GRBranchNodeBuilderZhongxing Xu
in the checker directly. But I don't have a better approach for now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89640 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-22Change CheckDeadStores to use Expr::isNullPointerConstant, which will ↵Ted Kremenek
correctly determine whether an expression is a null pointer constant. Patch by Kovarththanan Rajaratnam! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89621 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-22Undefined compound assignment result is checked in ↵Zhongxing Xu
UndefinedAssignmentChecker. So this check is redundant. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89592 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-22Remove invalid comments. The result is undefined only when operands are ↵Zhongxing Xu
undefined. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89591 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-22Save and restore the HasGen flag in MallocChecker.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89590 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-22Don't include a dead header.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89587 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-22Remove UndefinedAssignmentChecker's header.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89585 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-21Make FixedAddressChecker and experimental check; it currently produces a ton ↵Ted Kremenek
of false positives when analyzing some projects (e.g., Wine). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89560 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-21Restructure DereferenceChecker slightly to handle caching out when we would ↵Ted Kremenek
report a null dereference more than once. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89526 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-21Pull BadCallChecker int UndefinedArgChecker, and have UndefinedArgChecker ↵Ted Kremenek
also handled undefined receivers in message expressions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89524 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-21More checker refactoring. Passing undefined values in a message expression ↵Ted Kremenek
is now handled by UndefinedArgChecker. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89519 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-20Fix typo GCC 4.3 warned about.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89453 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-20Add simple static analyzer checker to check for sending 'release', 'retain', ↵Ted Kremenek
etc. directly to a class. Fixes <rdar://problem/7252064>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89449 91177308-0d34-0410-b5e6-96231b3b80d8