Add a bitfield type.
It is possible to say
enum MyEnum : int8_t {...};
...
bitfield<MyEnum>
in HIDL. In the above example, bitfield<MyEnum>
simply translates to int8_t.
Change mutating |= and &= to allow only (e.g.)
int8_t s = 0;
s |= MyEnum::VAL1;
Bug: 31702236
Test: hidl_test
Change-Id: I8d79975bb48e1ffd3af4726a52ef3678dac60115
diff --git a/hidl-gen_l.ll b/hidl-gen_l.ll
index 05a91fd..a65bc9f 100644
--- a/hidl-gen_l.ll
+++ b/hidl-gen_l.ll
@@ -94,6 +94,7 @@
"struct" { return token::STRUCT; }
"typedef" { return token::TYPEDEF; }
"union" { return token::UNION; }
+"bitfield" { yylval->templatedType = new BitFieldType; return token::TEMPLATED; }
"vec" { yylval->templatedType = new VectorType; return token::TEMPLATED; }
"ref" { yylval->templatedType = new RefType; return token::TEMPLATED; }
"oneway" { return token::ONEWAY; }