Commit Graph

62 Commits

Author SHA1 Message Date
Ted Kremenek effdafa62a Implemented casts for ConcreteInt and ConcreteIntLValue.
Implemented '==' and '!=' for ConcreteIntLValue.

llvm-svn: 46630
2008-02-01 06:36:40 +00:00
Ted Kremenek 2838799859 Moved RValue code in GRConstants.cpp to RValue.[h,cpp].
Moved ValueKey/ValueMap declaration to ValueState.h.

llvm-svn: 46618
2008-01-31 19:34:24 +00:00
Ted Kremenek 6f4a9ef4b6 Fixed misspelling of "LLVM" due to some editor+Ted madness.
llvm-svn: 46604
2008-01-31 06:49:09 +00:00
Ted Kremenek a0be8264b5 Added transfer function support for unary '&' and '*', providing basic
(local) aliasing support.

Modified ExplodedGraph pretty-printer (for GRConstants) to also print out the
pointer value of the state associated with a node.  This way one can easily
see that two states are identical.

llvm-svn: 46595
2008-01-31 02:35:41 +00:00
Ted Kremenek b5474fc529 Added 'SymbolicLValue' class to represent LValues whose value is symbolic.
Improved pretty-printing of LValues.
Parameters whose values are pointers/references are now assigned SymbolicLValues.

llvm-svn: 46584
2008-01-31 00:09:56 +00:00
Ted Kremenek 2531fce319 We now delay adding nodes created by GRBranchNodeBuilder to the analysis
worklist until the dstor of GRBranchNodeBuilderImpl. This way clients can mark
creates nodes as "sinks" before they are added to the worklist.

llvm-svn: 46582
2008-01-30 23:24:39 +00:00
Ted Kremenek a50d98565f Implemented some branch pruning in GRConstants using != and == for
constant integers.

llvm-svn: 46581
2008-01-30 23:03:39 +00:00
Ted Kremenek 90962af0e8 Minor cosmetic cleanups: replaced some integer literals with constants and
more cleanups with pretty-printing of analysis results.

llvm-svn: 46564
2008-01-30 18:54:06 +00:00
Ted Kremenek 7ff1893f86 Implemented more boilerplate in GREngine for processing branches. Now
we automatically generate a new successor node along an edge if the checker
did not explicitly do so (i.e., we just propagate the current state).

llvm-svn: 46536
2008-01-29 23:32:35 +00:00
Ted Kremenek 9b4211d25d Added boilerplate logic in GREngine for processing branches.
llvm-svn: 46532
2008-01-29 22:56:11 +00:00
Ted Kremenek b2cad31aae Renamed GRNodeBuilder to GRStmtNodeBuilder.
llvm-svn: 46531
2008-01-29 22:11:49 +00:00
Ted Kremenek 71b49503d8 Minor fix in transfer function of '!=' where a 'false' literal should
have been 'true'.

llvm-svn: 46530
2008-01-29 21:27:49 +00:00
Ted Kremenek 8d5bfe5844 Added preliminary transfer function support for '==' and '!='.
Made some internal API cleanups with creating ConcreteInt values, which lead to
some code reduction in implementing "++", "--".

llvm-svn: 46528
2008-01-29 19:43:15 +00:00
Ted Kremenek b6056cfea4 Added "SymbolManager", which manages the set of symbolic values used
for analyzing a function.

The initial state for GRConstants now assigns symbolic values to parameters.

llvm-svn: 46517
2008-01-29 17:27:31 +00:00
Ted Kremenek 75bc4cd620 Fixed bug where not all dead subexpressions were being pruned from the analysis
state.

llvm-svn: 46491
2008-01-29 05:25:31 +00:00
Ted Kremenek 8ff7705a6c Modified LiveVariables to perform all of its base initialization in the ctor,
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.

llvm-svn: 46490
2008-01-29 05:13:23 +00:00
Ted Kremenek e3d965f4b1 Added skeleton code for tracking the values of function parameters.
llvm-svn: 46477
2008-01-29 00:43:03 +00:00
Ted Kremenek 997d872375 Driver now passes the top-level FunctionDecl* to GRConstants.
Refactoring: for GREngine and GRConstants, pushed references to CFG, ASTContext,
and the top-level FunctionDecl into ExplodedGraphImpl.

llvm-svn: 46475
2008-01-29 00:33:40 +00:00
Ted Kremenek 64d9524dcb Added RValue class "UninitializedValue".
llvm-svn: 46471
2008-01-28 22:51:57 +00:00
Ted Kremenek fe9cf4f38b Added transfer function logic for "%=" operator.
llvm-svn: 46470
2008-01-28 22:28:54 +00:00
Ted Kremenek 7e67036f2f Added transfer function hookups for "modulo" operator.
llvm-svn: 46468
2008-01-28 22:26:15 +00:00
Ted Kremenek 5b8cd80897 Minor tweaking with hierarchy of NonLValue objects: SymbolValue is
now SymbolicNonLValue.

Cleaned up some casts.

llvm-svn: 46467
2008-01-28 22:25:21 +00:00
Ted Kremenek 17a739681c Some additional cleanups with method names.
Renamed ExprValue to RValue, as all expression values are RValues, and this
keeps with the C terminology (renamed old "RValue" class to "NonLValue").

Introduced "ConcreteInt", a class that represents a concrete, integer
constant as an RValue.

Temporarily removed classes to represent set of possible constants and set of !=
constants. Will replace with a more general class representing a set of
constraints.

Added some foundational code to track "symbolic" values, which are used to
accrue constraints on an abstract value that is shared between multiple
variables.  e.g:

   x = y;      // at this point "x" and "y" share the same "value"
   if (x > 1) 
     ...       // at this point, the value shared by "x" and "y" is "> 1".

llvm-svn: 46466
2008-01-28 22:09:13 +00:00
Ted Kremenek 5588c9e9ce Implemented transfer function for '/='.
llvm-svn: 46379
2008-01-25 23:45:34 +00:00
Ted Kremenek 2b8a7c80b8 Further refactoring of transfer functions by having APSIntSetOp take
a template-template parameter.

llvm-svn: 46378
2008-01-25 23:43:12 +00:00
Ted Kremenek ec5a444de6 Renamed RValueDisjunctiveEqual to RValEqualityORSet.
Renamed RValueConjunctiveUnequal to RValInequalityANDSet.

Refactored add/subtract/multiple (and now divide) operations for
RValEqualityORSet to be based on a single template function.

llvm-svn: 46374
2008-01-25 22:55:56 +00:00
Ted Kremenek 109e362fbd Fixed 80 col. violation.
llvm-svn: 46370
2008-01-25 22:07:26 +00:00
Ted Kremenek 555855c779 Renamed RValueMayEqualSet to RValueDisjunctiveEqual.
llvm-svn: 46368
2008-01-25 22:06:07 +00:00
Ted Kremenek 8a025806a4 Some minor restructuring around LValue and RValue types. The value "kind"
information is not separated into a "base" and "sub" type. Eventually the
value-tracking logic will know about LValues and RValues, but not about
specialized LValues and RValues; separating the "kind" information into bits
indicating whether an ExprValue is an LValue or an RValue from the bits that
specify the actual value type makes this separation easier.

llvm-svn: 46329
2008-01-24 23:19:54 +00:00
Ted Kremenek f3d6d668b6 enum value name change.
llvm-svn: 46327
2008-01-24 22:44:24 +00:00
Ted Kremenek 3e742f9184 More cleanups to pretty-printing of states in GraphViz output.
llvm-svn: 46326
2008-01-24 22:27:20 +00:00
Ted Kremenek 053527478b Added transfer function for DeclStmt.
llvm-svn: 46323
2008-01-24 20:55:43 +00:00
Ted Kremenek 1fba169ce0 Adjusted storage of values for Stmt* so that we need only query if
a Stmt* is a block-level expression when we INSERT a value into the map, and
not also when we QUERY a value.

