summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/GRExprEngine.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Hard bifurcate the state into nil receiver and non-nil receiver, so thatZhongxing Xu2009-12-021-40/+58
| | | | | | | | | | | we don't need to use the DoneEvaluation hack when check for ObjCMessageExpr. PreVisitObjCMessageExpr() only checks for undefined receiver or arguments. Add checker interface EvalNilReceiver(). This is a 'once-and-done' interface. llvm-svn: 90296
* Eliminate another VISIBILITY_HIDDENDouglas Gregor2009-11-301-4/+1
| | | | llvm-svn: 90139
* Adapt to the DOTGraphTraits changes in LLVM.Tobias Grosser2009-11-301-1/+4
| | | | llvm-svn: 90137
* lib/Analysis: Remove VISIBILITY_HIDDEN from definitions in anonymous namespaceKovarththanan Rajaratnam2009-11-281-2/+4
| | | | llvm-svn: 90028
* Refine MemRegions for blocks. Add a new region calledTed Kremenek2009-11-251-1/+3
| | | | | | | | | | | '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.). llvm-svn: 89900
* Add post-visit Checker support in GRExprEngine for BlockExpr.Ted Kremenek2009-11-251-1/+7
| | | | llvm-svn: 89890
* Make RegisterInternalChecks() part of GRExprEngine's private implementation ↵Ted Kremenek2009-11-251-30/+32
| | | | | | by making it a static function within GRExprEngine.cpp. llvm-svn: 89884
* Register internal checks with GRExprEngine when it is constructed, not ↵Ted Kremenek2009-11-251-1/+5
| | | | | | manually in AnalysisConsumer.cpp. llvm-svn: 89883
* When dispatching to Checker objects in GRExprEngine::CheckerVisit(),Ted Kremenek2009-11-251-4/+12
| | | | | | | | | 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? llvm-svn: 89882
* Add transfer function support for BlockExpr.Ted Kremenek2009-11-251-0/+12
| | | | llvm-svn: 89829
* Cleanups and fixes to the nil-receiver checker, some of it fallout theTed Kremenek2009-11-241-7/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 89804
* Refactor undefined result checker. This is the last one.Zhongxing Xu2009-11-241-14/+34
| | | | llvm-svn: 89750
* Refactor NilReceiverStructRet and NilReceiverLargerThanVoidPtrRet into Zhongxing Xu2009-11-241-86/+9
| | | | | | CallAndMessageChecker. llvm-svn: 89745
* Clean up the Checker API a little more, resolving some hidden bugsTed Kremenek2009-11-231-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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). llvm-svn: 89707
* Initial refactor of UndefBranchChecker. We still use GRBranchNodeBuilderZhongxing Xu2009-11-231-40/+34
| | | | | | in the checker directly. But I don't have a better approach for now. llvm-svn: 89640
* Undefined compound assignment result is checked in ↵Zhongxing Xu2009-11-221-9/+0
| | | | | | UndefinedAssignmentChecker. So this check is redundant. llvm-svn: 89592
* Remove invalid comments. The result is undefined only when operands are ↵Zhongxing Xu2009-11-221-2/+0
| | | | | | undefined. llvm-svn: 89591
* Pull BadCallChecker int UndefinedArgChecker, and have UndefinedArgChecker ↵Ted Kremenek2009-11-211-134/+121
| | | | | | also handled undefined receivers in message expressions. llvm-svn: 89524
* More checker refactoring. Passing undefined values in a message expression ↵Ted Kremenek2009-11-211-20/+0
| | | | | | is now handled by UndefinedArgChecker. llvm-svn: 89519
* Revert r89437 and add a comment.Zhongxing Xu2009-11-201-1/+2
| | | | llvm-svn: 89446
* It's unnecessary to check for unknown at this point.Zhongxing Xu2009-11-201-2/+1
| | | | llvm-svn: 89437
* Remove printf statement.Ted Kremenek2009-11-191-2/+0
| | | | llvm-svn: 89383
* Add EvalEndPath interface to Checker. Now we can check memory leaked at theZhongxing Xu2009-11-171-0/+5
| | | | | | end of the path. Need to unify interfaces. llvm-svn: 89063
* Clear the dest set.Zhongxing Xu2009-11-171-0/+1
| | | | llvm-svn: 89060
* * Do the same thing to the basicstore as in r84163.Zhongxing Xu2009-11-161-3/+10
| | | | | | | | | | * Add a load type to GRExprEngine::EvalLoad(). * When retrieve from 'theValue' of OSAtomic funcitions, use the type of the region instead of the argument expression as the load type. * Then we can convert CastRetrievedSVal to a pure assertion. In the future we can let all Retrieve() methods simply return SVal. llvm-svn: 88888
* Remove an unused parameter.Zhongxing Xu2009-11-161-3/+2
| | | | llvm-svn: 88882
* Move definition of GRExprEngine::ProcessEndPath() out-of-line.Ted Kremenek2009-11-141-0/+7
| | | | llvm-svn: 88729
* Check in a new interface of Checker, which will soon be used.Zhongxing Xu2009-11-131-1/+23
| | | | llvm-svn: 87092
* GRStateManager::CurrentStmt is not used. Remove it.Zhongxing Xu2009-11-131-4/+0
| | | | llvm-svn: 87091
* Enhance Checker class (and GRExprEngine) to support PostVisitation for ↵Ted Kremenek2009-11-121-10/+10
| | | | | | CallExprs. No clients (yet). llvm-svn: 86949
* Remove GRExprEngine::EvalCall(). It had a single callsite in GRExprEngine, ↵Ted Kremenek2009-11-121-13/+10
| | | | | | and was easily inlined. llvm-svn: 86948
* Remove some stale ErrorNodes variables in GRExprEngine and the old buffer ↵Ted Kremenek2009-11-111-0/+12
| | | | | | overflow logic in GRExprEngineInternalChecks.cpp. llvm-svn: 86877
* Add undefined array subscript checker.Zhongxing Xu2009-11-111-1/+4
| | | | llvm-svn: 86837
* Remove the old out-of-bound checking code.Zhongxing Xu2009-11-111-42/+0
| | | | llvm-svn: 86836
* Refactor DereferenceChecker to use only the new Checker API instead ofTed Kremenek2009-11-111-80/+96
| | | | | | | | | | the old builder API. This percolated a bunch of changes up to the Checker class (where CheckLocation has been renamed VisitLocation) and GRExprEngine. ProgramPoint now has the notion of a "LocationCheck" point (with PreLoad and PreStore respectively), and a bunch of the old ProgramPoints that are no longer used have been removed. llvm-svn: 86798
* Fix clang's use of DenseMap iterators after r86636 fixed their constness.Jeffrey Yasskin2009-11-101-1/+1
| | | | | | Patch by Victor Zverovich! llvm-svn: 86638
* Remove stale FIXME.Ted Kremenek2009-11-091-3/+0
| | | | llvm-svn: 86595
* Add checker for CWE-588: Attempt to Access Child of a Non-structure Pointer.Zhongxing Xu2009-11-091-6/+9
| | | | llvm-svn: 86529
* Remove Checker::CheckType() (and instead using ↵Ted Kremenek2009-11-071-16/+5
| | | | | | CheckerVisitor::PreVisitDeclStmt()), and refactor VLASizeChecker to have only one Checker subclass (not two) and to not use the node builders directly (and instead use the newer CheckerContext). llvm-svn: 86329
* static analyzer: refactor checking logic for returning the address of a ↵Ted Kremenek2009-11-061-55/+29
| | | | | | | | | stack variable or a garbage value into their own respective subclasses of Checker (and put them in .cpp files where their implementation details are hidden from GRExprEngine). llvm-svn: 86215
* Modify GRExprEngine::EvalBind() to take both a "store expression" andTed Kremenek2009-11-051-25/+18
| | | | | | | | an "assign expression", representing the expressions where the value binding occurs and the assignment takes place respectively. These are largely syntactic clues for better error reporting. llvm-svn: 86084
* Catch uses of undefined values when they are used in assignment, thus ↵Ted Kremenek2009-11-041-23/+71
| | | | | | catching such bugs closer to the source. llvm-svn: 86003
* Refactor StoreManager::BindDecl() to take a VarRegion* instead of a ↵Ted Kremenek2009-11-041-20/+23
| | | | | | VarDecl*, and modify GRExprEngine::EvalBind() to handle decl initialization as well. This paves the way for adding "checker" visitation in EvalBind(). llvm-svn: 85983
* Change GRTransferFuncs::RegisterChecks() to take a GRExprEngine& instead of ↵Ted Kremenek2009-11-031-1/+1
| | | | | | a BugReporter&. This paves the way for pulling some of the retain/release checker into a "Checker" class. llvm-svn: 85971
* Pull VLA size checker into its own files. Zhongxing Xu2009-11-031-36/+17
| | | | | | | | Split it to two checkers, one for undefined size, the other for zero size, so that we don't need to query the size when emitting the bug report. llvm-svn: 85895
* Implement: <rdar://problem/6250216> Warn against using -[NSAutoreleasePool ↵Ted Kremenek2009-11-031-6/+9
| | | | | | release] in GC mode llvm-svn: 85887
* Remove GRExprEngine::CheckerVisitLocation(). It was only called in one ↵Ted Kremenek2009-11-021-18/+10
| | | | | | place, so we inlined it in to GRExprEngine::EvalLocation(). llvm-svn: 85838
* Tighten computation of ExprVal using ?: expression. No functionality change.Ted Kremenek2009-10-301-5/+1
| | | | llvm-svn: 85618
* Make checkers run in deterministic order.Ted Kremenek2009-10-301-9/+15
| | | | llvm-svn: 85597
* Fix PR5316: make assignment expressions can be visited as lvalue. Then we Zhongxing Xu2009-10-301-25/+22
| | | | | | | can get the correct base lvalue. Revert r85578. llvm-svn: 85579
OpenPOWER on IntegriCloud