aboutsummaryrefslogtreecommitdiff
path: root/Analysis/LiveVariables.cpp
AgeCommit message (Collapse)Author
2008-03-15Make a major restructuring of the clang tree: introduce a top-levelChris Lattner
lib dir and move all the libraries into it. This follows the main llvm tree, and allows the libraries to be built in parallel. The top level now enforces that all the libs are built before Driver, but we don't care what order the libs are built in. This speeds up parallel builds, particularly incremental ones. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48402 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13The LiveVariables analysis no longer requires a FunctionDecl&; this allows itTed Kremenek
to be run on other declarations of blocks of code (e.g., Objective-C methods.) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48339 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05Fixed bogus assumption mistakenly introduced in r47955.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47958 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05Minor cleanups (mainly indentation).Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47955 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-25Minor bug fix in LiveVariables: don't "kill" decls referenced by a DeclStmtTed Kremenek
that aren't VarDecls. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47572 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-22Fixed horrid bug in LiveVariables analysis where we were only merging atTed Kremenek
confluence points the liveness information for variables (Decls) and NOT block-level expressions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47506 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-22Bug fix in liveness: Only compute liveness information for VarDecls.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47464 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-07Fixed bug in LiveVariables analysis where Block-level exprs appearingTed Kremenek
as the initializers for DeclStmts were not being registered as being live at the start of the DeclStmt. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46837 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29Modified LiveVariables to perform all of its base initialization in the ctor,Ted Kremenek
and now we require a FunctionDecl* object so that we can also keep track of all of the ParmDecls. Modified clients of LiveVariables to conform to the new interface. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46490 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-18Fixed bug in 'LiveVariables' analysis where we incorrectly marked a variableTed Kremenek
dead at an assignment without taking into account if the variable was used in the RHS of the assignment. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46153 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-17Modified the notion of "Block-level expressions" in CFGs to include Stmt*. ThisTed Kremenek
is because GNU-style Statement-expressions cause the last statement in the statement-expression to act like an expression. We now have two notions: block-level statements and block-level expressions. The former are all Stmt* that appear in the list of statements in CFGBlocks. The latter is the subset of the former; these block-level statements are used as subexpressions somewhere in the AST. CFG::isBlockExpr() returns true for the latter, not the former (previously isBlockExpr() always returned true for non-Expr Stmt*). Modified the LiveVariables analysis to also track liveness state for block-level expressions (using the updated definition of block-level expressions). Modified the dataflow solver so that when it records values for block-level statements, it records the dataflow value *before* the transfer function for a Stmt* is evaluated (not after). This is more in sync in what clients will want. Modified CFGStmtVisitor to record the current block-level statement. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46143 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-17Added support to dataflow solver to (when requested) also record dataflowTed Kremenek
values for the block-level expressions. Modified 'LiveVariables' to provide the option to clients to record liveness information for block-level expressions (using the above feature). Modified 'DeadStores' to conform to the new interface of 'LiveVariables'. Modified 'GRConstants' to compute liveness information for block-level expressions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46137 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-17Removed FindDeclRef, and used Expr::IgnoreParens instead (code refactoring).Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46133 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-11Renamed ProgramEdge to ProgramPoint and changed subclasses of ProgramEdgeTed Kremenek
to have a much simpler, cleaner interpretation of what is a "location" in a function (as encoded by a CFG). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45846 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-08Added VISIBILITY_HIDDEN to classes/structs in anonymous namespaces.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45750 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29Don't attribute in file headers anymore. See llvmdev for theChris Lattner
discussion of this change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45410 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-21Directory restructing of Analysis files.Ted Kremenek
Created include/clang/Analysis/Analyses directory. - Moved LiveVariables.h and UninitializedValues.h into this dir. Moved ExprDeclBitVector.h into Analysis/Support. Updated all clients who use these headers to reflect the new paths. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45292 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-13Fixed bug in live-variable analysis and uninitialized-values analysis whereTed Kremenek
we incorrectly examine the expression within a sizeof() for use in computing dataflow values. This fixes: PR 1858 (http://llvm.org/bugs/show_bug.cgi?id=1858) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44982 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-20Updated CFGStmtVisitor and CFGRecStmtVisitor to have a notion ofTed Kremenek
"block-expressions" when visiting arbitrary expressions (via calls to "Visit()"). This results in a refactoring where a dataflow analysis no longer needs to always special case when handling block-expressions versus non-block expressions. Updated LiveVariables and UninitializedValues to conform to the slightly altered interface of these visitor classes. Thanks to Nuno Lopes for providing a test case that illustrated some fundamental problems in the current design of the CFGXXXStmtVisitor classes and how they were used. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44246 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-19Fixed bug where LiveVariables was not properly propagating updates to livenessTed Kremenek
state that occurred in subexpressions of Block-Level expressions. Bug and fix provided by Nuno Lopes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44224 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-07move IdentifierTable.h from liblex to libbasic.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42730 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-01Migrated LiveVariables and UninitializedVariables to now use theTed Kremenek
tracked BlkExpr information now maintained by the CFG class. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42498 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-28Fixed bug where assignments to variables wrapped in parentheses would notTed Kremenek
properly kill variables. e.g: (x) = 1; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42450 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-28Significant cleanups and bug-fixes to LiveVariables. Uses new refactoredTed Kremenek
ExprDeclBitVector class for defining dataflow state. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42446 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-25Moved "DataflowSolver.h" to the "include/" subtree. Adjusted clientTed Kremenek
code that uses the solver to reflect the new location. Created "FlowSensitive" subdirectory in include/clang/Analysis to hold header files relating to flow-sensitive analyses. Moved "DataflowValues.h" into this subdirectory. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42320 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-25Further refactored DataflowSolver. Now most code for the solver is sharedTed Kremenek
between forward and backward analyses, with trait classes being used to implement the key differences in operations/functionality. Converted the LiveVariables analysis to use the generic DataflowSolver. This, along with removing some extra functionality that was not needed, reduced the code for LiveVariables by over half. Modified Driver code to handle the updated interface to LiveVariables. Modified the DeadStores checker to handle the update interface to LiveVariables. Updated DataflowValues (generic ADT to store dataflow values) to also store values for blocks. This is used by DeadStores. Updated some comments. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42293 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-20Updated header file inlcude to new location ofTed Kremenek
Analysis/Visitors/*Visitors.h files. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42175 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-13Move Decl::NextDeclarator (w/ setters/getters) down to ScopedDecl/FieldDecl.Steve Naroff
Decl is now svelte:-) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41935 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-12Minor space tightening.Ted Kremenek
Removed extraneous call to Observer->ObserveStmt when handling DeclRefExprs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41890 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-12Fixed recursion bug: should call Visit on child instead of VisitStmt.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41888 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-12Migrated LiveVariables to use the new DataflowStmtVisitor interface. The codeTed Kremenek
is much simpler now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41885 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-11get rid of ugly "warning: no newline at end of file"Gabor Greif
warnings that some compilers diagnose git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41847 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-10Fixed LiveVariables to no longer track the liveness of function pointersTed Kremenek
that refer to direct function calls. Modified interface of LiveVariables to only track liveness of VarDecls. This cleans up a bunch of edge cases, and removed the bug just mentioned. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41797 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-10Renaming of the LiveVariablesAuditor interface. Changed "Auditor" andTed Kremenek
"Audit" to "Observer" and "Observe" git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41794 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-06Added more checking in "dead stores" for values that are initializedTed Kremenek
but never used. Fix a bug in LiveVariables where uses on the LHS of self-assign operators (e.g +=, *=, etc) would not be properly recorded in the liveness state of the variable. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41757 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-06Minor bug fixes to corner cases where LiveVariables would crash on some CFGsTed Kremenek
that contained no declarations, or when a variable is declared but never used. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41756 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-06Added "Dead Stores", a flow-sensitive checker that checks for storesTed Kremenek
to variables that are no longer live. This analysis is built on top of CFGs and the LiveVariables analysis. changes to driver: added driver option "-check-dead-stores" to run the analysis git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41754 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-06LiveVariables:Ted Kremenek
- Finished 99% of analysis logic. Probably a few bugs. - Added querying functions to query liveness. - Added better pretty printing of liveness. - Added better bookkeeping of per-variable liveness information. - Added LiveVariablesAuditor interface, which allows "lazy" querying of intra-basic block liveness information. Driver: - Minor cleanups involved in dumping liveness information. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41753 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-06Added an early implementation of Live-Variables analysis built onTed Kremenek
source-level CFGs. This code may change significantly in the near future as we explore different means to implement dataflow analyses. Added a driver option, -dump-live-variables, to view the output of live variable analysis. This output is very ALPHA; it will be improved shortly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41737 91177308-0d34-0410-b5e6-96231b3b80d8