CodeQL library for C/C++
codeql/cpp-all 0.12.12-dev (changelog, source)
Search

Module FlowVar_internal

Provides classes and predicates that ought to be private but cannot use the private annotation because they may be referred to by unit tests.

Import path

import semmle.code.cpp.dataflow.internal.FlowVar

Predicates

allReadsDominatedByOverwrite

Holds if all read accesses of v are dominated by an overwrite of v.

assignmentLikeOperation

Holds if v is modified through va as a side effect of evaluating node, receiving a value best described by assignedExpr. Assignment-like operations are those that desugar to a non-overloaded = assignment: =, +=, ++, --, etc.

blockVarDefinedByVariable

Holds if sbb is the SubBasicBlock where v receives its initial value. See the documentation for FlowVar.definedByInitialValue.

dominatedByOverwrite

Holds if va accesses v and is dominated by an overwrite of v.

fullySupportedSsaVariable

For various reasons, not all variables handled perfectly by the SSA library. Ideally, this predicate should become larger as the SSA library improves. Before we can remove the BlockVar class completely, the SSA library needs the following improvements. - Considering uninitialized local variables to be definitions. - Supporting fields, globals and statics like the Java SSA library does. - Supporting all local variables, even if their address is taken by address-of, reference assignments, or lambdas. - Understanding that assignment to a field of a local struct is a definition of the struct but not a complete overwrite. This is what the IR library uses chi nodes for.

getAnIteratorAccess
getAnOverwritingBB

Gets a basic block in which v is overwritten.

indexOfFirstOverwriteInBB
initializer

Holds if v is initialized to have value assignedExpr.

mayBeUsedUninitialized

Holds if va may be an uninitialized access to v.

notAccessedAtStartOfBB

Holds if v has not been accessed at the start of bb, for a variable v where allReadsDominatedByOverwrite(v) does not hold.

overwrite

Holds if the value of the variable accessed at va is completely overwritten at node, where va is uniquely determined by node.

parameterIsNonConstReference
parameterUsedInConstructorFieldInit

Holds if p is a parameter to a constructor that is used in a ConstructorFieldInit at va. This ignores the corner case that p might have been overwritten to have a different value before this happens.

readAccess

Holds if the value of the variable accessed at va may affect the execution of the program.

skipLoop

Holds if loop always assigns to v before leaving through an edge from bbInside in its condition to bbOutside outside the loop. Also, v must be used outside the loop.

Classes

AlwaysTrueUponEntryLoop

A for-loop or while-loop whose condition is always true upon entry but not always true after the first iteration.

BlockVar

A variable whose analysis is backed by a simple control flow analysis that does not perform as well as the SSA library but gives better results for data flow purposes in some cases.

DataFlowSubBasicBlockCutNode

A point in a basic block where a non-SSA variable may have a different value than it did elsewhere in the same basic block. Extending this class configures the SubBasicBlocks library as needed for the implementation of this library.

IteratorParameter
PointerWrapperParameter
SsaVar

A variable whose analysis is backed by the SSA library.

UninitializedLocalVariable

A local variable that is uninitialized immediately after its declaration.

Datatypes