GCC didn't care for my attempt at API compatibility, so brute-force everything
to the new constants.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112047 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Rewrite/RewriteObjC.cpp b/lib/Rewrite/RewriteObjC.cpp
index e91c31b..b3ba72d 100644
--- a/lib/Rewrite/RewriteObjC.cpp
+++ b/lib/Rewrite/RewriteObjC.cpp
@@ -443,7 +443,7 @@
 
   // Helper function: create a CStyleCastExpr with trivial type source info.
   CStyleCastExpr* NoTypeInfoCStyleCastExpr(ASTContext *Ctx, QualType Ty,
-                                           CastExpr::CastKind Kind, Expr *E) {
+                                           CastKind Kind, Expr *E) {
     TypeSourceInfo *TInfo = Ctx->getTrivialTypeSourceInfo(Ty, SourceLocation());
     return CStyleCastExpr::Create(*Ctx, Ty, Kind, E, 0, TInfo,
                                   SourceLocation(), SourceLocation());
@@ -1330,7 +1330,7 @@
       assert(RD && "RewriteObjCIvarRefExpr(): Can't find RecordDecl");
       QualType castT = Context->getPointerType(Context->getTagDeclType(RD));
       CastExpr *castExpr = NoTypeInfoCStyleCastExpr(Context, castT,
-                                                    CastExpr::CK_Unknown,
+                                                    CK_Unknown,
                                                     IV->getBase());
       // Don't forget the parens to enforce the proper binding.
       ParenExpr *PE = new (Context) ParenExpr(IV->getBase()->getLocStart(),
@@ -1375,7 +1375,7 @@
       assert(RD && "RewriteObjCIvarRefExpr(): Can't find RecordDecl");
       QualType castT = Context->getPointerType(Context->getTagDeclType(RD));
       CastExpr *castExpr = NoTypeInfoCStyleCastExpr(Context, castT,
-                                                    CastExpr::CK_Unknown,
+                                                    CK_Unknown,
                                                     IV->getBase());
       // Don't forget the parens to enforce the proper binding.
       ParenExpr *PE = new (Context) ParenExpr(IV->getBase()->getLocStart(),
@@ -1711,7 +1711,7 @@
   std::string syncBuf;
   syncBuf += " objc_sync_exit(";
   Expr *syncExpr = NoTypeInfoCStyleCastExpr(Context, Context->getObjCIdType(),
-                                            CastExpr::CK_Unknown,
+                                            CK_Unknown,
                                             S->getSynchExpr());
   std::string syncExprBufS;
   llvm::raw_string_ostream syncExprBuf(syncExprBufS);
@@ -2054,7 +2054,7 @@
   // Now, we cast the reference to a pointer to the objc_msgSend type.
   QualType pToFunc = Context->getPointerType(msgSendType);
   ImplicitCastExpr *ICE = 
-    ImplicitCastExpr::Create(*Context, pToFunc, CastExpr::CK_Unknown,
+    ImplicitCastExpr::Create(*Context, pToFunc, CK_Unknown,
                              DRE, 0, VK_RValue);
 
   const FunctionType *FT = msgSendType->getAs<FunctionType>();
@@ -2573,12 +2573,12 @@
                                     &Context->Idents.get(S), strType, 0,
                                     VarDecl::Static, VarDecl::None);
   DeclRefExpr *DRE = new (Context) DeclRefExpr(NewVD, strType, SourceLocation());
-  Expr *Unop = new (Context) UnaryOperator(DRE, UnaryOperator::AddrOf,
+  Expr *Unop = new (Context) UnaryOperator(DRE, UO_AddrOf,
                                  Context->getPointerType(DRE->getType()),
                                  SourceLocation());
   // cast to NSConstantString *
   CastExpr *cast = NoTypeInfoCStyleCastExpr(Context, Exp->getType(),
-                                            CastExpr::CK_Unknown, Unop);
+                                            CK_Unknown, Unop);
   ReplaceStmt(Exp, cast);
   // delete Exp; leak for now, see RewritePropertySetter() usage for more info.
   return cast;
@@ -2692,7 +2692,7 @@
     // set the receiver to self, the first argument to all methods.
     InitExprs.push_back(
       NoTypeInfoCStyleCastExpr(Context, Context->getObjCIdType(),
-                               CastExpr::CK_Unknown,
+                               CK_Unknown,
                    new (Context) DeclRefExpr(CurMethodDef->getSelfDecl(),
                                    Context->getObjCIdType(),
                                    SourceLocation()))
@@ -2713,7 +2713,7 @@
     // (Class)objc_getClass("CurrentClass")
     CastExpr *ArgExpr = NoTypeInfoCStyleCastExpr(Context,
                                              Context->getObjCClassType(),
-                                             CastExpr::CK_Unknown, Cls);
+                                             CK_Unknown, Cls);
     ClsExprs.clear();
     ClsExprs.push_back(ArgExpr);
     Cls = SynthesizeCallToFunctionDecl(GetSuperClassFunctionDecl,
@@ -2725,7 +2725,7 @@
     InitExprs.push_back( // set 'super class', using class_getSuperclass().
                         NoTypeInfoCStyleCastExpr(Context,
                                                  Context->getObjCIdType(),
-                                                 CastExpr::CK_Unknown, Cls));
+                                                 CK_Unknown, Cls));
     // struct objc_super
     QualType superType = getSuperStructType();
     Expr *SuperRep;
@@ -2744,12 +2744,12 @@
       // we need the cast below. For example:
       // (struct objc_super *)&__rw_objc_super((id)self, (id)objc_getClass("SUPER"))
       //
-      SuperRep = new (Context) UnaryOperator(SuperRep, UnaryOperator::AddrOf,
+      SuperRep = new (Context) UnaryOperator(SuperRep, UO_AddrOf,
                                Context->getPointerType(SuperRep->getType()),
                                SourceLocation());
       SuperRep = NoTypeInfoCStyleCastExpr(Context,
                                           Context->getPointerType(superType),
-                                          CastExpr::CK_Unknown, SuperRep);
+                                          CK_Unknown, SuperRep);
     } else {
       // (struct objc_super) { <exprs from above> }
       InitListExpr *ILE =
@@ -2761,7 +2761,7 @@
       SuperRep = new (Context) CompoundLiteralExpr(SourceLocation(), superTInfo,
                                                    superType, ILE, false);
       // struct objc_super *
-      SuperRep = new (Context) UnaryOperator(SuperRep, UnaryOperator::AddrOf,
+      SuperRep = new (Context) UnaryOperator(SuperRep, UO_AddrOf,
                                Context->getPointerType(SuperRep->getType()),
                                SourceLocation());
     }
@@ -2798,7 +2798,7 @@
 
     InitExprs.push_back(
       NoTypeInfoCStyleCastExpr(Context, Context->getObjCIdType(),
-                               CastExpr::CK_Unknown,
+                               CK_Unknown,
                    new (Context) DeclRefExpr(CurMethodDef->getSelfDecl(),
                                    Context->getObjCIdType(),
                                    SourceLocation()))
@@ -2818,7 +2818,7 @@
     // (Class)objc_getClass("CurrentClass")
     CastExpr *ArgExpr = NoTypeInfoCStyleCastExpr(Context,
                                                  Context->getObjCClassType(),
-                                                 CastExpr::CK_Unknown, Cls);
+                                                 CK_Unknown, Cls);
     ClsExprs.clear();
     ClsExprs.push_back(ArgExpr);
     Cls = SynthesizeCallToFunctionDecl(GetSuperClassFunctionDecl,
@@ -2830,7 +2830,7 @@
     InitExprs.push_back(
       // set 'super class', using class_getSuperclass().
       NoTypeInfoCStyleCastExpr(Context, Context->getObjCIdType(),
-                               CastExpr::CK_Unknown, Cls));
+                               CK_Unknown, Cls));
     // struct objc_super
     QualType superType = getSuperStructType();
     Expr *SuperRep;
@@ -2849,12 +2849,12 @@
       // we need the cast below. For example:
       // (struct objc_super *)&__rw_objc_super((id)self, (id)objc_getClass("SUPER"))
       //
-      SuperRep = new (Context) UnaryOperator(SuperRep, UnaryOperator::AddrOf,
+      SuperRep = new (Context) UnaryOperator(SuperRep, UO_AddrOf,
                                Context->getPointerType(SuperRep->getType()),
                                SourceLocation());
       SuperRep = NoTypeInfoCStyleCastExpr(Context,
                                Context->getPointerType(superType),
-                               CastExpr::CK_Unknown, SuperRep);
+                               CK_Unknown, SuperRep);
     } else {
       // (struct objc_super) { <exprs from above> }
       InitListExpr *ILE =
@@ -2877,7 +2877,7 @@
     while (CStyleCastExpr *CE = dyn_cast<CStyleCastExpr>(recExpr))
       recExpr = CE->getSubExpr();
     recExpr = NoTypeInfoCStyleCastExpr(Context, Context->getObjCIdType(),
-                                       CastExpr::CK_Unknown, recExpr);
+                                       CK_Unknown, recExpr);
     MsgExprs.push_back(recExpr);
     break;
   }
