aboutsummaryrefslogtreecommitdiff
path: root/hidl-gen_l.ll
diff options
context:
space:
mode:
authorYifan Hong <elsk@google.com>2016-12-01 11:37:18 -0800
committerYifan Hong <elsk@google.com>2016-12-05 12:42:23 -0800
commitc57c8bb9f368faca636bdb6b39773e72255e8b08 (patch)
tree060507788f798f5d10eda0b5440274923f99e05d /hidl-gen_l.ll
parent30bb6a869be0f3f82497b7b11c71ec9d47652ed0 (diff)
downloadhidl-c57c8bb9f368faca636bdb6b39773e72255e8b08.tar.gz
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
Diffstat (limited to 'hidl-gen_l.ll')
-rw-r--r--hidl-gen_l.ll1
1 files changed, 1 insertions, 0 deletions
diff --git a/hidl-gen_l.ll b/hidl-gen_l.ll
index 05a91fd3..a65bc9fc 100644
--- a/hidl-gen_l.ll
+++ b/hidl-gen_l.ll
@@ -94,6 +94,7 @@ int check_type(yyscan_t yyscanner, struct yyguts_t *yyg);
"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; }