Opened 2 years ago

Closed 13 months ago

#137 closed task (fixed)

Better lvalue handling

Reported by: a3moss Owned by:
Priority: minor Component: cfa-cc
Version: 1.0 Keywords:


lvalue isn't a qualifier anymore in Cforall, yet gets treated like one. There are 5 places in AST/Expr.cpp where a type is cloned just to add an lvalue qualifier (search add_qualifiers).

It might be preferable to make a new LvalueType that is essentially a readonly<Type> that just adds lvalue to its qualifiers (this might involve making Type::qualifiers a getter function rather than a field).

Another approach would be to store lvalue-ness on expressions rather than types, but that would be a more involved change. Both are worth investigating.

Change History (1)

comment:1 Changed 13 months ago by ajbeach

Resolution: fixed
Status: newclosed

I completed this task about 8 months ago. I used the second method and added a get_lvalue method to expressions. Most don't store any information but use the expression's form to determine the value category.

There is follow up work that could be done to further improve handling. Notably, some of the current code is wrong as there is a slight mismatch between CFA and C in what is considered an lvalue. More exciting is removing lvalues from CFA, in which case lvalue would only remain to assist with source-to-source translation.

Note: See TracTickets for help on using tickets.