@@ -2907,7 +2907,7 @@
                                 : ICE->getType();
       // Make sure we convert "type (^)(...)" to "type (*)(...)".
       (void)convertBlockPointerToFunctionPointer(type);
-      userExpr = NoTypeInfoCStyleCastExpr(Context, type, CastExpr::CK_Unknown,
+      userExpr = NoTypeInfoCStyleCastExpr(Context, type, CK_Unknown,
                                           userExpr);
     }
     // Make id<P...> cast into an 'id' cast.
@@ -2916,7 +2916,7 @@
         while ((CE = dyn_cast<CStyleCastExpr>(userExpr)))
           userExpr = CE->getSubExpr();
         userExpr = NoTypeInfoCStyleCastExpr(Context, Context->getObjCIdType(),
-                                            CastExpr::CK_Unknown, userExpr);
+                                            CK_Unknown, userExpr);
       }
     }
     MsgExprs.push_back(userExpr);
@@ -2966,7 +2966,7 @@
   // xx.m:13: note: if this code is reached, the program will abort
   cast = NoTypeInfoCStyleCastExpr(Context,
                                   Context->getPointerType(Context->VoidTy),
-                                  CastExpr::CK_Unknown, DRE);
+                                  CK_Unknown, DRE);
 
   // Now do the "normal" pointer to function cast.
   QualType castType = Context->getFunctionType(returnType,
@@ -2976,7 +2976,7 @@
                                                false, false, 0, 0,
                                                FunctionType::ExtInfo());
   castType = Context->getPointerType(castType);
