Merge "Require storage type on enum."
am: f347587603
Change-Id: Ied16fdbc46c5e936d49b88d029ed8799a68ac10d
diff --git a/EnumType.cpp b/EnumType.cpp
index f736cd6..d636a2b 100644
--- a/EnumType.cpp
+++ b/EnumType.cpp
@@ -31,10 +31,7 @@
Type *storageType)
: Scope(localName, location),
mValues(),
- mStorageType(
- storageType != NULL
- ? storageType
- : new ScalarType(ScalarType::KIND_INT32)) {
+ mStorageType(storageType) {
}
const Type *EnumType::storageType() const {
diff --git a/EnumType.h b/EnumType.h
index 36ac968..ccdf384 100644
--- a/EnumType.h
+++ b/EnumType.h
@@ -30,7 +30,7 @@
struct EnumType : public Scope {
EnumType(const char *localName,
const Location &location,
- Type *storageType = NULL);
+ Type *storageType);
const Type *storageType() const;
const std::vector<EnumValue *> &values() const;
diff --git a/hidl-gen_y.yy b/hidl-gen_y.yy
index 6ac7e5b..186fb61 100644
--- a/hidl-gen_y.yy
+++ b/hidl-gen_y.yy
@@ -227,7 +227,7 @@
%type<type> fqtype
%type<str> valid_identifier
-%type<type> type opt_storage_type
+%type<type> type enum_storage_type
%type<type> array_type_base
%type<arrayType> array_type
%type<type> opt_extends
@@ -843,9 +843,8 @@
| named_enum_declaration { $$ = $1; }
;
-opt_storage_type
- : /* empty */ { $$ = NULL; }
- | ':' fqtype
+enum_storage_type
+ : ':' fqtype
{
$$ = $2;
@@ -864,7 +863,7 @@
;
named_enum_declaration
- : ENUM valid_identifier opt_storage_type
+ : ENUM valid_identifier enum_storage_type
{
ast->enterScope(new EnumType($2, convertYYLoc(@2), $3));
}