Create a new TypeNodes.def file that enumerates all of the types,
giving them rough classifications (normal types, never-canonical
types, always-dependent types, abstract type representations) and
making it far easier to make sure that we've hit all of the cases when
decoding types. 

Switched some switch() statements on the type class over to using this
mechanism, and filtering out those things we don't care about. For
example, CodeGen should never see always-dependent or non-canonical
types, while debug info generation should never see always-dependent
types. More switch() statements on the type class need to be moved 
over to using this approach, so that we'll get warnings when we add a
new type then fail to account for it somewhere in the compiler.

As part of this, some types have been renamed:

  TypeOfExpr -> TypeOfExprType
  FunctionTypeProto -> FunctionProtoType
  FunctionTypeNoProto -> FunctionNoProtoType

There shouldn't be any functionality change...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65591 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index 3156508..06ae9eb 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -78,7 +78,7 @@
 QualType Type::getDesugaredType() const {
   if (const TypedefType *TDT = dyn_cast<TypedefType>(this))
     return TDT->LookThroughTypedefs();
-  if (const TypeOfExpr *TOE = dyn_cast<TypeOfExpr>(this))
+  if (const TypeOfExprType *TOE = dyn_cast<TypeOfExprType>(this))
     return TOE->getUnderlyingExpr()->getType();
   if (const TypeOfType *TOT = dyn_cast<TypeOfType>(this))
     return TOT->getUnderlyingType();
@@ -118,9 +118,9 @@
   case FunctionProto:
   case FunctionNoProto:
   case Reference:
+  case Record:
+  case CXXRecord:
     return true;
-  case Tagged:
-    return !cast<TagType>(CanonicalType)->getDecl()->isEnum();
   default:
     return false;
   }
@@ -216,12 +216,12 @@
   return getDesugaredType()->getAsFunctionType();
 }
 
-const FunctionTypeNoProto *Type::getAsFunctionTypeNoProto() const {
-  return dyn_cast_or_null<FunctionTypeNoProto>(getAsFunctionType());
+const FunctionNoProtoType *Type::getAsFunctionNoProtoType() const {
+  return dyn_cast_or_null<FunctionNoProtoType>(getAsFunctionType());
 }
 
-const FunctionTypeProto *Type::getAsFunctionTypeProto() const {
-  return dyn_cast_or_null<FunctionTypeProto>(getAsFunctionType());
+const FunctionProtoType *Type::getAsFunctionProtoType() const {
+  return dyn_cast_or_null<FunctionProtoType>(getAsFunctionType());
 }
 
 
@@ -742,7 +742,9 @@
     // Void is the only incomplete builtin type.  Per C99 6.2.5p19, it can never
     // be completed.
     return isVoidType();
-  case Tagged:
+  case Record:
+  case CXXRecord:
+  case Enum:
     // A tagged type (struct/union/enum/class) is incomplete if the decl is a
     // forward declaration, but not a full definition (C99 6.2.5p22).
     return !cast<TagType>(CanonicalType)->getDecl()->isDefinition();
@@ -778,14 +780,15 @@
   case ObjCQualifiedId:
     return true;
 
-  case Tagged:
-    if (isEnumeralType())
-      return true;
-    if (CXXRecordDecl *RDecl = dyn_cast<CXXRecordDecl>(
-          cast<TagType>(CanonicalType)->getDecl()))
-      return RDecl->isPOD();
+  case Enum:
+    return true;
+
+  case Record:
     // C struct/union is POD.
     return true;
+
+  case CXXRecord:
+    return cast<CXXRecordType>(CanonicalType)->getDecl()->isPOD();
   }
 }
 
@@ -832,7 +835,7 @@
   }
 }
 
-void FunctionTypeProto::Profile(llvm::FoldingSetNodeID &ID, QualType Result,
+void FunctionProtoType::Profile(llvm::FoldingSetNodeID &ID, QualType Result,
                                 arg_type_iterator ArgTys,
                                 unsigned NumArgs, bool isVariadic,
                                 unsigned TypeQuals) {
@@ -843,7 +846,7 @@
   ID.AddInteger(TypeQuals);
 }
 
-void FunctionTypeProto::Profile(llvm::FoldingSetNodeID &ID) {
+void FunctionProtoType::Profile(llvm::FoldingSetNodeID &ID) {
   Profile(ID, getResultType(), arg_type_begin(), NumArgs, isVariadic(),
           getTypeQuals());
 }
@@ -903,8 +906,8 @@
   }
 }
 
-TypeOfExpr::TypeOfExpr(Expr *E, QualType can)
-  : Type(TypeOfExp, can, E->isTypeDependent()), TOExpr(E) {
+TypeOfExprType::TypeOfExprType(Expr *E, QualType can)
+  : Type(TypeOfExpr, can, E->isTypeDependent()), TOExpr(E) {
   assert(!isa<TypedefType>(can) && "Invalid canonical type");
 }
 
@@ -1197,7 +1200,7 @@
   ElementType.getAsStringInternal(S);
 }
 
-void TypeOfExpr::getAsStringInternal(std::string &InnerString) const {
+void TypeOfExprType::getAsStringInternal(std::string &InnerString) const {
   if (!InnerString.empty())    // Prefix the basic type, e.g. 'typeof(e) X'.
     InnerString = ' ' + InnerString;
   std::string Str;
@@ -1214,7 +1217,7 @@
   InnerString = "typeof(" + Tmp + ")" + InnerString;
 }
 
-void FunctionTypeNoProto::getAsStringInternal(std::string &S) const {
+void FunctionNoProtoType::getAsStringInternal(std::string &S) const {
   // If needed for precedence reasons, wrap the inner part in grouping parens.
   if (!S.empty())
     S = "(" + S + ")";
@@ -1223,7 +1226,7 @@
   getResultType().getAsStringInternal(S);
 }
 
-void FunctionTypeProto::getAsStringInternal(std::string &S) const {
+void FunctionProtoType::getAsStringInternal(std::string &S) const {
   // If needed for precedence reasons, wrap the inner part in grouping parens.
   if (!S.empty())
     S = "(" + S + ")";