# Module HashCons

Provides an implementation of Hash consing. See https://en.wikipedia.org/wiki/Hash_consing

The predicate `hashCons`

converts an expression into a `HashCons`

, which is an
abstract type presenting the hash-cons of the expression. If two
expressions have the same `HashCons`

then they are structurally equal.

Important note: this library ignores the possibility that the value of an expression might change between one occurrence and the next. For example:

```
x = a+b;
a++;
y = a+b;
```

In this example, both copies of the expression `a+b`

will hash-cons to
the same value, even though the value of `a`

has changed. This is the
intended behavior of this library. If you care about the value of the
expression being the same, then you should use the GlobalValueNumbering
library instead.

To determine if the expression `x`

is structurally equal to the
expression `y`

, use the library like this:

```
hashCons(x) = hashCons(y)
```

## Import path

`semmle.code.cpp.valuenumbering.HashCons`

## Imports

cpp | Provides classes and predicates for working with C/C++/ObjC/ObjC++ code. |

## Predicates

analyzableExpr | Holds if the expression is explicitly handled by |

hashCons | Gets the hash-cons of expression |

## Classes

HashCons | HashCons is the hash-cons of an expression. The relationship between |