Be a little smarter about dealing with TypeDefs, resolve to the typedef'd

target at lookup time, so all code ever sees is anything _but_ TypeDefs.
Also verify that the optional Enum storage type is valid (i.e. an enum
or an integer type) and re-emit enum values for derived enum types.
diff --git a/Type.cpp b/Type.cpp
index 548e425..6d0e4e8 100644
--- a/Type.cpp
+++ b/Type.cpp
@@ -1,6 +1,7 @@
 #include "Type.h"
 
 #include "Formatter.h"
+#include "ScalarType.h"
 
 #include <android-base/logging.h>
 
@@ -17,10 +18,28 @@
     return false;
 }
 
+bool Type::isEnum() const {
+    return false;
+}
+
+bool Type::isTypeDef() const {
+    return false;
+}
+
 const ScalarType *Type::resolveToScalarType() const {
     return NULL;
 }
 
+bool Type::isValidEnumStorageType() const {
+    const ScalarType *scalarType = resolveToScalarType();
+
+    if (scalarType == NULL) {
+        return false;
+    }
+
+    return scalarType->isValidEnumStorageType();
+}
+
 std::string Type::getCppType(StorageMode, std::string *) const {
     CHECK(!"Should not be here");
     return std::string();