Class Handler
A handler is a piece of code that can be executed out of sequence, for example
when an instruction generates an exception or leaves a finally
block.
Each handler has a scope representing the block of instructions guarded by
this handler (corresponding to a C# try { ... }
block), and a block of instructions
to execute when the handler is triggered (corresponding to a catch
or finally
block).
Handlers are entry points (EntryPoint
) so that they can
provide values on the stack, for example the value of the current exception. This is why
some handlers have a push count of 1.
Either a finally handler (FinallyHandler
), filter handler (FilterHandler
),
catch handler (CatchHandler
), or a fault handler (FaultHandler
).
Import path
import semmle.code.cil.Handler
Direct supertypes
Indirect supertypes
Known direct subtypes
Predicates
getASuccessorType | Gets a successor to this node, of type |
getCaughtType | Gets the type of the caught exception, if any. |
getHandlerStart | Gets the first instruction in the |
getImplementation | Gets the method containing this control flow node. |
getIndex | Gets the 0-based index of this handler. Handlers are evaluated in this sequence. |
getLocation | |
getTryEnd | Gets the last instruction in the |
getTryStart | Gets the first instruction in the |
isInScope | Holds if the instruction |
toString |
Inherited predicates
fromLibrary | Holds if this element is from an assembly. | from Element |
fromSource | Holds if this element is from source code. | from Element |
getALocation | Gets a location of this element, which can include locations in both DLLs and source files. | from Element |
getAPredecessor | Gets a predecessor of this node, if any. | from ControlFlowNode |
getAPrimaryQlClass | Gets the name of a primary CodeQL class to which this element belongs. | from Element |
getASuccessor | Gets a successor of this node, if any. | from ControlFlowNode |
getAnOperand | Gets an operand of this instruction, if any. | from ControlFlowNode |
getFalseSuccessor | Gets a false successor of this node, if any. | from ControlFlowNode |
getFile | Gets the file containing this element. | from Element |
getLanguage | Gets the “language” of this program element, as defined by the extension of the filename. For example, C# has language “cs”, and Visual Basic has language “vb”. | from Element |
getOperand | Gets an instruction that supplies the | from ControlFlowNode |
getOperandType | Gets the type of the | from ControlFlowNode |
getParentExpr | Gets an expression that consumes the output of this instruction on the stack. | from ControlFlowNode |
getPopCount | Gets the number of items this node pops from the stack. | from ControlFlowNode |
getPrimaryQlClasses | Gets a comma-separated list of the names of the primary CodeQL classes to which this element belongs. | from Element |
getPushCount | Gets the number of items this node pushes onto the stack. This value is either 0 or 1, except for the instruction | from ControlFlowNode |
getStackSizeAfter | Gets the stack size after this instruction. | from ControlFlowNode |
getStackSizeBefore | Gets the stack size before this instruction. | from EntryPoint |
getTrueSuccessor | Gets a true successor of this node, if any. | from ControlFlowNode |
getType | Gets the type of the item pushed onto the stack, if any. | from ControlFlowNode |
isBranch | Holds if this control flow node has more than one successor. | from ControlFlowNode |
isJoin | Holds if this control flow node has more than one predecessor. | from ControlFlowNode |
toStringWithTypes | Gets the full textual representation of this element, including type information. | from Element |