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/Driver/RewriteBlocks.cpp b/Driver/RewriteBlocks.cpp
index 75aa3c8..7eacc0a 100644
--- a/Driver/RewriteBlocks.cpp
+++ b/Driver/RewriteBlocks.cpp
@@ -141,7 +141,7 @@
   void RewriteProtocolDecl(ObjCProtocolDecl *PDecl);
   void RewriteMethodDecl(ObjCMethodDecl *MDecl);
 
-  void RewriteFunctionTypeProto(QualType funcType, NamedDecl *D);
+  void RewriteFunctionProtoType(QualType funcType, NamedDecl *D);
   void CheckFunctionPointerDecl(QualType dType, NamedDecl *ND);
   void RewriteCastExpr(CastExpr *CE);
   
@@ -370,12 +370,12 @@
 
   BlockDecl *BD = CE->getBlockDecl();
   
-  if (isa<FunctionTypeNoProto>(AFT)) {
+  if (isa<FunctionNoProtoType>(AFT)) {
     S += "()";
   } else if (BD->param_empty()) {
     S += "(" + StructRef + " *__cself)";
   } else {
-    const FunctionTypeProto *FT = cast<FunctionTypeProto>(AFT);
+    const FunctionProtoType *FT = cast<FunctionProtoType>(AFT);
     assert(FT && "SynthesizeBlockFunc: No function proto");
     S += '(';
     // first add the implicit argument.
@@ -689,7 +689,7 @@
   assert(CPT && "RewriteBlockClass: Bad type");
   const FunctionType *FT = CPT->getPointeeType()->getAsFunctionType();
   assert(FT && "RewriteBlockClass: Bad type");
-  const FunctionTypeProto *FTP = dyn_cast<FunctionTypeProto>(FT);
+  const FunctionProtoType *FTP = dyn_cast<FunctionProtoType>(FT);
   // FTP will be null for closures that don't take arguments.
   
   // Build a closure call - start with a paren expr to enforce precedence.
@@ -699,7 +699,7 @@
   BlockCall += "(" + Exp->getType().getAsString() + "(*)";
   BlockCall += "(struct __block_impl *";
   if (FTP) {
-    for (FunctionTypeProto::arg_type_iterator I = FTP->arg_type_begin(), 
+    for (FunctionProtoType::arg_type_iterator I = FTP->arg_type_begin(), 
          E = FTP->arg_type_end(); I && (I != E); ++I)
       BlockCall += ", " + (*I).getAsString();
   }
@@ -803,17 +803,17 @@
 }
 
 bool RewriteBlocks::PointerTypeTakesAnyBlockArguments(QualType QT) {
-  const FunctionTypeProto *FTP;
+  const FunctionProtoType *FTP;
   const PointerType *PT = QT->getAsPointerType();
   if (PT) {
-    FTP = PT->getPointeeType()->getAsFunctionTypeProto();
+    FTP = PT->getPointeeType()->getAsFunctionProtoType();
   } else {
     const BlockPointerType *BPT = QT->getAsBlockPointerType();
     assert(BPT && "BlockPointerTypeTakeAnyBlockArguments(): not a block pointer type");
-    FTP = BPT->getPointeeType()->getAsFunctionTypeProto();
+    FTP = BPT->getPointeeType()->getAsFunctionProtoType();
   }
   if (FTP) {
-    for (FunctionTypeProto::arg_type_iterator I = FTP->arg_type_begin(), 
+    for (FunctionProtoType::arg_type_iterator I = FTP->arg_type_begin(), 
          E = FTP->arg_type_end(); I != E; ++I)
       if (isBlockPointerType(*I))
         return true;
@@ -1049,9 +1049,9 @@
   return S;
 }
 
-void RewriteBlocks::RewriteFunctionTypeProto(QualType funcType, NamedDecl *D) {    
-  if (FunctionTypeProto *fproto = dyn_cast<FunctionTypeProto>(funcType)) {
-    for (FunctionTypeProto::arg_type_iterator I = fproto->arg_type_begin(), 
+void RewriteBlocks::RewriteFunctionProtoType(QualType funcType, NamedDecl *D) {    
+  if (FunctionProtoType *fproto = dyn_cast<FunctionProtoType>(funcType)) {
+    for (FunctionProtoType::arg_type_iterator I = fproto->arg_type_begin(), 
          E = fproto->arg_type_end(); I && (I != E); ++I)
       if (isBlockPointerType(*I)) {
         // All the args are checked/rewritten. Don't call twice!
@@ -1064,7 +1064,7 @@
 void RewriteBlocks::CheckFunctionPointerDecl(QualType funcType, NamedDecl *ND) {
   const PointerType *PT = funcType->getAsPointerType();
   if (PT && PointerTypeTakesAnyBlockArguments(funcType))
-    RewriteFunctionTypeProto(PT->getPointeeType(), ND);
+    RewriteFunctionProtoType(PT->getPointeeType(), ND);
 }
 
 /// HandleDeclInMainFile - This is called for each top-level decl defined in the
@@ -1074,7 +1074,7 @@
     // Since function prototypes don't have ParmDecl's, we check the function
     // prototype. This enables us to rewrite function declarations and
     // definitions using the same code.
-    RewriteFunctionTypeProto(FD->getType(), FD);
+    RewriteFunctionProtoType(FD->getType(), FD);
     
     if (Stmt *Body = FD->getBody()) {
       CurFunctionDef = FD;