lks9 / src-tracer

Other
0 stars 0 forks source link

short circuit ops with constant value #42

Closed lks9 closed 4 months ago

lks9 commented 1 year ago

when instrumenting with --short-circuit we don't want to instrument constant expressions. because

  1. the operation might be part of a static const expression
  2. recording a known value in the trace is useless
  3. the compiler will not be able to optimize out the expression after instrumentation

we have to see whether we can get this info out of libclang...

lks9 commented 4 months ago

Fixed with cee02c9a561aecb29a375aa1edfc95a3c6cd1c72. This is only a syntactic check on the left side. Something like var || 1 or even (1 + 0) || var still gets instrumented.

lks9 commented 4 months ago

Also 173a90dc10a48ad4460adc90a632cecef21d2022 removed some short circuit instrumentations, when there is no function call inside them (=purely logical).