[ClavaLaraApi] DecomposeVarDeclarations now supports diagnostics
@@ -2,7 +2,9 @@ laraImport("lara.pass.Pass");
laraImport("clava.ClavaJoinPoints");
/**
+ * Decomposes the vardecl nodes that are reachable from the given join point.
*
+ * E.g. transforms int i = 0; into int i; i = 0;
*/
class DecomposeVarDeclarations extends Pass {
@@ -12,6 +14,8 @@ class DecomposeVarDeclarations extends Pass {
_apply_impl($jp) {
+ let appliedPass = false;
+
// Find all var decls
for(var $vardecl of Query.searchFromInclusive($jp, "vardecl")) {
@@ -20,6 +24,9 @@ class DecomposeVarDeclarations extends Pass {
continue;
}
+ // Found vardecl to decompose
+ appliedPass = true;
+
// Get initialization
let $init = $vardecl.init;
@@ -40,6 +47,16 @@ class DecomposeVarDeclarations extends Pass {
$vardecl.insertAfter($assign);
}
+ return this._new_result($jp, appliedPass);
+
+ }
+ _new_result($jp, appliedPass) {
+ var result = new PassResult(this.name);
+ result.isUndefined = false;
+ result.appliedPass = appliedPass;
+ result.insertedLiteralCode = false;
+ result.location = $jp.location;
+ return result;
}
}
\ No newline at end of file
