cil icon indicating copy to clipboard operation
cil copied to clipboard

no way to print original expression if it's put in a temporary variable

Open vogler opened this issue 5 years ago • 2 comments

d_exp and dd_exp print simple expressions like x == 3 as is, but for expressions that are taken apart and stored into a temporary variable, like e.g. y >= 6 && y <= 8:

  • d_exp prints tmp___0 (temporary variable the result of the expression is stored in; same for d_plainexp),
  • dd_exp prints <boolean expression>.

vogler avatar Aug 26 '20 14:08 vogler

I don't think y >= 6 && y <= 8 is an expression in the sense of Cil.exp, since it has control flow. So one would need to introduce a special sort of function that maps this back to its Instructions and then turns this back into a C expression.

michael-schwarz avatar Aug 26 '20 14:08 michael-schwarz

Yes, maybe there's no nice way to do it in CIL since we'd have to wrap exp and e.g. add its location. However, would be nice to have some function for it.

vogler avatar Aug 26 '20 14:08 vogler