Compose declaration decomposition to comply w C++
laraImport("lara.pass.Pass");
laraImport("weaver.Query");
-//laraImport("clava.Clava");
+laraImport("clava.Clava");
+laraImport("clava.pass.DecomposeVarDeclarations");
class SingleReturnFunction extends Pass {
constructor() {
@@ -20,6 +21,11 @@ class SingleReturnFunction extends Pass {
return;
}
+ // C++ spec has some restrictions about jumping over initialized values that
+ // would be invalidated by the generated code, so we need to decompose variable
+ // declarations first
+ new DecomposeVarDeclarations().apply($body);
+
$body.insertEnd("__return_label:");
const returnType = $jp.returnType;
@@ -41,6 +47,6 @@ class SingleReturnFunction extends Pass {
$returnStmt.insertBefore("goto __return_label;");
$returnStmt.detach();
}
- //Clava.rebuild();
+ Clava.rebuild();
}
}
