summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/GRState.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Split libAnalysis into two libraries: libAnalysis and libChecker.Ted Kremenek2010-01-251-358/+0
| | | | | | | | | | | | | | | | | | | | | | | | | (1) libAnalysis is a generic analysis library that can be used by Sema. It defines the CFG, basic dataflow analysis primitives, and inexpensive flow-sensitive analyses (e.g. LiveVariables). (2) libChecker contains the guts of the static analyzer, incuding the path-sensitive analysis engine and domain-specific checks. Now any clients that want to use the frontend to build their own tools don't need to link in the entire static analyzer. This change exposes various obvious cleanups that can be made to the layout of files and headers in libChecker. More changes pending. :) This change also exposed a layering violation between AnalysisContext and MemRegion. BlockInvocationContext shouldn't explicitly know about BlockDataRegions. For now I've removed the BlockDataRegion* from BlockInvocationContext (removing context-sensitivity; although this wasn't used yet). We need to have a better way to extend BlockInvocationContext (and any LocationContext) to add context-sensitivty. llvm-svn: 94406
* Enhance ScanReachableSymbols::scan(). Now another OSAtomic test case passes.Zhongxing Xu2010-01-111-0/+3
| | | | | | The old test case has a little mistake. llvm-svn: 93148
* Fix early-return logic in scanReachableSymbols() to match the rest of the ↵Ted Kremenek2009-12-011-6/+6
| | | | | | recursive logic in the methods of ScanReachableSymbols. llvm-svn: 90245
* lib/Analysis: Remove VISIBILITY_HIDDEN from definitions in anonymous namespaceKovarththanan Rajaratnam2009-11-281-1/+1
| | | | llvm-svn: 90028
* Added batch versions of GRState::scanReachableSymbols() so that clients can ↵Ted Kremenek2009-11-261-0/+21
| | | | | | scan a collection of SVals or MemRegions all at once. llvm-svn: 89926
* Remove obsolete 'struct NullDerefTag'.Ted Kremenek2009-11-121-6/+0
| | | | llvm-svn: 86957
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-42/+42
| | | | llvm-svn: 81346
* Rename 'bindExpr' to 'BindExpr'.Ted Kremenek2009-08-271-1/+1
| | | | llvm-svn: 80294
* Move the AnalysisContext* from GRState to Environment.Ted Kremenek2009-08-271-7/+5
| | | | llvm-svn: 80293
* Simplify 'Environment' to contain only one map from 'const Stmt*' to SVals, ↵Ted Kremenek2009-08-271-34/+25
| | | | | | 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
* Remove CodeDecl and CFG from GRExprEngine and GRStateManager.Zhongxing Xu2009-08-251-2/+2
| | | | | | | 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
* To make the analysis independent on the locally stored liveness and cfgZhongxing Xu2009-08-171-5/+5
| | | | | | | of GRStateManager and GRExprEngine, pass the initial location context to the getInitialState() method. llvm-svn: 79228
* Generalize the interface of 'StoreManager::RemoveDeadBindings()' to ↵Ted Kremenek2009-08-021-2/+1
| | | | | | manipulate the entire GRState, not just the Store. llvm-svn: 77870
* Refactor 'PostStmt' and 'PreStmt' to subclass a common parent 'StmtPoint'.Ted Kremenek2009-07-221-2/+2
| | | | | | | | | | | | 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
* Tidy pretty-printing for SVals, using 'dump()' instead of 'printStdErr()', ↵Ted Kremenek2009-07-131-4/+2
| | | | | | and implementing operator<< support for llvm::raw_ostream. llvm-svn: 75560
* Key decisions about 'bool' vs '_Bool' to be based on a new flag in langoptions.Chris Lattner2009-06-301-2/+4
| | | | | | | | | | | | This is simple enough, but then I thought it would be nice to make PrintingPolicy get a LangOptions so that various things can key off "bool" and "C++" independently. This spiraled out of control. There are many fixme's, but I think things are slightly better than they were before. One thing that can be improved: CFG should probably have an ASTContext pointer in it, which would simplify its clients. llvm-svn: 74493
* Remove the last 'GetXXX' methods from GRStateManager.Ted Kremenek2009-06-271-0/+31
| | | | llvm-svn: 74361
* Remove uses of std::ostream from libAnalysis.Ted Kremenek2009-06-241-11/+9
| | | | llvm-svn: 74136
* Remove GRStateManager::GetSValAsScalarOrLoc()/GetSVal().Ted Kremenek2009-06-241-0/+16
| | | | llvm-svn: 74128
* Remove GRStateManager::BindLoc() and GRStateManager::Unbind().Ted Kremenek2009-06-231-6/+6
| | | | llvm-svn: 73996
* API cleanup: move more methods from GRStateManager to GRState.Ted Kremenek2009-06-231-1/+1
| | | | llvm-svn: 73968
* Remove GRStateRef.Ted Kremenek2009-06-181-8/+7
| | | | llvm-svn: 73670
* Remove more dependencies on GRStateRef. As a consequence, we can nowTed Kremenek2009-06-181-17/+10
| | | | | | | pretty-print a GRState object anywhere it is referenced (instead of needing a GRStateRef of a GRStateManager handy). llvm-svn: 73669
* Start moving in the direction of removing GRStateRef. Now eachTed Kremenek2009-06-171-7/+4
| | | | | | | | GRState object has a direct reference to its GRStateManager, making the functionality of GRStateRef redunandant. This will lead to some nice API cleanup and code shrinking across libAnalysis. llvm-svn: 73644
* analyzer: Introduce a new class, ValueManager, that serves as an aggregateTed Kremenek2009-04-091-1/+1
| | | | | | | | | | | "manager of symbolic values", wrapping BasicValueFactory, SymbolManager, and MemRegionManager. While these individual managers nicely separate functionality in the analyzer, constructing symbolic values can sometimes be cumbersome because it requires using multiple managers at once. The goal of this class is to create some factory methods to create SVals that require the use of these different managers, thus (hopefully) simplifying the analyzer API for clients. llvm-svn: 68709
* Simplify more code by using SVal::getAsSymbol() instead ofTed Kremenek2009-03-301-12/+6
| | | | | | loc::SymbolVal/nonloc::SymbolVal probing. llvm-svn: 68049
* Adjust indentation.Zhongxing Xu2009-03-041-1/+1
| | | | llvm-svn: 66022
* Add "GetSValAsScalarOrLoc" methods to GRState/GRStateRef that only perform aTed Kremenek2009-03-041-2/+2
| | | | | | retrieval from the store/environment for locations or scalar types. llvm-svn: 65982
* Don't use std::auto_ptr with getSubRegionMap().Ted Kremenek2009-03-031-1/+1
| | | | llvm-svn: 65957
* Fix extra ';' bug noticed by Mike Stump.Ted Kremenek2009-03-031-1/+1
| | | | llvm-svn: 65954
* Implement FIXME: GRStateManager::scanReachableSymbols now supports scanning ↵Ted Kremenek2009-03-031-11/+67
| | | | | | MemRegions. llvm-svn: 65919
* Added GRStateManager::scanReachableSymbols(), a method which scans the reachableTed Kremenek2009-02-141-1/+30
| | | | | | | | | | | | | symbols from an SVal. - Fixed a bug in EnvironmentManager::RemoveDeadBindings() where it did not mark live all the symbols reachable from a live block-level expression. - Fixed a bug in the retain/release checker where it did not stop tracking symbols that 'escaped' via compound literals being assigned to something the BasicStoreManager didn't reason about. llvm-svn: 64534
* Static Analyzer: Replace LiveSymbols/DeadSymbols sets with a new object ↵Ted Kremenek2009-01-211-10/+7
| | | | | | called "SymbolReaper". Right now it just consolidates the two and cleans up some client code, but shortly it will be used to enable "lazy computation" of live symbols for use with RegionStore. llvm-svn: 62722
* Lazy bingding for region-store manager.Zhongxing Xu2008-12-201-45/+7
| | | | | | | | | | | | | * Now Bind() methods take and return GRState* because binding could also alter GDM. * No variables are initialized except those declared with initial values. * failed C test cases are due to bugs in RemoveDeadBindings(), which removes constraints that is still alive. This will be fixed in later patch. * default value of array and struct regions will be implemented in later patch. llvm-svn: 61274
* Rename SymbolID to SymbolRef. This is a precursor to some overhauling of ↵Ted Kremenek2008-12-051-1/+1
| | | | | | the representation of symbolic values. llvm-svn: 60575
* StoreManager::Retrieve and StoreManager::RemoveDeadBindings now take a ↵Ted Kremenek2008-12-051-7/+7
| | | | | | GRState* argument instead of a Store. This allows them to use the GDM for storing other data. llvm-svn: 60570
* GRStateRef:Ted Kremenek2008-11-121-7/+2
| | | | | | | | | | | | - Rename SetSVal to BindLoc - Add BindDecl - Add BindExpr GRState: - Environment now binds to Stmt* instead of Expr*. This is needed for processing ObjCForCollectionStmt (essentially the declaration of the the 'element' variable can have an SVal attached to it). - BindDecl no longer accepts Expr* for the initialization value; use SVal* instead. llvm-svn: 59152
* Finish the implementation of VisitCompoundLiteralExpr. As VisitInitListExpr is Zhongxing Xu2008-11-071-3/+2
| | | | | | | | | available, things get much simplified. One addition is that CompoundLiteralExpr can appear both in rvalue and lvalue context. llvm-svn: 58837
* Fix 80-col violations.Zhongxing Xu2008-11-031-2/+2
| | | | llvm-svn: 58596
* Rename:Zhongxing Xu2008-10-301-2/+1
| | | | | | | - SetSVal(GRState*, Loc, SVal) => BindLoc - SetSVal(GRState*, Expr*, SVal) => BindExpr llvm-svn: 58421
* Rename: AddDecl => BindDeclZhongxing Xu2008-10-291-5/+4
| | | | | | | | BindDecl better describes what the function does: - Bind the VarDecl to its memory region - Bind the memory region to some initial value. llvm-svn: 58359
* Added preliminary support for CompoundLiterals in the static analyzer:Ted Kremenek2008-10-271-0/+20
| | | | | | | | | | | | | | | | | | | | - 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). llvm-svn: 58277
* Modify Store interface: GetSVal/SetSVal => Retrieve/Bind.Zhongxing Xu2008-10-211-1/+1
| | | | llvm-svn: 57896
* This patch did the following renaming. There should be no functional changes.Zhongxing Xu2008-10-171-10/+10
| | | | | | | | | | RVal => SVal LVal => Loc NonLVal => NonLoc lval => loc nonlval => nonloc llvm-svn: 57671
* This is the first step to build a better evaluation model for GRExprEngine. AZhongxing Xu2008-10-161-7/+7
| | | | | | | | new VisitLValue method is added to replace the old VisitLVal. The semantics model becomes more explicit to separate rvalue evaluation from lvalue evaluation. llvm-svn: 57627
* Remove redundant parameter and rename StMgr to StateMgr.Zhongxing Xu2008-10-051-3/+3
| | | | llvm-svn: 57107
* This is a big patch, but the functionality change is small and the rest of ↵Ted Kremenek2008-10-041-7/+6
| | | | | | | | | | | | | | the patch consists of deltas due to API changes. This patch overhauls the "memory region" abstraction that was prototyped (but never really used) as part of the Store.h. This patch adds MemRegion.h and MemRegion.cpp, which defines the class MemRegion and its subclasses. This classes serve to define an abstract representation of memory, with regions being layered on other regions to to capture the relationships between fields and variables, variables and the address space they are allocated in, and so on. The main motivation of this patch is that key parts of the analyzer assumed that all value bindings were to VarDecls. In the future this won't be the case, and this patch removes lval::DeclVal and replaces it with lval::MemRegionVal. Now all pieces of the analyzer must reason about abstract memory blocks instead of just variables. There should be no functionality change from this patch, but it opens the door for significant improvements to the analyzer such as field-sensitivity and object-sensitivity, both which were on hold until the memory abstraction got generalized. The memory region abstraction also allows type-information to literally be affixed to a memory region. This will allow the some now redundant logic to be removed from the retain/release checker. llvm-svn: 57042
* Implement second part of PR 2600: NSError** parameter may be null, and ↵Ted Kremenek2008-09-181-0/+6
| | | | | | should be checked before being dereferenced. llvm-svn: 56318
* Patch by Csaba Hruska!Ted Kremenek2008-09-131-2/+6
| | | | | | | "Here is a patch what replaces std::ostream with llvm::raw_ostream. This patch covers the AST library, but ignores Analysis lib." llvm-svn: 56185
* Migrate the rest symbolic analysis stuff to BasicConstraintManager.Zhongxing Xu2008-08-291-137/+7
| | | | llvm-svn: 55536
OpenPOWER on IntegriCloud