DCEMarkers
to avoid inserting curly braces everywhere, I could instrument like so:
if (C && (Marker1(), 1) || (Marker2(), 0) )
STMT();
or
if ( C ? (Marker1(), 1) : (Marker2(), 0))
STMT();
loops can be handled similarly, except for range-based for loops and do while loops which must be instrumented via their bodies. It also doesn't work for if statement with a complex initializer (if (auto* X = expr())), for simple cases it would work: if (auto* X = ptr ? (Marker1(), ptr): (Marker2(), ptr)
.
The downside is that Marker() must be an expression, but I could implement is an always_inline function:
__attribute__((always_inline))
void Marker(){
//...
}
VRMarkers
VRMarkers can be baked into expressions, e.g.:
T V = (marker(x), expr(x));
DCEMarkers
to avoid inserting curly braces everywhere, I could instrument like so:
or
loops can be handled similarly, except for range-based for loops and do while loops which must be instrumented via their bodies. It also doesn't work for if statement with a complex initializer (
if (auto* X = expr())), for simple cases it would work:if (auto* X = ptr ? (Marker1(), ptr): (Marker2(), ptr).
The downside is that
Marker()must be an expression, but I could implement is analways_inlinefunction:VRMarkers
VRMarkers can be baked into expressions, e.g.: