CodeQL library for C/C++
Search

Class GVN

A Global Value Number. A GVN is an abstract representation of the value computed by an expression. The relationship between Expr and GVN is many-to-one: every Expr has exactly one GVN, but multiple expressions can have the same GVN. If two expressions have the same GVN, it means that they compute the same value at run time. The GVN is an opaque value, so you cannot deduce what the run-time value of an expression will be from its GVN. The only use for the GVN of an expression is to find other expressions that compute the same value. Use the predicate globalValueNumber to get the GVN for an Expr.

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

Import path

import semmle.code.cpp.valuenumbering.GlobalValueNumberingImpl

Direct supertypes

Predicates

getAnExpr

Gets an expression that has this GVN.

getKind

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

getLocation

Gets the primary location of this element.

toString

Gets a textual representation of this element.

Charpred