CodeQL library for C/C++
Search

Class HashCons

HashCons is the hash-cons of an expression. The relationship between Expr and HC is many-to-one: every Expr has exactly one HC, but multiple expressions can have the same HC. If two expressions have the same HC, it means that they are structurally equal. The HC is an opaque value. The only use for the HC of an expression is to find other expressions that are structurally equal to it. Use the predicate hashCons to get the HC for an Expr.

Note: HC has toString and getLocation methods, so that it can be displayed in a results list. These work by picking an arbitrary expression with this HC and using its toString and getLocation methods.

Import path

import semmle.code.cpp.valuenumbering.HashCons

Direct supertypes

Predicates

getAnExpr

Gets an expression that has this HC.

getKind

Gets the kind of the HC. This can be useful for debugging.

getLocation

Gets the primary location of this element.

toString

Gets a textual representation of this element.