summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/GRExprEngine.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Fix: <rdar://problem/7275774> Static analyzer warns about NULL pointer whenTed Kremenek2009-10-061-1/+1
| | | | | | | | | | | | | | | | | adding assert This fix required a few changes: SimpleSValuator: - Eagerly replace a symbolic value with its constant value in EvalBinOpNN when it is constrained to a constant. This allows us to better constant fold values along a path. - Handle trivial case of '<', '>' comparison of pointers when the two pointers are exactly the same. RegionStoreManager: llvm-svn: 83358
* Fix:Ted Kremenek2009-09-271-4/+5
| | | | | | | | | | | | | | | | <rdar://problem/6914474> checker doesn't realize that variable might have been assigned if a pointer to that variable was passed to another function via a structure The problem here was the RegionStoreManager::InvalidateRegion didn't invalidate the bindings of invalidated regions. This required a rewrite of this method using a worklist. As part of this fix, changed ValueManager::getConjuredSymbolVal() to require a 'void*' SymbolTag argument. This tag is used to differentiate two different symbols created at the same location. llvm-svn: 82920
* Fix PR 4988 by removing an invalid assertion (a function can be referenced inTed Kremenek2009-09-231-1/+1
| | | | | | GRExprEngine::VisitDeclRefExpr without 'asLValue' being true). llvm-svn: 82598
* Fix: <rdar://problem/7242006> [RegionStore] compound literal assignment with ↵Ted Kremenek2009-09-221-0/+1
| | | | | | floats not honored llvm-svn: 82575
* Change all the Type::getAsFoo() methods to specializations of Type::getAs().John McCall2009-09-211-1/+1
| | | | | | | | | | | Several of the existing methods were identical to their respective specializations, and so have been removed entirely. Several more 'leaf' optimizations were introduced. The getAsFoo() methods which imposed extra conditions, like getAsObjCInterfacePointerType(), have been left in place. llvm-svn: 82501
* Remove ImplicitBadDivides/ExplicitBadDivides node sets. This checking is ↵Ted Kremenek2009-09-161-6/+0
| | | | | | now down by a 'Checker' and not build into GRExprEngine. llvm-svn: 82017
* Per feedback from Eli, recognize in the transfer function logic forTed Kremenek2009-09-151-6/+12
| | | | | | | | | __builtin_offsetof in the static analyzer that __builtin_offsetof is not guaranteed to return an integer constant. We will need to shore this up later, but now at least we have correct support for when this *is* an integer constant. llvm-svn: 81830
* Add static analyzer transfer function support for __builtin_offsetof.Ted Kremenek2009-09-151-3/+8
| | | | llvm-svn: 81820
* Remove unnecessary ASTContext parameter from FunctionDecl::isBuiltinIDDouglas Gregor2009-09-121-1/+1
| | | | llvm-svn: 81590
* Introduce "DefinedOrUnknownSVal" into the SVal class hierarchy, providing a wayTed Kremenek2009-09-111-130/+107
| | | | | | | | | | | | to statically type various methods in SValuator/GRState as required either a defined value or a defined-but-possibly-unknown value. This leads to various logic cleanups in GRExprEngine, and lets the compiler enforce via type checking our assumptions about what symbolic values are possibly undefined and what are not. Along the way, clean up some of the static analyzer diagnostics regarding the uses of uninitialized values. llvm-svn: 81579
* Make AnalysisManager stateless. Now other analyzer components only depends onZhongxing Xu2009-09-101-12/+14
| | | | | | local node information. llvm-svn: 81433
* Implement: <rdar://problem/7185647> [RegionStore] 'self' cannot be NULL ↵Ted Kremenek2009-09-091-4/+22
| | | | | | | | | | | upon entry to a method Here we implement this as a precondition within GRExprEngine, even though it is related to how BasicStoreManager and RegionStoreManager model 'self' differently. Putting this as a high-level precondition is more general, which is why it isn't in RegionStore.cpp. llvm-svn: 81378
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-624/+623
| | | | llvm-svn: 81346
* pass the correct predecessor node.Zhongxing Xu2009-09-051-1/+1
| | | | llvm-svn: 81066
* Refactor builtin function evaluation code into its own function.Zhongxing Xu2009-09-051-33/+44
| | | | llvm-svn: 81061
* move the check into MarkNoReturnFunction.Zhongxing Xu2009-09-041-2/+5
| | | | llvm-svn: 80980
* Extract mark-no-return-function code into a function.Zhongxing Xu2009-09-041-80/+84
| | | | llvm-svn: 80979
* Fix 80 column violations.Ted Kremenek2009-09-031-5/+8
| | | | llvm-svn: 80873
* Refactor the check for bad divide into a checker.Zhongxing Xu2009-09-021-64/+7
| | | | | | | | | Also fix a checker context bug: the Dst set is not always empty initially. Because in GRExprEngine::CheckerVisit(), *CurrSet is used repeatedly. So we removed the Dst.empty() condition in ~CheckerContext() when deciding whether to do autotransision. llvm-svn: 80786
* Refactor bad callee check into a Checker.Zhongxing Xu2009-09-021-14/+1
| | | | | | Now bad callee is checked as a PreVisit to the CallExpr. llvm-svn: 80771
* Eliminate CXXAdornedMemberExpr entirely. Instead, optionally allocateDouglas Gregor2009-08-311-2/+0
| | | | | | | | space within the MemberExpr for the nested-name-specifier and its source range. We'll do the same thing with explicitly-specified template arguments, assuming I don't flip-flop again. llvm-svn: 80642
* Rename CXXQualifiedMemberExpr -> CXXAdornedMemberExpr, since we willDouglas Gregor2009-08-311-2/+2
| | | | | | | also be adding explicit template arguments as an additional "adornment". No functionality change. llvm-svn: 80628
* Refactor undefined argument checking into a Checker.Zhongxing Xu2009-08-291-24/+1
| | | | llvm-svn: 80417
* Rename 'bindExpr' to 'BindExpr'.Ted Kremenek2009-08-271-52/+52
| | | | llvm-svn: 80294
* Remove a unused member variable. Instead query the option from AnalysisManager.Zhongxing Xu2009-08-271-3/+3
| | | | llvm-svn: 80226
* Simplify 'Environment' to contain only one map from 'const Stmt*' to SVals, ↵Ted Kremenek2009-08-271-75/+61
| | | | | | greatly simplifying the logic of the analyzer in many places. We now only distinguish between block-level expressions and subexpressions in Environment::RemoveDeadBindings and GRState pretty-printing. llvm-svn: 80194
* When a member reference expression includes a qualifier on the memberDouglas Gregor2009-08-261-0/+2
| | | | | | | | | | | | | | | | | name, e.g., x->Base::f() retain the qualifier (and its source range information) in a new subclass of MemberExpr called CXXQualifiedMemberExpr. Provide construction, transformation, profiling, printing, etc., for this new expression type. When a virtual function is called via a qualified name, don't emit a virtual call. Instead, call that function directly. Mike, could you add a CodeGen test for this, too? llvm-svn: 80167
* Move logic of GRExprEngine::EvalBinOp to SValuator::EvalBinOp.Ted Kremenek2009-08-251-37/+5
| | | | llvm-svn: 80018
* Remove CodeDecl and CFG from GRExprEngine and GRStateManager.Zhongxing Xu2009-08-251-63/+70
| | | | | | | Now AnalysisManager is the only place we can get CodeDecl. This leads to an API change: GRState::bindExpr() now takes the CFG argument. llvm-svn: 79980
* Remove Decl and CFG from ExplodedGraph. This leads to a series small changes.Zhongxing Xu2009-08-251-5/+5
| | | | llvm-svn: 79973
* Replace cerr with errs().Benjamin Kramer2009-08-231-3/+2
| | | | llvm-svn: 79854
* Remove 'AnalysisContext::setDecl()', as we the Decl associated with anTed Kremenek2009-08-211-2/+2
| | | | | | | AnalysisContext should never change. Along the way, propagate some constness around. llvm-svn: 79701
* Add LocationContext* field to VarRegion. This is needed for interprocedural ↵Ted Kremenek2009-08-211-9/+12
| | | | | | analysis. llvm-svn: 79680
* Get the code decl from the initial location context.Zhongxing Xu2009-08-211-1/+1
| | | | llvm-svn: 79591
* Using "ObjCImplicitSetterGetterRefExpr" instead of ↵Fariborz Jahanian2009-08-201-3/+3
| | | | | | | | "ObjCImplctSetterGetterRefExpr". A field rename and more comments. llvm-svn: 79537
* Renamed ObjCKVCRefExpr to ObjCImplctSetterGetterRefExpr.Fariborz Jahanian2009-08-181-3/+3
| | | | | | | | Removed an unnecessary loop to get to setters incoming argument. Added DoxyGen comments. Still more work to do in this area (WIP). llvm-svn: 79365
* To make the analysis independent on the locally stored liveness and cfgZhongxing Xu2009-08-171-2/+2
| | | | | | | of GRStateManager and GRExprEngine, pass the initial location context to the getInitialState() method. llvm-svn: 79228
* Extend the ProgramPoint to include the context information LocationContext,Zhongxing Xu2009-08-151-5/+8
| | | | | | | which is either a stack frame context of the function or a local scope context. llvm-svn: 79072
* Last step of template cleanup: merge *BuilderImpl to *Builder.Zhongxing Xu2009-08-061-177/+177
| | | | | | Some Builders need further cleanup. llvm-svn: 78301
* As GRState seems general enough, it is time to merge some template classes Zhongxing Xu2009-08-061-10/+10
| | | | | | | and their impl base classes. This can greatly simply some code of the core analysis engine. This patch merges ExplodedNodeImpl into ExplodedNode. llvm-svn: 78270
* If the UnaryOperator has non-location type, use its type to create theZhongxing Xu2009-08-051-2/+11
| | | | | | | | | constant value. If the UnaryOperator has location type, create the constant with int type and pointer width. This fixes the bug that all pointer increments 'p++' evaluated to Unknown. llvm-svn: 78147
* Temporarily disable out-of-bounds checking. The current checking logic will ↵Ted Kremenek2009-08-011-1/+6
| | | | | | not work quite right with the changes I'm about to commit. llvm-svn: 77779
* Change uses of:Ted Kremenek2009-07-291-2/+2
| | | | | | | | | | | | | | | | | | | | Type::getAsReferenceType() -> Type::getAs<ReferenceType>() Type::getAsRecordType() -> Type::getAs<RecordType>() Type::getAsPointerType() -> Type::getAs<PointerType>() Type::getAsBlockPointerType() -> Type::getAs<BlockPointerType>() Type::getAsLValueReferenceType() -> Type::getAs<LValueReferenceType>() Type::getAsRValueReferenceType() -> Type::getAs<RValueReferenceType>() Type::getAsMemberPointerType() -> Type::getAs<MemberPointerType>() Type::getAsReferenceType() -> Type::getAs<ReferenceType>() Type::getAsTagType() -> Type::getAs<TagType>() And remove Type::getAsReferenceType(), etc. This change is similar to one I made a couple weeks ago, but that was partly reverted pending some additional design discussion. With Doug's pending smart pointer changes for Types, it seemed natural to take this approach. llvm-svn: 77510
* Fix PR 4631. The compound initializers of unions were not being evaluated, whichTed Kremenek2009-07-281-8/+2
| | | | | | | | | could cause false positives if any the subexpressions had side-effects. These initializers weren't evaluated because the StoreManager would need to handle them, but that's an orthogonal problem of whether or not the StoreManager can handle the binding. llvm-svn: 77361
* Revert r76831, there are many Analyzer test failures on multiple platforms.Daniel Dunbar2009-07-231-16/+3
| | | | | | | | --- Reverse-merging r76831 into '.': U include/clang/Analysis/PathSensitive/GRExprEngine.h U lib/Analysis/GRExprEngine.cpp llvm-svn: 76851
* Add 'previsit' Checker pass for ObjCMessageExprs.Ted Kremenek2009-07-231-3/+16
| | | | llvm-svn: 76831
* Refactor 'PostStmt' and 'PreStmt' to subclass a common parent 'StmtPoint'.Ted Kremenek2009-07-221-5/+6
| | | | | | | | | | | | Educate GRExprEngine::VisitGraph() about 'PreStmt'. Mark the constructor of 'PostStmt' to be explicit, preventing implicit conversions and the selection of the wrong 'generateNode' method in GRStmtNodeBuilder. Constify a bunch of arguments, which falls out of the changes to ProgramPoint. llvm-svn: 76809
* Add support for registering 'Checker' objects with GRExprEngine.Ted Kremenek2009-07-221-5/+48
| | | | | | Add a 'previsit' stage (that dispatches to registered Checkers) when evaluating the effects of CallExprs. llvm-svn: 76794
OpenPOWER on IntegriCloud