-  cast = NoTypeInfoCStyleCastExpr(Context, castType, CastExpr::CK_Unknown,
+  cast = NoTypeInfoCStyleCastExpr(Context, castType, CK_Unknown,
                                   cast);
 
   // Don't forget the parens to enforce the proper binding.
@@ -2999,7 +2999,7 @@
     // Need to cast objc_msgSend_stret to "void *" (see above comment).
     cast = NoTypeInfoCStyleCastExpr(Context,
                                     Context->getPointerType(Context->VoidTy),
-                                    CastExpr::CK_Unknown, STDRE);
+                                    CK_Unknown, STDRE);
     // Now do the "normal" pointer to function cast.
     castType = Context->getFunctionType(returnType,
       &ArgTypes[0], ArgTypes.size(),
@@ -3007,7 +3007,7 @@
                                         false, false, 0, 0,
                                         FunctionType::ExtInfo());
     castType = Context->getPointerType(castType);
-    cast = NoTypeInfoCStyleCastExpr(Context, castType, CastExpr::CK_Unknown,
+    cast = NoTypeInfoCStyleCastExpr(Context, castType, CK_Unknown,
                                     cast);
 
     // Don't forget the parens to enforce the proper binding.
@@ -3033,7 +3033,7 @@
                                                Context->IntTy,
                                                SourceLocation());
     BinaryOperator *lessThanExpr = new (Context) BinaryOperator(sizeofExpr, limit,
-                                                      BinaryOperator::LE,
+                                                      BO_LE,
                                                       Context->IntTy,
                                                       SourceLocation());
     // (sizeof(returnType) <= 8 ? objc_msgSend(...) : objc_msgSend_stret(...))
@@ -3082,11 +3082,11 @@
                                 ID, getProtocolType(), 0,
                                 VarDecl::Extern, VarDecl::None);
   DeclRefExpr *DRE = new (Context) DeclRefExpr(VD, getProtocolType(), SourceLocation());
-  Expr *DerefExpr = new (Context) UnaryOperator(DRE, UnaryOperator::AddrOf,
+  Expr *DerefExpr = new (Context) UnaryOperator(DRE, UO_AddrOf,
                              Context->getPointerType(DRE->getType()),
                              SourceLocation());
   CastExpr *castExpr = NoTypeInfoCStyleCastExpr(Context, DerefExpr->getType(),
-                                                CastExpr::CK_Unknown,
+                                                CK_Unknown,
                                                 DerefExpr);
   ReplaceStmt(Exp, castExpr);
   ProtocolExprDecls.insert(Exp->getProtocol());
@@ -4607,7 +4607,7 @@
   PtrToFuncCastType = Context->getPointerType(PtrToFuncCastType);
 
   CastExpr *BlkCast = NoTypeInfoCStyleCastExpr(Context, PtrBlock,
-                                               CastExpr::CK_Unknown,
+                                               CK_Unknown,
                                                const_cast<Expr*>(BlockExp));
   // Don't forget the parens to enforce the proper binding.
   ParenExpr *PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(),
@@ -4621,7 +4621,7 @@
                                             FD->getType());
 
   CastExpr *FunkCast = NoTypeInfoCStyleCastExpr(Context, PtrToFuncCastType,
-                                                CastExpr::CK_Unknown, ME);
+                                                CK_Unknown, ME);
   PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(), FunkCast);
 
   llvm::SmallVector<Expr*, 8> BlkExprs;
