summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/GRExprEngine.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Handle loading of field values from LazyCompoundVals in ↵Ted Kremenek2009-10-301-6/+19
| | | | | | | | GRExprEngine::VisitMemberExpr(). This fixes the crash reported in PR 5316. llvm-svn: 85578
* Move NullDeref and UndefDeref into their own checker. Zhongxing Xu2009-10-291-61/+29
| | | | | | | | Add a CheckLocation() interface to Checker. Now ImplicitNullDeref nodes are cached in NullDerefChecker. More cleanups follow. llvm-svn: 85471
* [llvm up]Douglas Gregor2009-10-291-62/+25
| | | | | | | Switch a few ugly switch-on-string-literal constructs to use the new llvm::StringSwitch. llvm-svn: 85461
* 'error' is usually used as a noreturn function. This can suppress some falseZhongxing Xu2009-10-261-11/+4
| | | | | | | warnings. Eventually we need a way to import externally defined functions summaries. llvm-svn: 85092
* Eliminate QualifiedDeclRefExpr, which captured the notion of aDouglas Gregor2009-10-231-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | qualified reference to a declaration that is not a non-static data member or non-static member function, e.g., namespace N { int i; } int j = N::i; Instead, extend DeclRefExpr to optionally store the qualifier. Most clients won't see or care about the difference (since QualifierDeclRefExpr inherited DeclRefExpr). However, this reduces the number of top-level expression types that clients need to cope with, brings the implementation of DeclRefExpr into line with MemberExpr, and simplifies and unifies our handling of declaration references. Extended DeclRefExpr to (optionally) store explicitly-specified template arguments. This occurs when naming a declaration via a template-id (which will be stored in a TemplateIdRefExpr) that, following template argument deduction and (possibly) overload resolution, is replaced with a DeclRefExpr that refers to a template specialization but maintains the template arguments as written. llvm-svn: 84962
* Simplify some code. No functionality change.Zhongxing Xu2009-10-211-55/+43
| | | | llvm-svn: 84757
* PR5218: Replace IdentifierInfo::getName with StringRef version, now that clientsDaniel Dunbar2009-10-181-1/+1
| | | | | | are updated. llvm-svn: 84447
* Move misc clients to IdentifierInfo StringRef API.Daniel Dunbar2009-10-181-1/+1
| | | | | | | | | - strcmp -> == - OS.write(II->getName() ...) -> OS << II->getNameStr() - Avoid std::string concatenation - Use getNameStr().str() when an std::string is really needed. llvm-svn: 84437
* Move clients to use IdentifierInfo::getNameStart() instead of getName()Daniel Dunbar2009-10-181-3/+2
| | | | llvm-svn: 84436
* Remove dead code.Zhongxing Xu2009-10-141-13/+0
| | | | llvm-svn: 84073
* * Remove unused GRState* parameterZhongxing Xu2009-10-141-3/+3
| | | | | | * Make all Base value the last argument. llvm-svn: 84071
OpenPOWER on IntegriCloud