summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis
Commit message (Collapse)AuthorAgeFilesLines
* Fix overzealous assertion in GRExprEngine::VisitLValue(). ATed Kremenek2010-01-091-7/+25
| | | | | | | | | CallExpr/ObjCMessageExpr can be visited in an "lvalue" context if it returns a struct temporary. Currently the analyzer doesn't reason about struct temporary returned by function calls, but we shouldn't crash here either. llvm-svn: 93081
* Fix broken diagnostic when returning the address of a stack-allocated array.Ted Kremenek2010-01-091-3/+11
| | | | llvm-svn: 93071
* When binding an rvalue to a reference, create a temporary object. Use Zhongxing Xu2010-01-093-6/+39
| | | | | | | | CXXObjectRegion to represent it. In Environment, lookup a literal expression before make up a value for it. llvm-svn: 93047
* Fix handling in GRExprEngine of 'default' branch in switch statementsTed Kremenek2010-01-081-5/+12
| | | | | | | | | when the default case is winnowed down to be infeasible. When all cases were ruled out (and the analysis state for the default case would be infeasible) we would still consider the default case possible. This fixes PR 5969. llvm-svn: 93017
* Revert r92318. Instead fix the analyzer: do not call Zhongxing Xu2010-01-051-2/+3
| | | | | | ASTContext::hasSameUnqualifiedType() when one of the type is VariableArrayType. llvm-svn: 92723
* Make static analysis support for C++ 'this' expression context-sensitive. ↵Ted Kremenek2010-01-054-30/+46
| | | | | | Essentially treat 'this' as a implicit parameter to the method call, and associate a region with it. llvm-svn: 92675
* Remove references to 'Checker' and 'GRTransferFuncs' fromTed Kremenek2010-01-055-59/+48
| | | | | | | | | | | | GRStateManager. Having these references was an abstraction violation, as they really should only be known about GRExprEngine. This change required adding a new 'ProcessAssume' callback in GRSubEngine. GRExprEngine implements this callback by calling 'EvalAssume' on all registered Checker objects as well as the registered GRTransferFunc object. llvm-svn: 92549
* Let constraint manager inform checkers that some assumption logic has happend.Zhongxing Xu2009-12-313-9/+54
| | | | | | | | | Add new states for symbolic regions tracked by malloc checker. This enables us to do malloc checking more accurately. See test case. Based on Lei Zhang's patch and discussion. llvm-svn: 92342
* Simplify code by using an equivalent template class.Zhongxing Xu2009-12-301-11/+2
| | | | llvm-svn: 92305
* Remove some dead variables clang-analyzer found.Benjamin Kramer2009-12-251-2/+0
| | | | llvm-svn: 92162
* Fix typo spotted by MSVC.Benjamin Kramer2009-12-251-2/+2
| | | | | | GRExprEngine.cpp(1348) : warning C4305: 'argument' : truncation from 'clang::ProgramPoint::Kind' to 'bool' llvm-svn: 92154
* As Ted suggested, record the callsite information with the StackFrameContext.Zhongxing Xu2009-12-242-17/+21
| | | | llvm-svn: 92121
* Enhance dataflow analyses to recognize branch statements in the CFG used as ↵Ted Kremenek2009-12-241-1/+13
| | | | | | hooks for the initialization of condition variables. llvm-svn: 92119
* Inter-procedural analysis: now we can return from the callee.Zhongxing Xu2009-12-241-0/+37
| | | | llvm-svn: 92116
* Teach GRExprEngine to handle the initialization of the condition variable of ↵Ted Kremenek2009-12-241-0/+6
| | | | | | a ForStmt. llvm-svn: 92114
* Add CFG support for the initializer of the condition variable of a ForStmt.Ted Kremenek2009-12-241-0/+13
| | | | llvm-svn: 92113
* CFG tweak: in a WhileStmt, the condition variable initializer is evaluated ↵Ted Kremenek2009-12-241-14/+13
| | | | | | every time the condition is checked. llvm-svn: 92111
* Teach GRExprEngine to handle the initialization of the condition variable of ↵Ted Kremenek2009-12-241-0/+6
| | | | | | a WhileStmt. llvm-svn: 92106
* Add CFG support for the initializer of the condition variable of a WhileStmt.Ted Kremenek2009-12-241-1/+14
| | | | llvm-svn: 92105
* Teach GRExprEngine to handle the initialization of the condition variable of ↵Ted Kremenek2009-12-241-7/+11
| | | | | | a SwitchStmt. llvm-svn: 92102
* Add CFG support for the initializer of the condition variable of a SwitchStmt.Ted Kremenek2009-12-241-2/+13
| | | | llvm-svn: 92101
* Tidy up FindSubExprAssignments to not deference the child_iterator multiple ↵Ted Kremenek2009-12-231-7/+10
| | | | | | times. llvm-svn: 92087
* move a few more symbols to .rodata/.data.rel.roNuno Lopes2009-12-231-1/+1
| | | | llvm-svn: 92012
* Migrate the call inliner to the Checker interface.Zhongxing Xu2009-12-231-29/+36
| | | | llvm-svn: 91991
* For inter-procedural analysis, predecessor node may be in another function.Zhongxing Xu2009-12-231-3/+3
| | | | | | So we should use the current program point. llvm-svn: 91989
* Add CFG support for the condition variable that can appear in IfStmts in C++ ↵Ted Kremenek2009-12-232-1/+50
| | | | | | | | mode. Add transfer function support in GRExprEngine for IfStmts with initialized condition variables. llvm-svn: 91987
* Suppress dead store warnings involving objects initialized with ↵Ted Kremenek2009-12-231-0/+4
| | | | | | CXXExprTemporaries. llvm-svn: 91986
* Add stack trace pretty printing in GRExprEngine::VisitLValue().Ted Kremenek2009-12-231-0/+4
| | | | llvm-svn: 91985
* Teach GRExprEngine::VisitLValue to ignore CXXExprWithTempories (for now).Ted Kremenek2009-12-231-0/+1
| | | | llvm-svn: 91982
* Fix PR 5857. When casting from a symbolic region to an integer back to a ↵Ted Kremenek2009-12-231-8/+9
| | | | | | pointer value, we were not correctly layering the correct ElementRegion on the original SymbolicRegion. llvm-svn: 91981
* Teach GRExprEngine::VisitLValue that we don't handle CXXZeroInitValueExprs yet.Ted Kremenek2009-12-231-1/+2
| | | | llvm-svn: 91970
* Also treat the type of the subexpression as a pointer in ↵Ted Kremenek2009-12-231-0/+1
| | | | | | GRExprEngine::VisitCast when the expression is handled as an lvalue. llvm-svn: 91969
* Add basic support for analyzing CastExprs as lvalues.Ted Kremenek2009-12-231-3/+27
| | | | llvm-svn: 91952
* Add transfer functions support for visiting an Objective-C message ↵Ted Kremenek2009-12-222-42/+78
| | | | | | expression as an lvalue when the return type is a C++ reference. llvm-svn: 91926
* Add comments.Zhongxing Xu2009-12-211-0/+1
| | | | llvm-svn: 91818
* Use the FunctionDecl's result type to know exactly if it returns a reference.Zhongxing Xu2009-12-191-0/+10
| | | | llvm-svn: 91751
* Enhance GRExprEngine::VisitCallExpr() to be used in an lvalue context. ↵Ted Kremenek2009-12-181-5/+52
| | | | | | Uncovered a new failing test case along the way, but we're making progress on handling C++ references in the analyzer. llvm-svn: 91710
* Tweak formatting and comments.Ted Kremenek2009-12-171-6/+4
| | | | llvm-svn: 91615
* Convert GRExprEngine::VisitCallExpr() to use a worklist instead of recursion ↵Ted Kremenek2009-12-171-45/+64
| | | | | | to evaluate the arguments of a CallExpr. This simplifies the logic and makes it easier to read. (it also avoids any issues with blowing out the stack if the CallExpr had a ridiculous number of arguments) llvm-svn: 91613
* Reduce nesting by using early exits. No functionality change.Ted Kremenek2009-12-171-35/+46
| | | | llvm-svn: 91610
* Sort switch statement. No functionality change.Ted Kremenek2009-12-171-15/+15
| | | | llvm-svn: 91591
* Fix check in GRExprEngine for the 'main' function to handle NULL ↵Ted Kremenek2009-12-171-16/+17
| | | | | | IdentifierInfo*'s. llvm-svn: 91577
* Completely remove ObjCObjectRegion (tests pass this time).Ted Kremenek2009-12-164-20/+9
| | | | llvm-svn: 91572
* Temporarily revert 91553.Ted Kremenek2009-12-161-5/+9
| | | | llvm-svn: 91557
* Remove use of ObjCObjectRegion from BasicStoreManager.Ted Kremenek2009-12-161-9/+5
| | | | llvm-svn: 91553
* Add a new kind of region: CXXObjectRegion. Currently it has only one Zhongxing Xu2009-12-164-15/+54
| | | | | | | | attribute: the object type. Add initial support for visiting CXXThisExpr. Fix a bunch of 80-col violations. llvm-svn: 91535
* Teach RetainSummaryManager::getSummary(FunctionDecl* FD) that ↵Ted Kremenek2009-12-161-1/+5
| | | | | | 'FD->getIdentifier()' will not always return a non-null IdentifierInfo*. llvm-svn: 91512
* Teach OSAtomicChecker that a FunctionDecl's name isn't always a simple ↵Ted Kremenek2009-12-161-3/+7
| | | | | | IdentifierInfo*. llvm-svn: 91511
* Teach NoReturnFunctionChecker that FunctionDecl::getIdentifier() is not ↵Ted Kremenek2009-12-161-3/+2
| | | | | | guaranteed to return a non-null IdentifierInfo*. llvm-svn: 91510
* Add (initial?) static analyzer support for handling C++ references.Ted Kremenek2009-12-166-79/+176
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change was a lot bigger than I originally anticipated; among other things it requires us storing more information in the CFG to record what block-level expressions need to be evaluated as lvalues. The big change is that CFGBlocks no longer contain Stmt*'s by CFGElements. Currently CFGElements just wrap Stmt*, but they also store a bit indicating whether the block-level expression should be evalauted as an lvalue. DeclStmts involving the initialization of a reference require us treating the initialization expression as an lvalue, even though that information isn't recorded in the AST. Conceptually this change isn't that complicated, but it required bubbling up the data through the CFGBuilder, to GRCoreEngine, and eventually to GRExprEngine. The addition of CFGElement is also useful for when we want to handle more control-flow constructs or other data we want to keep in the CFG that isn't represented well with just a block of statements. In GRExprEngine, this patch introduces logic for evaluating the lvalues of references, which currently retrieves the internal "pointer value" that the reference represents. EvalLoad does a two stage load to catch null dereferences involving an invalid reference (although this could possibly be caught earlier during the initialization of a reference). Symbols are currently symbolicated using the reference type, instead of a pointer type, and special handling is required creating ElementRegions that layer on SymbolicRegions (see the changes to RegionStoreManager). Along the way, the DeadStoresChecker also silences warnings involving dead stores to references. This was the original change I introduced (which I wrote test cases for) that I realized caused GRExprEngine to crash. llvm-svn: 91501
OpenPOWER on IntegriCloud