llvm-svn: 46321
2008-01-24 19:43:37 +00:00
Ted Kremenek fa8062c162 Fixed a bug where the values of block-level expressions were being recorded in
the value map as if the expressions were non-block-level expressions.

llvm-svn: 46319
2008-01-24 19:28:01 +00:00
Ted Kremenek 286f030911 Minor tweaks in the transfer functions for pre- and post- ++/-- where
we falsely constructed an APInt to represent the constant '1' instead of
using an APSInt (which has a sign).

llvm-svn: 46317
2008-01-24 19:00:57 +00:00
Ted Kremenek c9052ff8fd Added support for unary operator '-' for equality sets.
Added some workarounds for loss of signess information on some APSInt
operations. Considering the best route to integrate these into APSInt directly.
(FIXME's in GRConstants.cpp).

llvm-svn: 46310
2008-01-24 08:20:02 +00:00
Ted Kremenek 1c91a67086 Added transfer functions for pre- and post- increment/decrement operators.
llvm-svn: 46300
2008-01-24 02:28:56 +00:00
Ted Kremenek 33d8285b8d Added passing "ASTContext" to both GREngine and GRConstants.
Added initial support for integer casting operations to GRConstants.

llvm-svn: 46298
2008-01-24 02:02:54 +00:00
Ted Kremenek 4f1da522ca Minor tweak in GetValue to avoid an extra check for ParenExprs.
llvm-svn: 46294
2008-01-24 00:50:08 +00:00
Ted Kremenek 2517423c3c Implemented value tracking support for '*' and '*='.
Added "multiplication" support for equality sets.

llvm-svn: 46289
2008-01-23 23:42:27 +00:00
Ted Kremenek 5e02dc1b46 Implemented value tracking support for '+=' and '-='.
llvm-svn: 46288
2008-01-23 23:38:00 +00:00
Ted Kremenek cefae084a3 Removed extra GraphViz node attributes for GRConstants, as some of them were
causing problems with Dot.

llvm-svn: 46285
2008-01-23 22:54:57 +00:00
Ted Kremenek 930191c011 some prettying of the GraphViz visualization of GRConstants analysis results.
llvm-svn: 46284
2008-01-23 22:30:44 +00:00
Ted Kremenek 0a8d3767a3 Major "architectural" changes to the GRConstants analysis. We now reason about
abstract "L-values" and "R-values" when doing value tracking, and expanding
constant tracking to encompass tracking disjunctive sets of possible constants.
Further, the tree-walking is more efficient, as we don't blindly recurse the
tree if we won't generate new states.

llvm-svn: 46278
2008-01-23 19:59:44 +00:00
Ted Kremenek 111ede6c00 Fixed bug in 'GetBinding' when doing the lookup of stored values. We now
use ImmutableMap::SlimFind(), which returns the correct value.

Added pruning of dead block-level expressions and Decls from our value map
using liveness information.

llvm-svn: 46154
2008-01-18 00:41:32 +00:00
Ted Kremenek b4b65e6319 Added support to dataflow solver to (when requested) also record dataflow
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.

llvm-svn: 46137
2008-01-17 18:25:22 +00:00
Ted Kremenek fff70962bb Added method Expr::IgnoreParens(), which returns the first non-ParenExpr Expr*.
Refactored the use of this method into both the Sema module and Analysis module,
which were using their own static functions that did the same thing.

llvm-svn: 46129
2008-01-17 16:57:34 +00:00
Ted Kremenek e780f408b1 Added some experimental optimizations to remove dead values from the
state.

llvm-svn: 46106
2008-01-17 00:52:48 +00:00
Ted Kremenek 506e507508 Changed sorting criteria for DSPtr to put sub-expressions first in the value
map. This will allow us to quickly prune them from maps without searching the
entire map.

llvm-svn: 46101
2008-01-16 23:35:31 +00:00
Ted Kremenek 692b01b0be Changed sorting criteria for DSPtr to sort Decl* before Expr*, and
to sort sub-expressions before Block-level expressions.

llvm-svn: 46100
2008-01-16 23:33:44 +00:00