summaryrefslogtreecommitdiff
path: root/lib/Analysis/GRExprEngine.cpp
Commit message (Collapse)AuthorAge
...
* Comment out invalid assertion. I'm leaving it in the code for now as a ↵Ted Kremenek2008-10-31
| | | | | | reminder to produce a test case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58510 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix 80-col violations.Zhongxing Xu2008-10-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58495 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a tentative assertion.Zhongxing Xu2008-10-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58492 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a comment.Zhongxing Xu2008-10-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58487 91177308-0d34-0410-b5e6-96231b3b80d8
* Handle the case in VisitInitListExprs where there are no initializers in the ↵Ted Kremenek2008-10-30
| | | | | | compound literal. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58468 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the correct predecessor node.Ted Kremenek2008-10-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58446 91177308-0d34-0410-b5e6-96231b3b80d8
* Add missing return statement.Ted Kremenek2008-10-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58444 91177308-0d34-0410-b5e6-96231b3b80d8
* Use a worklist in GRExprEngine::VisitInitListExpr to process subexpressions.Ted Kremenek2008-10-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58440 91177308-0d34-0410-b5e6-96231b3b80d8
* Merge the array and struct case. They are essentially the same.Zhongxing Xu2008-10-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58422 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename:Zhongxing Xu2008-10-30
| | | | | | | | - 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
* Implement VisitInitListExpr(). InitListExpr will have a nonloc::CompoundVal ↵Zhongxing Xu2008-10-30
| | | | | | value. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58419 91177308-0d34-0410-b5e6-96231b3b80d8
* Mark yy_fatal_error as a panic function.Ted Kremenek2008-10-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58410 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename: AddDecl => BindDeclZhongxing Xu2008-10-29
| | | | | | | | | BindDecl better describes what the function does: - Bind the VarDecl to its memory region - Bind the memory region to some initial value. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58359 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename ExplicitCCastExpr to CStyleCastExprDouglas Gregor2008-10-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58331 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve our handling of (C++) references within Clang. Specifically:Douglas Gregor2008-10-28
| | | | | | | | | | | | | - 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
* Remove type-punning warning in GRExprEngine. No functionality change.Ted Kremenek2008-10-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58292 91177308-0d34-0410-b5e6-96231b3b80d8
* Added preliminary support for CompoundLiterals in the static analyzer:Ted Kremenek2008-10-27
| | | | | | | | | | | | | | | | | | | | | | - 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
* Refactor the expression class hierarchy for casts. Most importantly:Douglas Gregor2008-10-27
| | | | | | | | | | | | | | | | | | | | | | | | - CastExpr is the root of all casts - ImplicitCastExpr is (still) used for all explicit casts - ExplicitCastExpr is now the root of all *explicit* casts - ExplicitCCastExpr (new name needed!?) is a C-style cast in C or C++ - CXXFunctionalCastExpr inherits from ExplicitCastExpr - CXXNamedCastExpr inherits from ExplicitCastExpr and is the root of all of the C++ named cast expression types (static_cast, dynamic_cast, etc.) - Added classes CXXStaticCastExpr, CXXDynamicCastExpr, CXXReinterpretCastExpr, and CXXConstCastExpr to Also, fixed returned-stack-addr.cpp, which broke once when we fixed reinterpret_cast to diagnose double->int* conversions and again when we eliminated implicit conversions to reference types. The fix is in both testcase and SemaChecking.cpp. Most of this patch is simply support for the renaming. There's very little actual change in semantics. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58264 91177308-0d34-0410-b5e6-96231b3b80d8
* Do not crash when performing VisitLValue on union types.Ted Kremenek2008-10-25
| | | | | | | This fixes PR 2948. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58148 91177308-0d34-0410-b5e6-96231b3b80d8
* Add code for get the lvalue for string literals. Now we return a StringRegionZhongxing Xu2008-10-25
| | | | | | | | for StringLiteral lvalue evaluation, instead of directly returning a loc::StringLiteralVal by the Environment. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58138 91177308-0d34-0410-b5e6-96231b3b80d8
* Now we can handle arrays.Zhongxing Xu2008-10-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58135 91177308-0d34-0410-b5e6-96231b3b80d8
* Implicit conversions from arrays can also be conversions to references (will ↵Ted Kremenek2008-10-24
| | | | | | add a test case shortly). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58110 91177308-0d34-0410-b5e6-96231b3b80d8
* Added method "getSelfRegion" to Store. This method returns the region ↵Ted Kremenek2008-10-24
| | | | | | associated with the "this" or "self" object (C++ and Objective-C respectively). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58107 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix 80-col violation.Zhongxing Xu2008-10-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58070 91177308-0d34-0410-b5e6-96231b3b80d8
* Make the analyzer store (memory model) a command line option.Ted Kremenek2008-10-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58056 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an assertion to make our intention more clear.Zhongxing Xu2008-10-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58030 91177308-0d34-0410-b5e6-96231b3b80d8
* Let StoreManager do different cast on arrays. BasicStore will just keep it ↵Zhongxing Xu2008-10-23
| | | | | | intact. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58028 91177308-0d34-0410-b5e6-96231b3b80d8
* Adjust parameter order to more natural one.Zhongxing Xu2008-10-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57964 91177308-0d34-0410-b5e6-96231b3b80d8
* Exprs of function type is another special case for ImplicitCast.Zhongxing Xu2008-10-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57963 91177308-0d34-0410-b5e6-96231b3b80d8
* When conjuring symbols for compound assignments, use the promoted type to ↵Ted Kremenek2008-10-21
| | | | | | determine if the symbolic value as a "loc::" or "nonloc::" value. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57917 91177308-0d34-0410-b5e6-96231b3b80d8
* Preliminary support for function overloadingDouglas Gregor2008-10-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57909 91177308-0d34-0410-b5e6-96231b3b80d8
* Localize the special processing of array variable inside Zhongxing Xu2008-10-21
| | | | | | | | | | | | GRExprEngine::VisitCast() so that other parts of the analyzer can be ignorant. When we cast "array of type T" to "pointer to T", we get the loc::MemRegionVal corresponding to the array variable. This is sufficient for BasicStore, but not for RegionStore. RegionStore should get the element region for the first array element in the cast. So next comes to the revamping of transfer functions for different store model. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57897 91177308-0d34-0410-b5e6-96231b3b80d8
* Further improve path-sensitivity with divide-by-zero checking by assuming ↵Ted Kremenek2008-10-20
| | | | | | that a denominator cannot be zero even when the result of an '/' or '%' expression is unknown. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57855 91177308-0d34-0410-b5e6-96231b3b80d8
* Used conjured symbols to recover path-sensitivity when the result of a ↵Ted Kremenek2008-10-20
| | | | | | compound assignment is UnknownVal(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57851 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support in GRExprEngine for UnaryOperator::AlignOf. This fixes one ↵Ted Kremenek2008-10-18
| | | | | | crash report in PR 2796. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57777 91177308-0d34-0410-b5e6-96231b3b80d8
* Generalize VisitLValue: not only can CallExprs and ObjCMessageExprs return ↵Ted Kremenek2008-10-18
| | | | | | aggregate temporaries, so can many other expressions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57761 91177308-0d34-0410-b5e6-96231b3b80d8
* Function calls and ObjC message expressions can be used in a lvalue context ↵Ted Kremenek2008-10-18
| | | | | | if they return a structure. E.g foo().x == 1. We don't really support, however, such temporaries yet in the environment or the store. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57760 91177308-0d34-0410-b5e6-96231b3b80d8
* Use "VisitLValue" when processing the base for "x.f" field accesses, and ↵Ted Kremenek2008-10-18
| | | | | | "Visit" when processing the base for "x->f" field accesses. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57754 91177308-0d34-0410-b5e6-96231b3b80d8
* When conjuring symbols to recover path-sensitivity, don't conjure symbols ↵Ted Kremenek2008-10-17
| | | | | | that represent an entire struct. We need to implement struct temporaries as an actual "region", and then bind symbols to the FieldRegion of those temporaries. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57739 91177308-0d34-0410-b5e6-96231b3b80d8
* "Implement" GRExprEngine::VisitLValue for ObjCPropertyRefExpr. This is only ↵Ted Kremenek2008-10-17
| | | | | | a bandid; we need to properly handle properties by using locv/nonloc objects and specially handling property assignments in the transfer function for BinaryOperator. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57693 91177308-0d34-0410-b5e6-96231b3b80d8
* This patch did the following renaming. There should be no functional changes.Zhongxing Xu2008-10-17
| | | | | | | | | | | 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
* Get array's lvalue through standard interface.Zhongxing Xu2008-10-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57666 91177308-0d34-0410-b5e6-96231b3b80d8
* Return the corresponding MemRegionVal for both rvalue and lvalue of array ofZhongxing Xu2008-10-17
| | | | | | | type T. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57665 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove an untrue assertion: lval::FuncVals can be returned in both rvalue ↵Ted Kremenek2008-10-17
| | | | | | and lvalue contexts. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57659 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove lval::FieldOffset, lval::ArrayOffset. These will be replaced with ↵Ted Kremenek2008-10-17
| | | | | | | | | | | | | 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
* Add transfer function support for ObjCIvarRefExpr.Ted Kremenek2008-10-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57654 91177308-0d34-0410-b5e6-96231b3b80d8
* This is the first step to build a better evaluation model for GRExprEngine. AZhongxing Xu2008-10-16
| | | | | | | | | 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
* Check some cases for previous patch. Make the code more robust.Zhongxing Xu2008-10-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57317 91177308-0d34-0410-b5e6-96231b3b80d8
* Added a function call case that generates sink nodes.Zhongxing Xu2008-10-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57240 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't use DeclStmt::getDecl(); this will eventually disappear. Just fetch ↵Ted Kremenek2008-10-06
| | | | | | the first decl using the DeclStmt::decl_iterator. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57194 91177308-0d34-0410-b5e6-96231b3b80d8