Arrays of arrays are now coalesced into a single multi-dimensional array type.
This is natively stored as a flat array of the element type.
Change-Id: I1b0eee51b496648a9c8445b835635deff1a90aab
Bug: 31438033
Test: run updated "hidl_test" and "hidl_test_java"
diff --git a/hidl-gen_y.yy b/hidl-gen_y.yy
index 9ced71f..6249886 100644
--- a/hidl-gen_y.yy
+++ b/hidl-gen_y.yy
@@ -29,6 +29,7 @@
#include "hidl-gen_y.h"
+#include <android-base/logging.h>
#include <stdio.h>
using namespace android;
@@ -600,7 +601,15 @@
YYERROR;
}
- $$ = new ArrayType($1, $3);
+ char *end;
+ unsigned long size = strtoul($3, &end, 10);
+ CHECK(end > $3 && *end == '\0');
+
+ if ($1->isArray()) {
+ $$ = new ArrayType(static_cast<ArrayType *>($1), size);
+ } else {
+ $$ = new ArrayType($1, size);
+ }
}
| VEC '<' fqname '>'
{