[ClavaLaraApi] DecomposeVarDeclarations handles literal auto vardecls
@@ -21,10 +21,15 @@ class DecomposeVarDeclarations extends Pass {
$jp.initStyle === "cinit" && // Only C-style initializations
!$jp.isGlobal && // Ignore global variables
!$jp.isInsideHeader && // Ignore if inside any header (e.g. if, switch, loop...)
- !$jp.type.instanceOf("arrayType") // Ignore if array
+ !$jp.type.instanceOf("arrayType") && // Ignore if array
+ !this.#isLiteralAuto($jp) // Specific case of vardecl in literal code that uses auto (e.g. as inserted by Timer)
);
}
+ #isLiteralAuto($jp) {
+ return $jp.type.isAuto && $jp.init.type.instanceOf("undefinedType");
+ }
+
transformJoinpoint($vardecl) {
// store init expression for later
const $init = $vardecl.init;