@@ -4696,7 +4696,7 @@
   if (VarDecl *Var = dyn_cast<VarDecl>(VD))
     if (!ImportedLocalExternalDecls.count(Var))
       return DRE;
-  Expr *Exp = new (Context) UnaryOperator(DRE, UnaryOperator::Deref,
+  Expr *Exp = new (Context) UnaryOperator(DRE, UO_Deref,
                                     DRE->getType(), DRE->getLocation());
   // Need parens to enforce precedence.
   ParenExpr *PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(), 
@@ -5188,7 +5188,7 @@
   DeclRefExpr *Arg = new (Context) DeclRefExpr(FD, FD->getType(),
                                                SourceLocation());
   CastExpr *castExpr = NoTypeInfoCStyleCastExpr(Context, Context->VoidPtrTy,
-                                                CastExpr::CK_Unknown, Arg);
+                                                CK_Unknown, Arg);
   InitExprs.push_back(castExpr);
 
   // Initialize the block descriptor.
@@ -5201,7 +5201,7 @@
   UnaryOperator *DescRefExpr = new (Context) UnaryOperator(
                                   new (Context) DeclRefExpr(NewVD, 
                                     Context->VoidPtrTy, SourceLocation()), 
-                                  UnaryOperator::AddrOf,
+                                  UO_AddrOf,
                                   Context->getPointerType(Context->VoidPtrTy), 
                                   SourceLocation());
   InitExprs.push_back(DescRefExpr); 
@@ -5219,21 +5219,21 @@
         if (HasLocalVariableExternalStorage(*I)) {
           QualType QT = (*I)->getType();
           QT = Context->getPointerType(QT);
-          Exp = new (Context) UnaryOperator(Exp, UnaryOperator::AddrOf, QT,
+          Exp = new (Context) UnaryOperator(Exp, UO_AddrOf, QT,
                                             SourceLocation());
         }
       } else if (isTopLevelBlockPointerType((*I)->getType())) {
         FD = SynthBlockInitFunctionDecl((*I)->getName());
         Arg = new (Context) DeclRefExpr(FD, FD->getType(), SourceLocation());
         Exp = NoTypeInfoCStyleCastExpr(Context, Context->VoidPtrTy,
-                                       CastExpr::CK_Unknown, Arg);
+                                       CK_Unknown, Arg);
       } else {
         FD = SynthBlockInitFunctionDecl((*I)->getName());
         Exp = new (Context) DeclRefExpr(FD, FD->getType(), SourceLocation());
         if (HasLocalVariableExternalStorage(*I)) {
           QualType QT = (*I)->getType();
           QT = Context->getPointerType(QT);
-          Exp = new (Context) UnaryOperator(Exp, UnaryOperator::AddrOf, QT, 
+          Exp = new (Context) UnaryOperator(Exp, UO_AddrOf, QT, 
                                             SourceLocation());
         }
         
@@ -5256,10 +5256,10 @@
       
       FD = SynthBlockInitFunctionDecl((*I)->getName());
       Exp = new (Context) DeclRefExpr(FD, FD->getType(), SourceLocation());
-      Exp = new (Context) UnaryOperator(Exp, UnaryOperator::AddrOf,
+      Exp = new (Context) UnaryOperator(Exp, UO_AddrOf,
                               Context->getPointerType(Exp->getType()),
                               SourceLocation());
-      Exp = NoTypeInfoCStyleCastExpr(Context, castT, CastExpr::CK_Unknown, Exp);
+      Exp = NoTypeInfoCStyleCastExpr(Context, castT, CK_Unknown, Exp);
       InitExprs.push_back(Exp);
     }
   }
@@ -5274,10 +5274,10 @@
   }
   NewRep = new (Context) CallExpr(*Context, DRE, &InitExprs[0], InitExprs.size(),
                                   FType, SourceLocation());
-  NewRep = new (Context) UnaryOperator(NewRep, UnaryOperator::AddrOf,
+  NewRep = new (Context) UnaryOperator(NewRep, UO_AddrOf,
                              Context->getPointerType(NewRep->getType()),
                              SourceLocation());
-  NewRep = NoTypeInfoCStyleCastExpr(Context, FType, CastExpr::CK_Unknown,
+  NewRep = NoTypeInfoCStyleCastExpr(Context, FType, CK_Unknown,
                                     NewRep);
   BlockDeclRefs.clear();
   BlockByRefDecls.clear();