CodeQL library for Go
codeql/go-all 2.1.3-dev (changelog, source)
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.go.dataflow.GlobalValueNumbering

Direct supertypes

Predicates

getANode

Gets a data-flow node that has this GVN.

getKind

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

hasLocationInfo

Holds if this element is at the specified location. The location spans column startcolumn of line startline to column endcolumn of line endline in file filepath. For more information, see Locations.

toString

Gets a textual representation of this element.

Charpred