Remove extra from getCppType.

The argument is used for array type originally. We
now use hidl_array instead of T[], so there is no
need to use extra.

Renamed the convenience getCppType to getCppStackType
to avoid casting to (Type *) before using this
method (which makes it inconvenient)

Also fixes:
* RefType::getCppType ignores specifyNamespaces
* ConstantExpression.cpp emits a C-style cast instead
  of static_cast

Bug: 32559427

Test: mma passes
Test: hidl_test

Change-Id: I7e2e31c34c1ca1aa83c4a5a4dbdf7fd6b9aff30c
diff --git a/Type.cpp b/Type.cpp
index d0b8f9d..f97af23 100644
--- a/Type.cpp
+++ b/Type.cpp
@@ -88,11 +88,16 @@
     return scalarType->isValidEnumStorageType();
 }
 
-std::string Type::getCppType(StorageMode, std::string *, bool) const {
+std::string Type::getCppType(StorageMode, bool) const {
     CHECK(!"Should not be here");
     return std::string();
 }
 
+std::string Type::decorateCppName(
+        const std::string &name, StorageMode mode, bool specifyNamespaces) const {
+    return getCppType(mode, specifyNamespaces) + " " + name;
+}
+
 std::string Type::getJavaType(
         std::string *extra, bool /* forInitializer */) const {
     CHECK(!"Should not be here");
@@ -346,19 +351,16 @@
     return false;
 }
 
-std::string Type::getCppType(std::string *extra,
-                             bool specifyNamespaces) const {
-    return getCppType(StorageMode_Stack, extra, specifyNamespaces);
+std::string Type::getCppStackType(bool specifyNamespaces) const {
+    return getCppType(StorageMode_Stack, specifyNamespaces);
 }
 
-std::string Type::getCppResultType(std::string *extra,
-                                   bool specifyNamespaces) const {
-    return getCppType(StorageMode_Result, extra, specifyNamespaces);
+std::string Type::getCppResultType(bool specifyNamespaces) const {
+    return getCppType(StorageMode_Result, specifyNamespaces);
 }
 
-std::string Type::getCppArgumentType(std::string *extra,
-                                     bool specifyNamespaces) const {
-    return getCppType(StorageMode_Argument, extra, specifyNamespaces);
+std::string Type::getCppArgumentType(bool specifyNamespaces) const {
+    return getCppType(StorageMode_Argument, specifyNamespaces);
 }
 
 void Type::emitJavaReaderWriterWithSuffix(