CodeQL library for Go
codeql/go-all 2.1.4-dev (changelog, source)
Search

Module IR

Provides predicates and classes for working with IR constructs.

Import path

import semmle.go.controlflow.IR

Predicates

assignInstruction

Gets the instruction corresponding to the ith assignment happening at assgn (0-based).

assignKeyInstruction

Gets the instruction corresponding to the assignment of the key variable of range statement rs.

assignValueInstruction

Gets the instruction corresponding to the assignment of the value variable of range statement rs.

evalExprInstruction

Gets the (final) instruction computing the value of e.

extractTupleElement

Gets the instruction corresponding to the extraction of the idxth element of the tuple produced by base.

implicitDerefInstruction

Gets the implicit dereference instruction for e, where e is a pointer used as the base in a field/method access, element access, or slice expression.

implicitInitInstruction

Gets the instruction corresponding to the implicit initialization of v to its zero value.

implicitLowerSliceBoundInstruction

Gets the instruction corresponding to the implicit lower bound of slice e, if any.

implicitMaxSliceBoundInstruction

Gets the instruction corresponding to the implicit maximum bound of slice e, if any.

implicitUpperSliceBoundInstruction

Gets the instruction corresponding to the implicit upper bound of slice e, if any.

initInstruction

Gets the instruction corresponding to the ith initialization happening at spec (0-based).

initParamInstruction

Gets the instruction corresponding to the initialization of p.

initRecvInstruction

Gets the instruction corresponding to the initialization of r.

Classes

AssignInstruction

An instruction assigning to a variable or field.

CaseInstruction

An instruction corresponding to the implicit comparison or type check performed by an expression in a case clause.

ComponentReadInstruction

An IR instruction that reads a component from a composite object.

DeclareFunctionInstruction

An instruction that corresponds to the declaration of a function.

DeferInstruction

An instruction that corresponds to a defer statement.

ElementReadInstruction

An IR instruction that reads an element of an array, slice, map or string.

ElementTarget

A reference to an element of an array, slice or map, used as the target of a write.

ElementWriteInstruction

An IR instruction that writes to an element of an array, slice, or map.

EvalCompoundAssignRhsInstruction

An instruction computing the value of the right-hand side of a compound assignment.

EvalImplicitDerefInstruction

An instruction implicitly dereferencing the base in a field or method reference through a pointer, or the base in an element or slice reference through a pointer.

EvalImplicitInitInstruction

An instruction that computes the zero value for a variable or constant.

EvalImplicitLowerSliceBoundInstruction

An instruction computing the implicit lower slice bound of zero in a slice expression without an explicit lower bound.

EvalImplicitMaxSliceBoundInstruction

An instruction computing the implicit maximum slice bound in a slice expression without an explicit maximum bound.

EvalImplicitOneInstruction

An instruction computing the implicit operand 1 in an increment or decrement statement.

EvalImplicitTrueInstruction

An instruction computing the implicit true value in an expression-less switch statement.

EvalImplicitUpperSliceBoundInstruction

An instruction computing the implicit upper slice bound in a slice expression without an explicit upper bound.

EvalIncDecRhsInstruction

An instruction that computes the (implicit) right-hand side of an increment or decrement statement.

EvalInstruction

An IR instruction representing the evaluation of an expression.

ExtractTupleElementInstruction

An instruction selecting one of multiple values returned by a function, or either the key or the value of the iterator in a range loop, or the result or success value from a type assertion.

FieldReadInstruction

An IR instruction that reads the value of a field.

FieldTarget

A reference to a field, used as the target of a write.

FieldWriteInstruction

An IR instruction that writes to a field.

GetNextEntryInstruction

An instruction that gets the next key-value pair in a range loop.

GoInstruction

An instruction that corresponds to a go statement.

ImplicitFieldReadInstruction

An IR instruction for an implicit field read as part of reading a promoted field.

ImplicitLiteralElementIndexInstruction

An IR instruction computing the implicit index of an element in an array or slice literal.

IncDecInstruction

An instruction that corresponds to an increment or decrement statement.

InitLiteralArrayElementInstruction

An IR instruction that initializes an element of an array literal.

InitLiteralComponentInstruction

An IR instruction that initializes a component of a composite literal.

InitLiteralElementInstruction

An IR instruction that initializes an element of an array, slice or map literal.

InitLiteralMapElementInstruction

An IR instruction that initializes an element of a map literal.

InitLiteralSliceElementInstruction

An IR instruction that initializes an element of a slice literal.

InitLiteralStructFieldInstruction

An IR instruction that initializes a field of a struct literal.

InitParameterInstruction

An instruction initializing a parameter to the corresponding argument.

InitResultInstruction

An instruction initializing a result variable to its zero value.

Instruction

An IR instruction.

MethodReadInstruction

An IR instruction that looks up a method.

PointerTarget

A pointer dereference, used as the target of a write.

ReadArgumentInstruction

An instruction reading the value of a function argument.

ReadInstruction

An IR instruction that reads the value of a variable, constant, field or array element, or refers to a function.

ReadResultInstruction

An instruction that reads the final value of a result variable upon returning from a function.

ReturnInstruction

An instruction corresponding to a return from a function.

SelectInstruction

An instruction corresponding to a select statement.

SendInstruction

An instruction corresponding to a send statement.

SliceInstruction

An IR instruction that constructs a slice.

TypeSwitchImplicitVariableInstruction

An instruction corresponding to the implicit declaration of the variable lv in case clause cc and its assignment of the value switchExpr from the guard. This only occurs in case clauses in a type switch statement which declares a variable in its guard.

VarOrConstTarget

A reference to a variable or constant, used as the target of a write.

WriteInstruction

An IR instruction that writes a memory location.

WriteResultInstruction

An instruction that represents the implicit assignment to a result variable performed by a return statement.

WriteTarget

A representation of the target of a write instruction.