CodeQL library for C/C++
codeql/cpp-all 0.7.2 ( changelog , source )

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



Gets an expression that has this HC.


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


Gets the primary location of this element.


Gets a textual representation of this element.