You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the Clava AST and Language Specification, the header children of loop statements (init, condition, and step), are being parsed and stored as a statement. See pt.up.fe.specs.clava.ast.stmt.{ForStmt, WhileStmt, DoStmt}, and lines 303 through 310 of ClavaWeaver's artifacts.xml. However, the clang ast, as specified in the following cases:
Always defines these kind of children as expression. Therefore, it is redundant to have them as a statement, as they will always be an ExprStmt, and the expression must be extracted for most useful analyses.
It would make sense to adjust this API into returning expressions. Client code, if possible, should be adjusted as necessary.
The text was updated successfully, but these errors were encountered:
This is a tricky situation. There are some cases where it is advantageous to see the elements in the loop header as statements, others as expressions.
Additionally, expressions in Clava are a separate hierarchy from statements, but it Clang, expressions ARE statements (Expr extends Stmt), so it is not strictly against Clang specification to have an ExprStmt as a loop header element.
I think this needs further evaluation and will leave it open.
In the Clava AST and Language Specification, the header children of loop statements (init, condition, and step), are being parsed and stored as a statement. See
pt.up.fe.specs.clava.ast.stmt.{ForStmt, WhileStmt, DoStmt}
, and lines 303 through 310 of ClavaWeaver'sartifacts.xml
. However, the clang ast, as specified in the following cases:(including conditional statements for completeness)
Always defines these kind of children as expression. Therefore, it is redundant to have them as a statement, as they will always be an ExprStmt, and the expression must be extracted for most useful analyses.
It would make sense to adjust this API into returning expressions. Client code, if possible, should be adjusted as necessary.
The text was updated successfully, but these errors were encountered: