Update Clang for 3.5 rebase (r209713).

Change-Id: I8c9133b0f8f776dc915f270b60f94962e771bc83
diff --git a/lib/Rewrite/Frontend/RewriteModernObjC.cpp b/lib/Rewrite/Frontend/RewriteModernObjC.cpp
index 9066a5f..3cacbdd 100644
--- a/lib/Rewrite/Frontend/RewriteModernObjC.cpp
+++ b/lib/Rewrite/Frontend/RewriteModernObjC.cpp
@@ -280,7 +280,7 @@
       // Get the new text.
       std::string SStr;
       llvm::raw_string_ostream S(SStr);
-      New->printPretty(S, 0, PrintingPolicy(LangOpts));
+      New->printPretty(S, nullptr, PrintingPolicy(LangOpts));
       const std::string &Str = S.str();
 
       // If replacement succeeded or warning disabled return with no warning.
@@ -598,14 +598,14 @@
     CStyleCastExpr* NoTypeInfoCStyleCastExpr(ASTContext *Ctx, QualType Ty,
                                              CastKind Kind, Expr *E) {
       TypeSourceInfo *TInfo = Ctx->getTrivialTypeSourceInfo(Ty, SourceLocation());
-      return CStyleCastExpr::Create(*Ctx, Ty, VK_RValue, Kind, E, 0, TInfo,
-                                    SourceLocation(), SourceLocation());
+      return CStyleCastExpr::Create(*Ctx, Ty, VK_RValue, Kind, E, nullptr,
+                                    TInfo, SourceLocation(), SourceLocation());
     }
     
     bool ImplementationIsNonLazy(const ObjCImplDecl *OD) const {
       IdentifierInfo* II = &Context->Idents.get("load");
       Selector LoadSel = Context->Selectors.getSelector(0, &II);
-      return OD->getClassMethod(LoadSel) != 0;
+      return OD->getClassMethod(LoadSel) != nullptr;
     }
 
     StringLiteral *getStringLiteral(StringRef Str) {
@@ -686,30 +686,30 @@
   Context = &context;
   SM = &Context->getSourceManager();
   TUDecl = Context->getTranslationUnitDecl();
-  MsgSendFunctionDecl = 0;
-  MsgSendSuperFunctionDecl = 0;
-  MsgSendStretFunctionDecl = 0;
-  MsgSendSuperStretFunctionDecl = 0;
-  MsgSendFpretFunctionDecl = 0;
-  GetClassFunctionDecl = 0;
-  GetMetaClassFunctionDecl = 0;
-  GetSuperClassFunctionDecl = 0;
-  SelGetUidFunctionDecl = 0;
-  CFStringFunctionDecl = 0;
-  ConstantStringClassReference = 0;
-  NSStringRecord = 0;
-  CurMethodDef = 0;
-  CurFunctionDef = 0;
-  GlobalVarDecl = 0;
-  GlobalConstructionExp = 0;
-  SuperStructDecl = 0;
-  ProtocolTypeDecl = 0;
-  ConstantStringDecl = 0;
+  MsgSendFunctionDecl = nullptr;
+  MsgSendSuperFunctionDecl = nullptr;
+  MsgSendStretFunctionDecl = nullptr;
+  MsgSendSuperStretFunctionDecl = nullptr;
+  MsgSendFpretFunctionDecl = nullptr;
+  GetClassFunctionDecl = nullptr;
+  GetMetaClassFunctionDecl = nullptr;
+  GetSuperClassFunctionDecl = nullptr;
+  SelGetUidFunctionDecl = nullptr;
+  CFStringFunctionDecl = nullptr;
+  ConstantStringClassReference = nullptr;
+  NSStringRecord = nullptr;
+  CurMethodDef = nullptr;
+  CurFunctionDef = nullptr;
+  GlobalVarDecl = nullptr;
+  GlobalConstructionExp = nullptr;
+  SuperStructDecl = nullptr;
+  ProtocolTypeDecl = nullptr;
+  ConstantStringDecl = nullptr;
   BcLabelCount = 0;
-  SuperConstructorFunctionDecl = 0;
+  SuperConstructorFunctionDecl = nullptr;
   NumObjCStringLiterals = 0;
-  PropParentMap = 0;
-  CurrentBody = 0;
+  PropParentMap = nullptr;
+  CurrentBody = nullptr;
   DisableReplaceStmt = false;
   objc_impl_method = false;
 
@@ -894,11 +894,11 @@
       Zero = NoTypeInfoCStyleCastExpr(Context, PtrStructIMPL, CK_BitCast, Zero);
       ParenExpr *PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(),
                                               Zero);
-      FieldDecl *FD = FieldDecl::Create(*Context, 0, SourceLocation(),
+      FieldDecl *FD = FieldDecl::Create(*Context, nullptr, SourceLocation(),
                                         SourceLocation(),
                                         &Context->Idents.get(D->getNameAsString()),
-                                        IvarT, 0,
-                                        /*BitWidth=*/0, /*Mutable=*/true,
+                                        IvarT, nullptr,
+                                        /*BitWidth=*/nullptr, /*Mutable=*/true,
                                         ICIS_NoInit);
       MemberExpr *ME = new (Context) MemberExpr(PE, true, FD, SourceLocation(),
                                                 FD->getType(), VK_LValue,
@@ -981,7 +981,7 @@
     if (GenGetProperty) {
       // return objc_getProperty(self, _cmd, offsetof(ClassDecl, OID), 1)
       Getr += "typedef ";
-      const FunctionType *FPRetType = 0;
+      const FunctionType *FPRetType = nullptr;
       RewriteTypeIntoString(PD->getGetterMethodDecl()->getReturnType(), Getr,
                             FPRetType);
       Getr += " _TYPE";
@@ -1266,7 +1266,7 @@
                                         ObjCMethodDecl *OMD,
                                         std::string &ResultStr) {
   //fprintf(stderr,"In RewriteObjCMethodDecl\n");
-  const FunctionType *FPRetType = 0;
+  const FunctionType *FPRetType = nullptr;
   ResultStr += "\nstatic ";
   RewriteTypeIntoString(OMD->getReturnType(), ResultStr, FPRetType);
   ResultStr += " ";
@@ -1458,7 +1458,7 @@
     DisableReplaceStmtScope S(*this);
 
     // Rebuild the base expression if we have one.
-    Base = 0;
+    Base = nullptr;
     if (OldMsg->getReceiverKind() == ObjCMessageExpr::Instance) {
       Base = OldMsg->getInstanceReceiver();
       Base = cast<OpaqueValueExpr>(Base)->getSourceExpr();
@@ -1479,7 +1479,7 @@
   SmallVector<SourceLocation, 1> SelLocs;
   OldMsg->getSelectorLocs(SelLocs);
 
-  ObjCMessageExpr *NewMsg = 0;
+  ObjCMessageExpr *NewMsg = nullptr;
   switch (OldMsg->getReceiverKind()) {
   case ObjCMessageExpr::Class:
     NewMsg = ObjCMessageExpr::Create(*Context, OldMsg->getType(),
@@ -1539,7 +1539,7 @@
 
   // Because the rewriter doesn't allow us to rewrite rewritten code,
   // we need to suppress rewriting the sub-statements.
-  Expr *Base = 0;
+  Expr *Base = nullptr;
   SmallVector<Expr*, 1> Args;
   {
     DisableReplaceStmtScope S(*this);
@@ -1562,7 +1562,7 @@
   // Intentionally empty.
   SmallVector<SourceLocation, 1> SelLocs;
 
-  ObjCMessageExpr *NewMsg = 0;
+  ObjCMessageExpr *NewMsg = nullptr;
   switch (OldMsg->getReceiverKind()) {
   case ObjCMessageExpr::Class:
     NewMsg = ObjCMessageExpr::Create(*Context, OldMsg->getType(),
@@ -1646,7 +1646,7 @@
   buf += utostr(ObjCBcLabelNo.back());
   ReplaceText(startLoc, strlen("break"), buf);
 
-  return 0;
+  return nullptr;
 }
 
 void RewriteModernObjC::ConvertSourceLocationToLineDirective(
@@ -1676,7 +1676,7 @@
   buf += utostr(ObjCBcLabelNo.back());
   ReplaceText(startLoc, strlen("continue"), buf);
 
-  return 0;
+  return nullptr;
 }
 
 /// RewriteObjCForCollectionStmt - Rewriter for ObjC2's foreach statement.
@@ -1875,7 +1875,7 @@
   }
   Stmts.pop_back();
   ObjCBcLabelNo.pop_back();
-  return 0;
+  return nullptr;
 }
 
 static void Write_RethrowObject(std::string &buf) {
@@ -1937,7 +1937,7 @@
 
   ReplaceText(startRBraceLoc, 1, buf);
 
-  return 0;
+  return nullptr;
 }
 
 void RewriteModernObjC::WarnAboutReturnGotoStmts(Stmt *S)
@@ -1959,8 +1959,8 @@
   ReplaceText(startLoc, strlen("@autoreleasepool"), "/* @autoreleasepool */");
   ReplaceText(S->getSubStmt()->getLocStart(), 1, 
               "{ __AtAutoreleasePool __autoreleasepool; ");
-  
-  return 0;
+
+  return nullptr;
 }
 
 Stmt *RewriteModernObjC::RewriteObjCTryStmt(ObjCAtTryStmt *S) {
@@ -2061,7 +2061,7 @@
     WarnAboutReturnGotoStmts(S->getTryBody());
   }
 
-  return 0;
+  return nullptr;
 }
 
 // This can't be done with ReplaceStmt(S, ThrowExpr), since
@@ -2093,7 +2093,7 @@
   SourceLocation semiLoc = startLoc.getLocWithOffset(semiBuf-startBuf);
   if (S->getThrowExpr())
     ReplaceText(semiLoc, 1, ");");
-  return 0;
+  return nullptr;
 }
 
 Stmt *RewriteModernObjC::RewriteAtEncode(ObjCEncodeExpr *Exp) {
@@ -2136,7 +2136,7 @@
   QualType pToFunc = Context->getPointerType(msgSendType);
   ImplicitCastExpr *ICE = 
     ImplicitCastExpr::Create(*Context, pToFunc, CK_FunctionToPointerDecay,
-                             DRE, 0, VK_RValue);
+                             DRE, nullptr, VK_RValue);
 
   const FunctionType *FT = msgSendType->getAs<FunctionType>();
 
@@ -2212,7 +2212,7 @@
 
     const char *startBuf = SM->getCharacterData(Loc);
     const char *endBuf = SM->getCharacterData(EndLoc);
-    const char *startRef = 0, *endRef = 0;
+    const char *startRef = nullptr, *endRef = nullptr;
     if (scanForProtocolRefs(startBuf, endBuf, startRef, endRef)) {
       // Get the locations of the startRef, endRef.
       SourceLocation LessLoc = Loc.getLocWithOffset(startRef-startBuf);
@@ -2227,7 +2227,7 @@
 void RewriteModernObjC::RewriteObjCQualifiedInterfaceTypes(Decl *Dcl) {
   SourceLocation Loc;
   QualType Type;
-  const FunctionProtoType *proto = 0;
+  const FunctionProtoType *proto = nullptr;
   if (VarDecl *VD = dyn_cast<VarDecl>(Dcl)) {
     Loc = VD->getLocation();
     Type = VD->getType();
@@ -2261,7 +2261,7 @@
     const char *startBuf = endBuf;
     while (*startBuf != ';' && *startBuf != '<' && startBuf != MainFileStart)
       startBuf--; // scan backward (from the decl location) for return type.
-    const char *startRef = 0, *endRef = 0;
+    const char *startRef = nullptr, *endRef = nullptr;
     if (scanForProtocolRefs(startBuf, endBuf, startRef, endRef)) {
       // Get the locations of the startRef, endRef.
       SourceLocation LessLoc = Loc.getLocWithOffset(startRef-endBuf);
@@ -2283,7 +2283,7 @@
       const char *endBuf = startBuf;
       // scan forward (from the decl location) for argument types.
       scanToNextArgument(endBuf);
-      const char *startRef = 0, *endRef = 0;
+      const char *startRef = nullptr, *endRef = nullptr;
       if (scanForProtocolRefs(startBuf, endBuf, startRef, endRef)) {
         // Get the locations of the startRef, endRef.
         SourceLocation LessLoc =
@@ -2352,8 +2352,8 @@
   SelGetUidFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
                                                SourceLocation(),
                                                SourceLocation(),
-                                               SelGetUidIdent, getFuncType, 0,
-                                               SC_Extern);
+                                               SelGetUidIdent, getFuncType,
+                                               nullptr, SC_Extern);
 }
 
 void RewriteModernObjC::RewriteFunctionDecl(FunctionDecl *FD) {
@@ -2451,7 +2451,7 @@
                                                      SourceLocation(),
                                                      SourceLocation(),
                                                      msgSendIdent, msgSendType,
-                                                     0, SC_Extern);
+                                                     nullptr, SC_Extern);
 }
 
 // SynthMsgSendFunctionDecl - id objc_msgSend(id self, SEL op, ...);
@@ -2469,7 +2469,7 @@
   MsgSendFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
                                              SourceLocation(),
                                              SourceLocation(),
-                                             msgSendIdent, msgSendType, 0,
+                                             msgSendIdent, msgSendType, nullptr,
                                              SC_Extern);
 }
 
@@ -2483,8 +2483,8 @@
   MsgSendSuperFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
                                                   SourceLocation(),
                                                   SourceLocation(),
-                                                  msgSendIdent, msgSendType, 0,
-                                                  SC_Extern);
+                                                  msgSendIdent, msgSendType,
+                                                  nullptr, SC_Extern);
 }
 
 // SynthMsgSendStretFunctionDecl - id objc_msgSend_stret(id self, SEL op, ...);
@@ -2502,8 +2502,8 @@
   MsgSendStretFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
                                                   SourceLocation(),
                                                   SourceLocation(),
-                                                  msgSendIdent, msgSendType, 0,
-                                                  SC_Extern);
+                                                  msgSendIdent, msgSendType,
+                                                  nullptr, SC_Extern);
 }
 
 // SynthMsgSendSuperStretFunctionDecl -
@@ -2519,7 +2519,7 @@
                                                        SourceLocation(),
                                                        SourceLocation(),
                                                        msgSendIdent,
-                                                       msgSendType, 0,
+                                                       msgSendType, nullptr,
                                                        SC_Extern);
 }
 
@@ -2538,8 +2538,8 @@
   MsgSendFpretFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
                                                   SourceLocation(),
                                                   SourceLocation(),
-                                                  msgSendIdent, msgSendType, 0,
-                                                  SC_Extern);
+                                                  msgSendIdent, msgSendType,
+                                                  nullptr, SC_Extern);
 }
 
 // SynthGetClassFunctionDecl - Class objc_getClass(const char *name);
@@ -2552,8 +2552,8 @@
   GetClassFunctionDecl = FunctionDecl::Create(*Context, TUDecl,
                                               SourceLocation(),
                                               SourceLocation(),
-                                              getClassIdent, getClassType, 0,
-                                              SC_Extern);
+                                              getClassIdent, getClassType,
+                                              nullptr, SC_Extern);
 }
 
 // SynthGetSuperClassFunctionDecl - Class class_getSuperclass(Class cls);
@@ -2568,7 +2568,7 @@
                                                    SourceLocation(),
                                                    SourceLocation(),
                                                    getSuperClassIdent,
-                                                   getClassType, 0,
+                                                   getClassType, nullptr,
                                                    SC_Extern);
 }
 
@@ -2583,7 +2583,7 @@
                                                   SourceLocation(),
                                                   SourceLocation(),
                                                   getClassIdent, getClassType,
-                                                  0, SC_Extern);
+                                                  nullptr, SC_Extern);
 }
 
 Stmt *RewriteModernObjC::RewriteObjCStringLiteral(ObjCStringLiteral *Exp) {
@@ -2609,14 +2609,14 @@
   // The pretty printer for StringLiteral handles escape characters properly.
   std::string prettyBufS;
   llvm::raw_string_ostream prettyBuf(prettyBufS);
-  Exp->getString()->printPretty(prettyBuf, 0, PrintingPolicy(LangOpts));
+  Exp->getString()->printPretty(prettyBuf, nullptr, PrintingPolicy(LangOpts));
   Preamble += prettyBuf.str();
   Preamble += ",";
   Preamble += utostr(Exp->getString()->getByteLength()) + "};\n";
 
   VarDecl *NewVD = VarDecl::Create(*Context, TUDecl, SourceLocation(),
                                    SourceLocation(), &Context->Idents.get(S),
-                                   strType, 0, SC_Static);
+                                   strType, nullptr, SC_Static);
   DeclRefExpr *DRE = new (Context) DeclRefExpr(NewVD, false, strType, VK_LValue,
                                                SourceLocation());
   Expr *Unop = new (Context) UnaryOperator(DRE, UO_AddrOf,
@@ -2770,13 +2770,13 @@
   Expr *NSArrayCallExpr = 
     new (Context) CallExpr(*Context, NSArrayDRE, InitExprs,
                            NSArrayFType, VK_LValue, SourceLocation());
-  
-  FieldDecl *ARRFD = FieldDecl::Create(*Context, 0, SourceLocation(),
+
+  FieldDecl *ARRFD = FieldDecl::Create(*Context, nullptr, SourceLocation(),
                                     SourceLocation(),
                                     &Context->Idents.get("arr"),
-                                    Context->getPointerType(Context->VoidPtrTy), 0,
-                                    /*BitWidth=*/0, /*Mutable=*/true,
-                                    ICIS_NoInit);
+                                    Context->getPointerType(Context->VoidPtrTy),
+                                    nullptr, /*BitWidth=*/nullptr,
+                                    /*Mutable=*/true, ICIS_NoInit);
   MemberExpr *ArrayLiteralME = 
     new (Context) MemberExpr(NSArrayCallExpr, false, ARRFD, 
                              SourceLocation(),
@@ -2907,13 +2907,13 @@
   Expr *NSValueCallExpr = 
     new (Context) CallExpr(*Context, NSDictDRE, ValueExprs,
                            NSDictFType, VK_LValue, SourceLocation());
-  
-  FieldDecl *ARRFD = FieldDecl::Create(*Context, 0, SourceLocation(),
+
+  FieldDecl *ARRFD = FieldDecl::Create(*Context, nullptr, SourceLocation(),
                                        SourceLocation(),
                                        &Context->Idents.get("arr"),
-                                       Context->getPointerType(Context->VoidPtrTy), 0,
-                                       /*BitWidth=*/0, /*Mutable=*/true,
-                                       ICIS_NoInit);
+                                       Context->getPointerType(Context->VoidPtrTy),
+                                       nullptr, /*BitWidth=*/nullptr,
+                                       /*Mutable=*/true, ICIS_NoInit);
   MemberExpr *DictLiteralValueME = 
     new (Context) MemberExpr(NSValueCallExpr, false, ARRFD, 
                              SourceLocation(),
@@ -3045,9 +3045,9 @@
     for (unsigned i = 0; i < 2; ++i) {
       SuperStructDecl->addDecl(FieldDecl::Create(*Context, SuperStructDecl,
                                                  SourceLocation(),
-                                                 SourceLocation(), 0,
-                                                 FieldTypes[i], 0,
-                                                 /*BitWidth=*/0,
+                                                 SourceLocation(), nullptr,
+                                                 FieldTypes[i], nullptr,
+                                                 /*BitWidth=*/nullptr,
                                                  /*Mutable=*/false,
                                                  ICIS_NoInit));
     }
@@ -3078,9 +3078,9 @@
       ConstantStringDecl->addDecl(FieldDecl::Create(*Context,
                                                     ConstantStringDecl,
                                                     SourceLocation(),
-                                                    SourceLocation(), 0,
-                                                    FieldTypes[i], 0,
-                                                    /*BitWidth=*/0,
+                                                    SourceLocation(), nullptr,
+                                                    FieldTypes[i], nullptr,
+                                                    /*BitWidth=*/nullptr,
                                                     /*Mutable=*/true,
                                                     ICIS_NoInit));
     }
@@ -3231,19 +3231,19 @@
   // AST for __Stretn(receiver, args).s;
   IdentifierInfo *ID = &Context->Idents.get(name);
   FunctionDecl *FD = FunctionDecl::Create(*Context, TUDecl, SourceLocation(),
-                                          SourceLocation(), ID, castType, 0,
-                                          SC_Extern, false, false);
+                                          SourceLocation(), ID, castType,
+                                          nullptr, SC_Extern, false, false);
   DeclRefExpr *DRE = new (Context) DeclRefExpr(FD, false, castType, VK_RValue,
                                                SourceLocation());
   CallExpr *STCE = new (Context) CallExpr(*Context, DRE, MsgExprs,
                                           castType, VK_LValue, SourceLocation());
-  
-  FieldDecl *FieldD = FieldDecl::Create(*Context, 0, SourceLocation(),
+
+  FieldDecl *FieldD = FieldDecl::Create(*Context, nullptr, SourceLocation(),
                                     SourceLocation(),
                                     &Context->Idents.get("s"),
-                                    returnType, 0,
-                                    /*BitWidth=*/0, /*Mutable=*/true,
-                                    ICIS_NoInit);
+                                    returnType, nullptr,
+                                    /*BitWidth=*/nullptr,
+                                    /*Mutable=*/true, ICIS_NoInit);
   MemberExpr *ME = new (Context) MemberExpr(STCE, false, FieldD, SourceLocation(),
                                             FieldD->getType(), VK_LValue,
                                             OK_Ordinary);
@@ -3276,7 +3276,7 @@
   // default to objc_msgSend().
   FunctionDecl *MsgSendFlavor = MsgSendFunctionDecl;
   // May need to use objc_msgSend_stret() as well.
-  FunctionDecl *MsgSendStretFlavor = 0;
+  FunctionDecl *MsgSendStretFlavor = nullptr;
   if (ObjCMethodDecl *mDecl = Exp->getMethodDecl()) {
     QualType resultType = mDecl->getReturnType();
     if (resultType->isRecordType())
@@ -3659,8 +3659,8 @@
                       Exp->getProtocol()->getNameAsString();
   IdentifierInfo *ID = &Context->Idents.get(Name);
   VarDecl *VD = VarDecl::Create(*Context, TUDecl, SourceLocation(),
-                                SourceLocation(), ID, getProtocolType(), 0,
-                                SC_Extern);
+                                SourceLocation(), ID, getProtocolType(),
+                                nullptr, SC_Extern);
   DeclRefExpr *DRE = new (Context) DeclRefExpr(VD, false, getProtocolType(),
                                                VK_LValue, SourceLocation());
   CastExpr *castExpr =
@@ -3834,8 +3834,8 @@
     Type = Context->getBaseElementType(Type);
   ObjCContainerDecl *IDecl = 
     dyn_cast<ObjCContainerDecl>(fieldDecl->getDeclContext());
-  
-  TagDecl *TD = 0;
+
+  TagDecl *TD = nullptr;
   if (Type->isRecordType()) {
     TD = Type->getAs<RecordType>()->getDecl();
   }
@@ -3896,8 +3896,8 @@
     RD->addDecl(FieldDecl::Create(*Context, RD, SourceLocation(), SourceLocation(),
                                   &Context->Idents.get(Ivar->getName()),
                                   Ivar->getType(),
-                                  0, /*Expr *BW */Ivar->getBitWidth(), false,
-                                  ICIS_NoInit));
+                                  nullptr, /*Expr *BW */Ivar->getBitWidth(),
+                                  false, ICIS_NoInit));
   }
   RD->completeDefinition();
   return Context->getTagDeclType(RD);
@@ -4527,12 +4527,12 @@
     std::string SStr;
   
     llvm::raw_string_ostream constructorExprBuf(SStr);
-    GlobalConstructionExp->printPretty(constructorExprBuf, 0,
-                                         PrintingPolicy(LangOpts));
+    GlobalConstructionExp->printPretty(constructorExprBuf, nullptr,
+                                       PrintingPolicy(LangOpts));
     globalBuf += constructorExprBuf.str();
     globalBuf += ";\n";
     InsertText(FunLocStart, globalBuf);
-    GlobalConstructionExp = 0;
+    GlobalConstructionExp = nullptr;
   }
 
   Blocks.clear();
@@ -4675,7 +4675,7 @@
 
 Stmt *RewriteModernObjC::SynthesizeBlockCall(CallExpr *Exp, const Expr *BlockExp) {
   // Navigate to relevant type information.
-  const BlockPointerType *CPT = 0;
+  const BlockPointerType *CPT = nullptr;
 
   if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(BlockExp)) {
     CPT = DRE->getType()->getAs<BlockPointerType>();
@@ -4746,11 +4746,11 @@
                                           BlkCast);
   //PE->dump();
 
-  FieldDecl *FD = FieldDecl::Create(*Context, 0, SourceLocation(),
+  FieldDecl *FD = FieldDecl::Create(*Context, nullptr, SourceLocation(),
                                     SourceLocation(),
                                     &Context->Idents.get("FuncPtr"),
-                                    Context->VoidPtrTy, 0,
-                                    /*BitWidth=*/0, /*Mutable=*/true,
+                                    Context->VoidPtrTy, nullptr,
+                                    /*BitWidth=*/nullptr, /*Mutable=*/true,
                                     ICIS_NoInit);
   MemberExpr *ME = new (Context) MemberExpr(PE, true, FD, SourceLocation(),
                                             FD->getType(), VK_LValue,
@@ -4793,12 +4793,12 @@
   // for each DeclRefExp where BYREFVAR is name of the variable.
   ValueDecl *VD = DeclRefExp->getDecl();
   bool isArrow = DeclRefExp->refersToEnclosingLocal();
-  
-  FieldDecl *FD = FieldDecl::Create(*Context, 0, SourceLocation(),
+
+  FieldDecl *FD = FieldDecl::Create(*Context, nullptr, SourceLocation(),
                                     SourceLocation(),
                                     &Context->Idents.get("__forwarding"), 
-                                    Context->VoidPtrTy, 0,
-                                    /*BitWidth=*/0, /*Mutable=*/true,
+                                    Context->VoidPtrTy, nullptr,
+                                    /*BitWidth=*/nullptr, /*Mutable=*/true,
                                     ICIS_NoInit);
   MemberExpr *ME = new (Context) MemberExpr(DeclRefExp, isArrow,
                                             FD, SourceLocation(),
@@ -4806,10 +4806,10 @@
                                             OK_Ordinary);
 
   StringRef Name = VD->getName();
-  FD = FieldDecl::Create(*Context, 0, SourceLocation(), SourceLocation(),
+  FD = FieldDecl::Create(*Context, nullptr, SourceLocation(), SourceLocation(),
                          &Context->Idents.get(Name), 
-                         Context->VoidPtrTy, 0,
-                         /*BitWidth=*/0, /*Mutable=*/true,
+                         Context->VoidPtrTy, nullptr,
+                         /*BitWidth=*/nullptr, /*Mutable=*/true,
                          ICIS_NoInit);
   ME = new (Context) MemberExpr(ME, true, FD, SourceLocation(),
                                 DeclRefExp->getType(), VK_LValue, OK_Ordinary);
@@ -5214,7 +5214,7 @@
   // struct __Block_byref_ND ND = 
   // {0, &ND, some_flag, __size=sizeof(struct __Block_byref_ND), 
   //  initializer-if-any};
-  bool hasInit = (ND->getInit() != 0);
+  bool hasInit = (ND->getInit() != nullptr);
   // FIXME. rewriter does not support __block c++ objects which
   // require construction.
   if (hasInit)
@@ -5328,7 +5328,7 @@
   IdentifierInfo *ID = &Context->Idents.get(name);
   QualType FType = Context->getFunctionNoProtoType(Context->VoidPtrTy);
   return FunctionDecl::Create(*Context, TUDecl, SourceLocation(),
-                              SourceLocation(), ID, FType, 0, SC_Extern,
+                              SourceLocation(), ID, FType, nullptr, SC_Extern,
                               false, false);
 }
 
@@ -5429,7 +5429,7 @@
   VarDecl *NewVD = VarDecl::Create(*Context, TUDecl,
                                    SourceLocation(), SourceLocation(),
                                    &Context->Idents.get(DescData.c_str()),
-                                   Context->VoidPtrTy, 0,
+                                   Context->VoidPtrTy, nullptr,
                                    SC_Static);
   UnaryOperator *DescRefExpr =
     new (Context) UnaryOperator(new (Context) DeclRefExpr(NewVD, false,
@@ -5531,7 +5531,7 @@
                                   FType, VK_LValue, SourceLocation());
   
   if (GlobalBlockExpr) {
-    assert (GlobalConstructionExp == 0 && 
+    assert (!GlobalConstructionExp &&
             "SynthBlockInitExpr - GlobalConstructionExp must be null");
     GlobalConstructionExp = NewRep;
     NewRep = DRE;
@@ -5607,7 +5607,7 @@
     // Rewrite the block body in place.
     Stmt *SaveCurrentBody = CurrentBody;
     CurrentBody = BE->getBody();
-    PropParentMap = 0;
+    PropParentMap = nullptr;
     // block literal on rhs of a property-dot-sytax assignment
     // must be replaced by its synthesize ast so getRewrittenText
     // works as expected. In this case, what actually ends up on RHS
@@ -5618,7 +5618,7 @@
     RewriteFunctionBodyOrGlobalInitializer(BE->getBody());
     DisableReplaceStmt = saveDisableReplaceStmt;
     CurrentBody = SaveCurrentBody;
-    PropParentMap = 0;
+    PropParentMap = nullptr;
     ImportedLocalExternalDecls.clear();
     // Now we snarf the rewritten text and stash it away for later use.
     std::string Str = Rewrite.getRewrittenText(BE->getSourceRange());
@@ -5838,16 +5838,16 @@
         Body =
         cast_or_null<CompoundStmt>(RewriteFunctionBodyOrGlobalInitializer(Body));
         FD->setBody(Body);
-        CurrentBody = 0;
+        CurrentBody = nullptr;
         if (PropParentMap) {
           delete PropParentMap;
-          PropParentMap = 0;
+          PropParentMap = nullptr;
         }
         // This synthesizes and inserts the block "impl" struct, invoke function,
         // and any copy/dispose helper functions.
         InsertBlockLiteralsWithinFunction(FD);
         RewriteLineDirective(D);
-        CurFunctionDef = 0;
+        CurFunctionDef = nullptr;
       }
       break;
     }
@@ -5859,14 +5859,14 @@
         Body =
           cast_or_null<CompoundStmt>(RewriteFunctionBodyOrGlobalInitializer(Body));
         MD->setBody(Body);
-        CurrentBody = 0;
+        CurrentBody = nullptr;
         if (PropParentMap) {
           delete PropParentMap;
-          PropParentMap = 0;
+          PropParentMap = nullptr;
         }
         InsertBlockLiteralsWithinMethod(MD);
         RewriteLineDirective(D);
-        CurMethodDef = 0;
+        CurMethodDef = nullptr;
       }
       break;
     }
@@ -5901,14 +5901,14 @@
         GlobalVarDecl = VD;
         CurrentBody = VD->getInit();
         RewriteFunctionBodyOrGlobalInitializer(VD->getInit());
-        CurrentBody = 0;
+        CurrentBody = nullptr;
         if (PropParentMap) {
           delete PropParentMap;
-          PropParentMap = 0;
+          PropParentMap = nullptr;
         }
         SynthesizeBlockLiterals(VD->getTypeSpecStartLoc(), VD->getName());
-        GlobalVarDecl = 0;
-          
+        GlobalVarDecl = nullptr;
+
         // This is needed for blocks.
         if (CStyleCastExpr *CE = dyn_cast<CStyleCastExpr>(VD->getInit())) {
             RewriteCastExpr(CE);
@@ -6108,7 +6108,7 @@
   Preamble += "  int *isa;\n";
   Preamble += "  int flags;\n";
   Preamble += "  char *str;\n";
-  Preamble += "#if __LLP64__\n";
+  Preamble += "#if _WIN64\n";
   Preamble += "  long long length;\n";
   Preamble += "#else\n";
   Preamble += "  long length;\n";
@@ -7045,10 +7045,10 @@
   // Protocol's property metadata.
   SmallVector<ObjCPropertyDecl *, 8> ProtocolProperties(PDecl->properties());
   Write_prop_list_t_initializer(*this, Context, Result, ProtocolProperties,
-                                 /* Container */0,
+                                 /* Container */nullptr,
                                  "_OBJC_PROTOCOL_PROPERTIES_",
                                  PDecl->getNameAsString());
-  
+
   // Writer out root metadata for current protocol: struct _protocol_t
   Result += "\n";
   if (LangOpts.MicrosoftExt)
@@ -7281,13 +7281,12 @@
   Write__class_ro_t_initializer(Context, Result, flags, 
                                 InstanceStart, InstanceSize,
                                 ClassMethods,
-                                0,
-                                0,
-                                0,
+                                nullptr,
+                                nullptr,
+                                nullptr,
                                 "_OBJC_METACLASS_RO_$_",
                                 CDecl->getNameAsString());
 
-  
   // Data for initializing _class_ro_t meta-data
   flags = CLS;
   if (classIsHidden)
@@ -7643,7 +7642,7 @@
         dyn_cast<ObjCInterfaceType>(BaseExpr->getType()->getPointeeType());
       assert(iFaceDecl && "RewriteObjCIvarRefExpr - iFaceDecl is null");
       // lookup which class implements the instance variable.
-      ObjCInterfaceDecl *clsDeclared = 0;
+      ObjCInterfaceDecl *clsDeclared = nullptr;
       iFaceDecl->getDecl()->lookupInstanceVariable(D->getIdentifier(),
                                                    clsDeclared);
       assert(clsDeclared && "RewriteObjCIvarRefExpr(): Can't find class");
@@ -7664,7 +7663,8 @@
                                                     BaseExpr);
       VarDecl *NewVD = VarDecl::Create(*Context, TUDecl, SourceLocation(),
                                        SourceLocation(), &Context->Idents.get(IvarOffsetName),
-                                       Context->UnsignedLongTy, 0, SC_Extern);
+                                       Context->UnsignedLongTy, nullptr,
+                                       SC_Extern);
       DeclRefExpr *DRE = new (Context) DeclRefExpr(NewVD, false,
                                                    Context->UnsignedLongTy, VK_LValue,
                                                    SourceLocation());
@@ -7704,12 +7704,12 @@
           Zero = NoTypeInfoCStyleCastExpr(Context, PtrStructIMPL, CK_BitCast, Zero);
           ParenExpr *PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(),
                                                   Zero);
-          FieldDecl *FD = FieldDecl::Create(*Context, 0, SourceLocation(),
+          FieldDecl *FD = FieldDecl::Create(*Context, nullptr, SourceLocation(),
                                             SourceLocation(),
                                             &Context->Idents.get(D->getNameAsString()),
-                                            IvarT, 0,
-                                            /*BitWidth=*/0, /*Mutable=*/true,
-                                            ICIS_NoInit);
+                                            IvarT, nullptr,
+                                            /*BitWidth=*/nullptr,
+                                            /*Mutable=*/true, ICIS_NoInit);
           MemberExpr *ME = new (Context) MemberExpr(PE, true, FD, SourceLocation(),
                                                     FD->getType(), VK_LValue,
                                                     OK_Ordinary);
@@ -7733,13 +7733,12 @@
                                    Exp);
       
       if (D->isBitField()) {
-        FieldDecl *FD = FieldDecl::Create(*Context, 0, SourceLocation(),
+        FieldDecl *FD = FieldDecl::Create(*Context, nullptr, SourceLocation(),
                                           SourceLocation(),
                                           &Context->Idents.get(D->getNameAsString()),
-                                          D->getType(), 0,
+                                          D->getType(), nullptr,
                                           /*BitWidth=*/D->getBitWidth(),
-                                          /*Mutable=*/true,
-                                          ICIS_NoInit);
+                                          /*Mutable=*/true, ICIS_NoInit);
         MemberExpr *ME = new (Context) MemberExpr(PE, /*isArrow*/false, FD, SourceLocation(),
                                                   FD->getType(), VK_LValue,
                                                   OK_Ordinary);