Decision Coverage Instrumentation

Decision coverage instrumentation includes function coverage. Additionally, all conditional and unconditional branches and control transfers are instrumented, leading to the use of different counter types.

In the following overview, INCREMENT_JUMP_COUNTER means that the counter of an explicit control transfer is incremented.

INCREMENT_DECISION_COUNTER(expression) means that if the expression evaluates to true the corresponding true counter is incremented. If the expression evaluates to false, the corresponding false counter is incremented.

If Statement
If Statement with Declaration
if (int i = expr)... 
is logically instrumented as
if (int i = expr){\
else does not have a counter, but it is recorded and reported.
While Loop
	original while-body
For Loop
for (expr1; INCREMENT_DECISION_COUNTER(expression); expr2)
	original for-body
	original do-body
Special Loop Variants
The following loops (schematically)
for (var : set) {...}            /* in C++11 */
for each (var in set] {...}      /* VC++ extension */
foreach (var in set) {...}       /* C# */
while (int i = expr) {...}       /* C++ */
for (...;int i = expr;...) {...} /* C++ */
are instrumented as
loop_header_unchanged { 
For these kind of probes there is one counter telling how many times the loop body has been entered.
Continue Statement
Remark: In Java this can also be continue label;.
Break Statement
Remark: In Java this can also be break label;.
Goto Statement
goto label;}
Labels do not have a counter, but they are recorded and displayed in the Execution Profile Listing. If the label was reached by a jump, it is marked with a "+" sign.
Return Statement
return [expression_if_any];}
Switch Statement
There is no counter inserted, but switch is recorded and reported.
Case Label (and Default)
goto over;  /* for fall through */
case expression:
With that construction, the corresponding counter is only incremented if the implicit decision switch-expression == case-value is true. A default label is treated the same way, and also a missing default branch is instrumented and has to be tested.
Ternary Operator
INCREMENT_DECISION_COUNTER(expr1) ? expr2 : expr3 
Try Statement
try {	/* in C++ */
	{original body}
__try {	/* supported in some C environments */
	{original body}
Throw Statement
throw expression;}

__leave;}	/* supported in some C environments */
Catch Statement
catch (declaration) { /* in C++ */
	{original body}
__except (filter_expression) {/*some C environments*/
	{original body}
__finally { /* some C environments */
	{original body}
Function end brace
For void functions with reachable end, the function end is instrumented as
... /* function body */
The question if the end is reachable is answered by a simple heuristic approach. In case of doubt, it is instrumented.
Lambda Function in Global Scope
A lambda function in global scope (or at "file-level", i.e. outside of functions), e.g. like
auto n = [](int i){return i + 1;};
is instrumented like a normal function. As the function name in an execution profile listing there is "FUNCTION lambda-[]()".
Lambda Function Inside a Function
A lambda function inside a function, e.g. like
a = b + [c]{if (c > 5) return 5; else return 6;}() + d;
is also instrumented. However nested lambda functions are not instrumented. In an execution profile listing there is a marking “lambda-[]()” at the beginning of a function-internal lambda, and its end is marked with “}”. The execution hits of a function-internal lambda function are counted to its enclosing function.
User Defined Counter
If the pragma CTC COUNT is used to add a counter, it is instrumented as
#pragma CTC COUNT token_sequence