View source code
Display the source code in dmd/dfa/fast/analysis.d from which thispage was generated on github.
Report a bug
If you spot a problem with this page, click here to create aGitHub issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.Requires a signed-in GitHub account. This works well for small changes.If you'd like to make larger changes you may want to consider usinglocal clone.

Function dmd.dfa.fast.analysis.DFAAnalyzer.convergeStatementIf

Merges the states from the True and False branches of an If statement.

void convergeStatementIf(
  dmd.dfa.fast.structure.DFALatticeRef condition,
  dmd.dfa.fast.structure.DFAScopeRef scrTrue,
  dmd.dfa.fast.structure.DFAScopeRef scrFalse,
  bool haveFalseBody,
  bool unknownBranchTaken,
  int predicateNegation
);

This handles the "Diamond" control flow pattern. 1. It compares the state at the end of the "True" block vs the "False" block. 2. It identifies "Gates" (variables used in the condition, e.g., if (ptr)). 3. It calculates the union (Join) of the states to determine the state after the If statement completes.

Parameters

NameDescription
condition The lattice state of the condition expression.
scrTrue The final state of the True scope.
scrFalse The final state of the False scope.
haveFalseBody True if the if-statement has an else block.
unknownBranchTaken True if the condition result is not statically known (Maybe).
predicateNegation State of the predicate negation (0: unknown, 1: negated, 2: not negated).

Authors

Richard (Rikki) Andrew Cattermole

License

Boost License 1.0