Quellcode durchsuchen

[C++11] Use 'nullptr'. Sema edition.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209613 91177308-0d34-0410-b5e6-96231b3b80d8
Craig Topper vor 11 Jahren
Ursprung
Commit
6b8c5857eb
42 geänderte Dateien mit 1689 neuen und 1623 gelöschten Zeilen
  1. 6 6
      lib/Sema/AnalysisBasedWarnings.cpp
  2. 5 5
      lib/Sema/CodeCompleteConsumer.cpp
  3. 1 1
      lib/Sema/DelayedDiagnostic.cpp
  4. 5 5
      lib/Sema/IdentifierResolver.cpp
  5. 1 1
      lib/Sema/JumpDiagnostics.cpp
  6. 3 3
      lib/Sema/MultiplexExternalSemaSource.cpp
  7. 4 4
      lib/Sema/Scope.cpp
  8. 4 5
      lib/Sema/ScopeInfo.cpp
  9. 37 36
      lib/Sema/Sema.cpp
  10. 13 12
      lib/Sema/SemaAccess.cpp
  11. 9 9
      lib/Sema/SemaAttr.cpp
  12. 19 19
      lib/Sema/SemaCXXScopeSpec.cpp
  13. 5 5
      lib/Sema/SemaCast.cpp
  14. 55 54
      lib/Sema/SemaChecking.cpp
  15. 95 88
      lib/Sema/SemaCodeComplete.cpp
  16. 135 130
      lib/Sema/SemaDecl.cpp
  17. 39 39
      lib/Sema/SemaDeclAttr.cpp
  18. 140 135
      lib/Sema/SemaDeclCXX.cpp
  19. 53 51
      lib/Sema/SemaDeclObjC.cpp
  20. 2 2
      lib/Sema/SemaExceptionSpec.cpp
  21. 94 89
      lib/Sema/SemaExpr.cpp
  22. 81 77
      lib/Sema/SemaExprCXX.cpp
  23. 31 33
      lib/Sema/SemaExprMember.cpp
  24. 90 81
      lib/Sema/SemaExprObjC.cpp
  25. 53 50
      lib/Sema/SemaInit.cpp
  26. 27 26
      lib/Sema/SemaLambda.cpp
  27. 45 44
      lib/Sema/SemaLookup.cpp
  28. 49 43
      lib/Sema/SemaObjCProperty.cpp
  29. 100 96
      lib/Sema/SemaOverload.cpp
  30. 19 18
      lib/Sema/SemaPseudoObject.cpp
  31. 33 32
      lib/Sema/SemaStmt.cpp
  32. 2 2
      lib/Sema/SemaStmtAsm.cpp
  33. 4 4
      lib/Sema/SemaStmtAttr.cpp
  34. 68 64
      lib/Sema/SemaTemplate.cpp
  35. 27 27
      lib/Sema/SemaTemplateDeduction.cpp
  36. 40 39
      lib/Sema/SemaTemplateInstantiate.cpp
  37. 127 125
      lib/Sema/SemaTemplateInstantiateDecl.cpp
  38. 5 5
      lib/Sema/SemaTemplateVariadic.cpp
  39. 34 32
      lib/Sema/SemaType.cpp
  40. 127 124
      lib/Sema/TreeTransform.h
  41. 1 1
      lib/Sema/TypeLocBuilder.cpp
  42. 1 1
      lib/Sema/TypeLocBuilder.h

+ 6 - 6
lib/Sema/AnalysisBasedWarnings.cpp

@@ -241,7 +241,7 @@ static void checkRecursiveFunction(Sema &S, const FunctionDecl *FD,
     return;
     return;
 
 
   CFG *cfg = AC.getCFG();
   CFG *cfg = AC.getCFG();
-  if (cfg == 0) return;
+  if (!cfg) return;
 
 
   // If the exit block is unreachable, skip processing the function.
   // If the exit block is unreachable, skip processing the function.
   if (cfg->getExit().pred_empty())
   if (cfg->getExit().pred_empty())
@@ -282,7 +282,7 @@ enum ControlFlowKind {
 /// will return.
 /// will return.
 static ControlFlowKind CheckFallThrough(AnalysisDeclContext &AC) {
 static ControlFlowKind CheckFallThrough(AnalysisDeclContext &AC) {
   CFG *cfg = AC.getCFG();
   CFG *cfg = AC.getCFG();
-  if (cfg == 0) return UnknownFallThrough;
+  if (!cfg) return UnknownFallThrough;
 
 
   // The CFG leaves in dead things, and we don't want the dead code paths to
   // The CFG leaves in dead things, and we don't want the dead code paths to
   // confuse us, so we mark all live things first.
   // confuse us, so we mark all live things first.
@@ -1033,7 +1033,7 @@ namespace {
         if (hasSpecificAttr<FallThroughAttr>(AS->getAttrs()))
         if (hasSpecificAttr<FallThroughAttr>(AS->getAttrs()))
           return AS;
           return AS;
       }
       }
-      return 0;
+      return nullptr;
     }
     }
 
 
     static const Stmt *getLastStmt(const CFGBlock &B) {
     static const Stmt *getLastStmt(const CFGBlock &B) {
@@ -1052,7 +1052,7 @@ namespace {
         if (!isa<SwitchCase>(SW->getSubStmt()))
         if (!isa<SwitchCase>(SW->getSubStmt()))
           return SW->getSubStmt();
           return SW->getSubStmt();
 
 
-      return 0;
+      return nullptr;
     }
     }
 
 
     bool FoundSwitchStatements;
     bool FoundSwitchStatements;
@@ -1335,7 +1335,7 @@ class UninitValsDiagReporter : public UninitVariablesHandler {
   UsesMap *uses;
   UsesMap *uses;
   
   
 public:
 public:
-  UninitValsDiagReporter(Sema &S) : S(S), uses(0) {}
+  UninitValsDiagReporter(Sema &S) : S(S), uses(nullptr) {}
   ~UninitValsDiagReporter() { 
   ~UninitValsDiagReporter() { 
     flushDiagnostics();
     flushDiagnostics();
   }
   }
@@ -1783,7 +1783,7 @@ AnalysisBasedWarnings::IssueWarnings(sema::AnalysisBasedWarnings::Policy P,
   assert(Body);
   assert(Body);
 
 
   // Construct the analysis context with the specified CFG build options.
   // Construct the analysis context with the specified CFG build options.
-  AnalysisDeclContext AC(/* AnalysisDeclContextManager */ 0, D);
+  AnalysisDeclContext AC(/* AnalysisDeclContextManager */ nullptr, D);
 
 
   // Don't generate EH edges for CallExprs as we'd like to avoid the n^2
   // Don't generate EH edges for CallExprs as we'd like to avoid the n^2
   // explosion for destructors that can result and the compile time hit.
   // explosion for destructors that can result and the compile time hit.

+ 5 - 5
lib/Sema/CodeCompleteConsumer.cpp

@@ -218,7 +218,7 @@ const char *CodeCompletionString::getAnnotation(unsigned AnnotationNr) const {
   if (AnnotationNr < NumAnnotations)
   if (AnnotationNr < NumAnnotations)
     return reinterpret_cast<const char * const*>(end())[AnnotationNr];
     return reinterpret_cast<const char * const*>(end())[AnnotationNr];
   else
   else
-    return 0;
+    return nullptr;
 }
 }
 
 
 
 
@@ -247,8 +247,8 @@ const char *CodeCompletionString::getTypedText() const {
   for (iterator C = begin(), CEnd = end(); C != CEnd; ++C)
   for (iterator C = begin(), CEnd = end(); C != CEnd; ++C)
     if (C->Kind == CK_TypedText)
     if (C->Kind == CK_TypedText)
       return C->Text;
       return C->Text;
-  
-  return 0;
+
+  return nullptr;
 }
 }
 
 
 const char *CodeCompletionAllocator::CopyString(StringRef String) {
 const char *CodeCompletionAllocator::CopyString(StringRef String) {
@@ -278,7 +278,7 @@ StringRef CodeCompletionTUInfo::getParentName(const DeclContext *DC) {
 
 
   // If we already processed this DeclContext and assigned empty to it, the
   // If we already processed this DeclContext and assigned empty to it, the
   // data pointer will be non-null.
   // data pointer will be non-null.
-  if (CachedParentName.data() != 0)
+  if (CachedParentName.data() != nullptr)
     return StringRef();
     return StringRef();
 
 
   // Find the interesting names.
   // Find the interesting names.
@@ -405,7 +405,7 @@ CodeCompleteConsumer::OverloadCandidate::getFunction() const {
   else if (getKind() == CK_FunctionTemplate)
   else if (getKind() == CK_FunctionTemplate)
     return FunctionTemplate->getTemplatedDecl();
     return FunctionTemplate->getTemplatedDecl();
   else
   else
-    return 0;
+    return nullptr;
 }
 }
 
 
 const FunctionType *
 const FunctionType *

+ 1 - 1
lib/Sema/DelayedDiagnostic.cpp

@@ -40,7 +40,7 @@ DelayedDiagnostic::makeAvailability(Sema::AvailabilityDiagnostic AD,
   DD.DeprecationData.Decl = D;
   DD.DeprecationData.Decl = D;
   DD.DeprecationData.UnknownObjCClass = UnknownObjCClass;
   DD.DeprecationData.UnknownObjCClass = UnknownObjCClass;
   DD.DeprecationData.ObjCProperty = ObjCProperty;
   DD.DeprecationData.ObjCProperty = ObjCProperty;
-  char *MessageData = 0;
+  char *MessageData = nullptr;
   if (Msg.size()) {
   if (Msg.size()) {
     MessageData = new char [Msg.size()];
     MessageData = new char [Msg.size()];
     memcpy(MessageData, Msg.data(), Msg.size());
     memcpy(MessageData, Msg.data(), Msg.size());

+ 5 - 5
lib/Sema/IdentifierResolver.cpp

@@ -45,7 +45,7 @@ class IdentifierResolver::IdDeclInfoMap {
   unsigned int CurIndex;
   unsigned int CurIndex;
 
 
 public:
 public:
-  IdDeclInfoMap() : CurPool(0), CurIndex(POOL_SIZE) {}
+  IdDeclInfoMap() : CurPool(nullptr), CurIndex(POOL_SIZE) {}
 
 
   ~IdDeclInfoMap() {
   ~IdDeclInfoMap() {
     IdDeclInfoPool *Cur = CurPool;
     IdDeclInfoPool *Cur = CurPool;
@@ -151,7 +151,7 @@ void IdentifierResolver::AddDecl(NamedDecl *D) {
   IdDeclInfo *IDI;
   IdDeclInfo *IDI;
 
 
   if (isDeclPtr(Ptr)) {
   if (isDeclPtr(Ptr)) {
-    Name.setFETokenInfo(NULL);
+    Name.setFETokenInfo(nullptr);
     IDI = &(*IdDeclInfos)[Name];
     IDI = &(*IdDeclInfos)[Name];
     NamedDecl *PrevD = static_cast<NamedDecl*>(Ptr);
     NamedDecl *PrevD = static_cast<NamedDecl*>(Ptr);
     IDI->AddDecl(PrevD);
     IDI->AddDecl(PrevD);
@@ -213,7 +213,7 @@ void IdentifierResolver::RemoveDecl(NamedDecl *D) {
 
 
   if (isDeclPtr(Ptr)) {
   if (isDeclPtr(Ptr)) {
     assert(D == Ptr && "Didn't find this decl on its identifier's chain!");
     assert(D == Ptr && "Didn't find this decl on its identifier's chain!");
-    Name.setFETokenInfo(NULL);
+    Name.setFETokenInfo(nullptr);
     return;
     return;
   }
   }
 
 
@@ -314,8 +314,8 @@ bool IdentifierResolver::tryAddTopLevelDecl(NamedDecl *D, DeclarationName Name){
       Name.setFETokenInfo(D);
       Name.setFETokenInfo(D);
       return true;
       return true;
     }
     }
-    
-    Name.setFETokenInfo(NULL);
+
+    Name.setFETokenInfo(nullptr);
     IDI = &(*IdDeclInfos)[Name];
     IDI = &(*IdDeclInfos)[Name];
     
     
     // If the existing declaration is not visible in translation unit scope,
     // If the existing declaration is not visible in translation unit scope,

+ 1 - 1
lib/Sema/JumpDiagnostics.cpp

@@ -348,7 +348,7 @@ void JumpScopeChecker::BuildScopeInformation(Stmt *S, unsigned &origParentScope)
     }
     }
     
     
     Stmt *SubStmt = *CI;
     Stmt *SubStmt = *CI;
-    if (SubStmt == 0) continue;
+    if (!SubStmt) continue;
 
 
     // Cases, labels, and defaults aren't "scope parents".  It's also
     // Cases, labels, and defaults aren't "scope parents".  It's also
     // important to handle these iteratively instead of recursively in
     // important to handle these iteratively instead of recursively in

+ 3 - 3
lib/Sema/MultiplexExternalSemaSource.cpp

@@ -46,7 +46,7 @@ Decl *MultiplexExternalSemaSource::GetExternalDecl(uint32_t ID) {
   for(size_t i = 0; i < Sources.size(); ++i)
   for(size_t i = 0; i < Sources.size(); ++i)
     if (Decl *Result = Sources[i]->GetExternalDecl(ID))
     if (Decl *Result = Sources[i]->GetExternalDecl(ID))
       return Result;
       return Result;
-  return 0;
+  return nullptr;
 }
 }
 
 
 void MultiplexExternalSemaSource::CompleteRedeclChain(const Decl *D) {
 void MultiplexExternalSemaSource::CompleteRedeclChain(const Decl *D) {
@@ -75,7 +75,7 @@ Stmt *MultiplexExternalSemaSource::GetExternalDeclStmt(uint64_t Offset) {
   for(size_t i = 0; i < Sources.size(); ++i)
   for(size_t i = 0; i < Sources.size(); ++i)
     if (Stmt *Result = Sources[i]->GetExternalDeclStmt(Offset))
     if (Stmt *Result = Sources[i]->GetExternalDeclStmt(Offset))
       return Result;
       return Result;
-  return 0;
+  return nullptr;
 }
 }
 
 
 CXXBaseSpecifier *MultiplexExternalSemaSource::GetExternalCXXBaseSpecifiers(
 CXXBaseSpecifier *MultiplexExternalSemaSource::GetExternalCXXBaseSpecifiers(
@@ -83,7 +83,7 @@ CXXBaseSpecifier *MultiplexExternalSemaSource::GetExternalCXXBaseSpecifiers(
   for(size_t i = 0; i < Sources.size(); ++i)
   for(size_t i = 0; i < Sources.size(); ++i)
     if (CXXBaseSpecifier *R = Sources[i]->GetExternalCXXBaseSpecifiers(Offset))
     if (CXXBaseSpecifier *R = Sources[i]->GetExternalCXXBaseSpecifiers(Offset))
       return R;
       return R;
-  return 0; 
+  return nullptr;
 }
 }
 
 
 bool MultiplexExternalSemaSource::
 bool MultiplexExternalSemaSource::

+ 4 - 4
lib/Sema/Scope.cpp

@@ -28,7 +28,7 @@ void Scope::Init(Scope *parent, unsigned flags) {
   } else {
   } else {
     // Control scopes do not contain the contents of nested function scopes for
     // Control scopes do not contain the contents of nested function scopes for
     // control flow purposes.
     // control flow purposes.
-    BreakParent = ContinueParent = 0;
+    BreakParent = ContinueParent = nullptr;
   }
   }
 
 
   if (parent) {
   if (parent) {
@@ -43,8 +43,8 @@ void Scope::Init(Scope *parent, unsigned flags) {
     Depth = 0;
     Depth = 0;
     PrototypeDepth = 0;
     PrototypeDepth = 0;
     PrototypeIndex = 0;
     PrototypeIndex = 0;
-    MSLocalManglingParent = FnParent = BlockParent = 0;
-    TemplateParamParent = 0;
+    MSLocalManglingParent = FnParent = BlockParent = nullptr;
+    TemplateParamParent = nullptr;
     MSLocalManglingNumber = 1;
     MSLocalManglingNumber = 1;
   }
   }
 
 
@@ -76,7 +76,7 @@ void Scope::Init(Scope *parent, unsigned flags) {
 
 
   DeclsInScope.clear();
   DeclsInScope.clear();
   UsingDirectives.clear();
   UsingDirectives.clear();
-  Entity = 0;
+  Entity = nullptr;
   ErrorTrap.reset();
   ErrorTrap.reset();
   NRVO.setPointerAndInt(nullptr, 0);
   NRVO.setPointerAndInt(nullptr, 0);
 }
 }

+ 4 - 5
lib/Sema/ScopeInfo.cpp

@@ -51,7 +51,7 @@ FunctionScopeInfo::WeakObjectProfileTy::BaseInfoTy
 FunctionScopeInfo::WeakObjectProfileTy::getBaseInfo(const Expr *E) {
 FunctionScopeInfo::WeakObjectProfileTy::getBaseInfo(const Expr *E) {
   E = E->IgnoreParenCasts();
   E = E->IgnoreParenCasts();
 
 
-  const NamedDecl *D = 0;
+  const NamedDecl *D = nullptr;
   bool IsExact = false;
   bool IsExact = false;
 
 
   switch (E->getStmtClass()) {
   switch (E->getStmtClass()) {
@@ -93,10 +93,9 @@ FunctionScopeInfo::WeakObjectProfileTy::getBaseInfo(const Expr *E) {
   return BaseInfoTy(D, IsExact);
   return BaseInfoTy(D, IsExact);
 }
 }
 
 
-
 FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy(
 FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy(
                                           const ObjCPropertyRefExpr *PropE)
                                           const ObjCPropertyRefExpr *PropE)
-    : Base(0, true), Property(getBestPropertyDecl(PropE)) {
+    : Base(nullptr, true), Property(getBestPropertyDecl(PropE)) {
 
 
   if (PropE->isObjectReceiver()) {
   if (PropE->isObjectReceiver()) {
     const OpaqueValueExpr *OVE = cast<OpaqueValueExpr>(PropE->getBase());
     const OpaqueValueExpr *OVE = cast<OpaqueValueExpr>(PropE->getBase());
@@ -111,7 +110,7 @@ FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy(
 
 
 FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy(const Expr *BaseE,
 FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy(const Expr *BaseE,
                                                 const ObjCPropertyDecl *Prop)
                                                 const ObjCPropertyDecl *Prop)
-    : Base(0, true), Property(Prop) {
+    : Base(nullptr, true), Property(Prop) {
   if (BaseE)
   if (BaseE)
     Base = getBaseInfo(BaseE);
     Base = getBaseInfo(BaseE);
   // else, this is a message accessing a property on super.
   // else, this is a message accessing a property on super.
@@ -119,7 +118,7 @@ FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy(const Expr *BaseE,
 
 
 FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy(
 FunctionScopeInfo::WeakObjectProfileTy::WeakObjectProfileTy(
                                                       const DeclRefExpr *DRE)
                                                       const DeclRefExpr *DRE)
-  : Base(0, true), Property(DRE->getDecl()) {
+  : Base(nullptr, true), Property(DRE->getDecl()) {
   assert(isa<VarDecl>(Property));
   assert(isa<VarDecl>(Property));
 }
 }
 
 

+ 37 - 36
lib/Sema/Sema.cpp

@@ -76,40 +76,41 @@ void Sema::ActOnTranslationUnitScope(Scope *S) {
 Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
 Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
            TranslationUnitKind TUKind,
            TranslationUnitKind TUKind,
            CodeCompleteConsumer *CodeCompleter)
            CodeCompleteConsumer *CodeCompleter)
-  : ExternalSource(0),
+  : ExternalSource(nullptr),
     isMultiplexExternalSource(false), FPFeatures(pp.getLangOpts()),
     isMultiplexExternalSource(false), FPFeatures(pp.getLangOpts()),
     LangOpts(pp.getLangOpts()), PP(pp), Context(ctxt), Consumer(consumer),
     LangOpts(pp.getLangOpts()), PP(pp), Context(ctxt), Consumer(consumer),
     Diags(PP.getDiagnostics()), SourceMgr(PP.getSourceManager()),
     Diags(PP.getDiagnostics()), SourceMgr(PP.getSourceManager()),
     CollectStats(false), CodeCompleter(CodeCompleter),
     CollectStats(false), CodeCompleter(CodeCompleter),
-    CurContext(0), OriginalLexicalContext(0),
-    PackContext(0), MSStructPragmaOn(false),
+    CurContext(nullptr), OriginalLexicalContext(nullptr),
+    PackContext(nullptr), MSStructPragmaOn(false),
     MSPointerToMemberRepresentationMethod(
     MSPointerToMemberRepresentationMethod(
         LangOpts.getMSPointerToMemberRepresentationMethod()),
         LangOpts.getMSPointerToMemberRepresentationMethod()),
     VtorDispModeStack(1, MSVtorDispAttr::Mode(LangOpts.VtorDispMode)),
     VtorDispModeStack(1, MSVtorDispAttr::Mode(LangOpts.VtorDispMode)),
     DataSegStack(nullptr), BSSSegStack(nullptr), ConstSegStack(nullptr),
     DataSegStack(nullptr), BSSSegStack(nullptr), ConstSegStack(nullptr),
-    CodeSegStack(nullptr), VisContext(0),
+    CodeSegStack(nullptr), VisContext(nullptr),
     IsBuildingRecoveryCallExpr(false),
     IsBuildingRecoveryCallExpr(false),
-    ExprNeedsCleanups(false), LateTemplateParser(0), OpaqueParser(0),
-    IdResolver(pp), StdInitializerList(0), CXXTypeInfoDecl(0), MSVCGuidDecl(0),
-    NSNumberDecl(0),
-    NSStringDecl(0), StringWithUTF8StringMethod(0),
-    NSArrayDecl(0), ArrayWithObjectsMethod(0),
-    NSDictionaryDecl(0), DictionaryWithObjectsMethod(0),
+    ExprNeedsCleanups(false), LateTemplateParser(nullptr),
+    OpaqueParser(nullptr), IdResolver(pp), StdInitializerList(nullptr),
+    CXXTypeInfoDecl(nullptr), MSVCGuidDecl(nullptr),
+    NSNumberDecl(nullptr),
+    NSStringDecl(nullptr), StringWithUTF8StringMethod(nullptr),
+    NSArrayDecl(nullptr), ArrayWithObjectsMethod(nullptr),
+    NSDictionaryDecl(nullptr), DictionaryWithObjectsMethod(nullptr),
     GlobalNewDeleteDeclared(false),
     GlobalNewDeleteDeclared(false),
     TUKind(TUKind),
     TUKind(TUKind),
     NumSFINAEErrors(0),
     NumSFINAEErrors(0),
     AccessCheckingSFINAE(false), InNonInstantiationSFINAEContext(false),
     AccessCheckingSFINAE(false), InNonInstantiationSFINAEContext(false),
     NonInstantiationEntries(0), ArgumentPackSubstitutionIndex(-1),
     NonInstantiationEntries(0), ArgumentPackSubstitutionIndex(-1),
-    CurrentInstantiationScope(0), DisableTypoCorrection(false),
+    CurrentInstantiationScope(nullptr), DisableTypoCorrection(false),
     TyposCorrected(0), AnalysisWarnings(*this),
     TyposCorrected(0), AnalysisWarnings(*this),
-    VarDataSharingAttributesStack(0), CurScope(0),
-    Ident_super(0), Ident___float128(0)
+    VarDataSharingAttributesStack(nullptr), CurScope(nullptr),
+    Ident_super(nullptr), Ident___float128(nullptr)
 {
 {
-  TUScope = 0;
+  TUScope = nullptr;
 
 
   LoadedExternalKnownNamespaces = false;
   LoadedExternalKnownNamespaces = false;
   for (unsigned I = 0; I != NSAPI::NumNSNumberLiteralMethods; ++I)
   for (unsigned I = 0; I != NSAPI::NumNSNumberLiteralMethods; ++I)
-    NSNumberLiteralMethods[I] = 0;
+    NSNumberLiteralMethods[I] = nullptr;
 
 
   if (getLangOpts().ObjC1)
   if (getLangOpts().ObjC1)
     NSAPIObj.reset(new NSAPI(Context));
     NSAPIObj.reset(new NSAPI(Context));
@@ -123,7 +124,7 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
 
 
   ExprEvalContexts.push_back(
   ExprEvalContexts.push_back(
         ExpressionEvaluationContextRecord(PotentiallyEvaluated, 0,
         ExpressionEvaluationContextRecord(PotentiallyEvaluated, 0,
-                                          false, 0, false));
+                                          false, nullptr, false));
 
 
   FunctionScopes.push_back(new FunctionScopeInfo(Diags));
   FunctionScopes.push_back(new FunctionScopeInfo(Diags));
 
 
@@ -593,7 +594,7 @@ static bool IsRecordFullyDefined(const CXXRecordDecl *RD,
 /// translation unit when EOF is reached and all but the top-level scope is
 /// translation unit when EOF is reached and all but the top-level scope is
 /// popped.
 /// popped.
 void Sema::ActOnEndOfTranslationUnit() {
 void Sema::ActOnEndOfTranslationUnit() {
-  assert(DelayedDiagnostics.getCurrentPool() == NULL
+  assert(DelayedDiagnostics.getCurrentPool() == nullptr
          && "reached end of translation unit with a pool attached?");
          && "reached end of translation unit with a pool attached?");
 
 
   // If code completion is enabled, don't perform any end-of-translation-unit
   // If code completion is enabled, don't perform any end-of-translation-unit
@@ -616,7 +617,7 @@ void Sema::ActOnEndOfTranslationUnit() {
              "Should not see dependent types here!");
              "Should not see dependent types here!");
       if (const CXXMethodDecl *KeyFunction =
       if (const CXXMethodDecl *KeyFunction =
               Context.getCurrentKeyFunction(*I)) {
               Context.getCurrentKeyFunction(*I)) {
-        const FunctionDecl *Definition = 0;
+        const FunctionDecl *Definition = nullptr;
         if (KeyFunction->hasBody(Definition))
         if (KeyFunction->hasBody(Definition))
           MarkVTableUsed(Definition->getLocation(), *I, true);
           MarkVTableUsed(Definition->getLocation(), *I, true);
       }
       }
@@ -655,14 +656,14 @@ void Sema::ActOnEndOfTranslationUnit() {
 
 
   // Remove file scoped decls that turned out to be used.
   // Remove file scoped decls that turned out to be used.
   UnusedFileScopedDecls.erase(
   UnusedFileScopedDecls.erase(
-      std::remove_if(UnusedFileScopedDecls.begin(0, true),
+      std::remove_if(UnusedFileScopedDecls.begin(nullptr, true),
                      UnusedFileScopedDecls.end(),
                      UnusedFileScopedDecls.end(),
                      std::bind1st(std::ptr_fun(ShouldRemoveFromUnused), this)),
                      std::bind1st(std::ptr_fun(ShouldRemoveFromUnused), this)),
       UnusedFileScopedDecls.end());
       UnusedFileScopedDecls.end());
 
 
   if (TUKind == TU_Prefix) {
   if (TUKind == TU_Prefix) {
     // Translation unit prefixes don't need any of the checking below.
     // Translation unit prefixes don't need any of the checking below.
-    TUScope = 0;
+    TUScope = nullptr;
     return;
     return;
   }
   }
 
 
@@ -714,7 +715,7 @@ void Sema::ActOnEndOfTranslationUnit() {
     }
     }
 
 
     // Modules don't need any of the checking below.
     // Modules don't need any of the checking below.
-    TUScope = 0;
+    TUScope = nullptr;
     return;
     return;
   }
   }
 
 
@@ -740,7 +741,7 @@ void Sema::ActOnEndOfTranslationUnit() {
     // If the tentative definition was completed, getActingDefinition() returns
     // If the tentative definition was completed, getActingDefinition() returns
     // null. If we've already seen this variable before, insert()'s second
     // null. If we've already seen this variable before, insert()'s second
     // return value is false.
     // return value is false.
-    if (VD == 0 || VD->isInvalidDecl() || !Seen.insert(VD))
+    if (!VD || VD->isInvalidDecl() || !Seen.insert(VD))
       continue;
       continue;
 
 
     if (const IncompleteArrayType *ArrayT
     if (const IncompleteArrayType *ArrayT
@@ -845,7 +846,7 @@ void Sema::ActOnEndOfTranslationUnit() {
   assert(ParsingInitForAutoVars.empty() &&
   assert(ParsingInitForAutoVars.empty() &&
          "Didn't unmark var as having its initializer parsed");
          "Didn't unmark var as having its initializer parsed");
 
 
-  TUScope = 0;
+  TUScope = nullptr;
 }
 }
 
 
 
 
@@ -889,7 +890,7 @@ NamedDecl *Sema::getCurFunctionOrMethodDecl() {
   DeclContext *DC = getFunctionLevelDeclContext();
   DeclContext *DC = getFunctionLevelDeclContext();
   if (isa<ObjCMethodDecl>(DC) || isa<FunctionDecl>(DC))
   if (isa<ObjCMethodDecl>(DC) || isa<FunctionDecl>(DC))
     return cast<NamedDecl>(DC);
     return cast<NamedDecl>(DC);
-  return 0;
+  return nullptr;
 }
 }
 
 
 void Sema::EmitCurrentDiagnostic(unsigned DiagID) {
 void Sema::EmitCurrentDiagnostic(unsigned DiagID) {
@@ -1037,7 +1038,7 @@ bool Sema::findMacroSpelling(SourceLocation &locref, StringRef name) {
 Scope *Sema::getScopeForContext(DeclContext *Ctx) {
 Scope *Sema::getScopeForContext(DeclContext *Ctx) {
 
 
   if (!Ctx)
   if (!Ctx)
-    return 0;
+    return nullptr;
 
 
   Ctx = Ctx->getPrimaryContext();
   Ctx = Ctx->getPrimaryContext();
   for (Scope *S = getCurScope(); S; S = S->getParent()) {
   for (Scope *S = getCurScope(); S; S = S->getParent()) {
@@ -1049,7 +1050,7 @@ Scope *Sema::getScopeForContext(DeclContext *Ctx) {
           return S;
           return S;
   }
   }
 
 
-  return 0;
+  return nullptr;
 }
 }
 
 
 /// \brief Enter a new function scope
 /// \brief Enter a new function scope
@@ -1120,7 +1121,7 @@ bool Sema::hasAnyUnrecoverableErrorsInThisFunction() const {
 
 
 BlockScopeInfo *Sema::getCurBlock() {
 BlockScopeInfo *Sema::getCurBlock() {
   if (FunctionScopes.empty())
   if (FunctionScopes.empty())
-    return 0;
+    return nullptr;
 
 
   auto CurBSI = dyn_cast<BlockScopeInfo>(FunctionScopes.back());
   auto CurBSI = dyn_cast<BlockScopeInfo>(FunctionScopes.back());
   if (CurBSI && CurBSI->TheDecl &&
   if (CurBSI && CurBSI->TheDecl &&
@@ -1135,7 +1136,7 @@ BlockScopeInfo *Sema::getCurBlock() {
 
 
 LambdaScopeInfo *Sema::getCurLambda() {
 LambdaScopeInfo *Sema::getCurLambda() {
   if (FunctionScopes.empty())
   if (FunctionScopes.empty())
-    return 0;
+    return nullptr;
 
 
   auto CurLSI = dyn_cast<LambdaScopeInfo>(FunctionScopes.back());
   auto CurLSI = dyn_cast<LambdaScopeInfo>(FunctionScopes.back());
   if (CurLSI && CurLSI->Lambda &&
   if (CurLSI && CurLSI->Lambda &&
@@ -1152,9 +1153,9 @@ LambdaScopeInfo *Sema::getCurLambda() {
 LambdaScopeInfo *Sema::getCurGenericLambda() {
 LambdaScopeInfo *Sema::getCurGenericLambda() {
   if (LambdaScopeInfo *LSI =  getCurLambda()) {
   if (LambdaScopeInfo *LSI =  getCurLambda()) {
     return (LSI->AutoTemplateParams.size() ||
     return (LSI->AutoTemplateParams.size() ||
-                    LSI->GLTemplateParameterList) ? LSI : 0;
+                    LSI->GLTemplateParameterList) ? LSI : nullptr;
   }
   }
-  return 0;
+  return nullptr;
 }
 }
 
 
 
 
@@ -1232,7 +1233,7 @@ bool Sema::tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy,
   ZeroArgCallReturnTy = QualType();
   ZeroArgCallReturnTy = QualType();
   OverloadSet.clear();
   OverloadSet.clear();
 
 
-  const OverloadExpr *Overloads = NULL;
+  const OverloadExpr *Overloads = nullptr;
   bool IsMemExpr = false;
   bool IsMemExpr = false;
   if (E.getType() == Context.OverloadTy) {
   if (E.getType() == Context.OverloadTy) {
     OverloadExpr::FindResult FR = OverloadExpr::find(const_cast<Expr*>(&E));
     OverloadExpr::FindResult FR = OverloadExpr::find(const_cast<Expr*>(&E));
@@ -1281,8 +1282,8 @@ bool Sema::tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy,
   if (IsMemExpr && !E.isTypeDependent()) {
   if (IsMemExpr && !E.isTypeDependent()) {
     bool Suppress = getDiagnostics().getSuppressAllDiagnostics();
     bool Suppress = getDiagnostics().getSuppressAllDiagnostics();
     getDiagnostics().setSuppressAllDiagnostics(true);
     getDiagnostics().setSuppressAllDiagnostics(true);
-    ExprResult R = BuildCallToMemberFunction(NULL, &E, SourceLocation(), None,
-                                             SourceLocation());
+    ExprResult R = BuildCallToMemberFunction(nullptr, &E, SourceLocation(),
+                                             None, SourceLocation());
     getDiagnostics().setSuppressAllDiagnostics(Suppress);
     getDiagnostics().setSuppressAllDiagnostics(Suppress);
     if (R.isUsable()) {
     if (R.isUsable()) {
       ZeroArgCallReturnTy = R.get()->getType();
       ZeroArgCallReturnTy = R.get()->getType();
@@ -1302,7 +1303,7 @@ bool Sema::tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy,
   // We don't have an expression that's convenient to get a FunctionDecl from,
   // We don't have an expression that's convenient to get a FunctionDecl from,
   // but we can at least check if the type is "function of 0 arguments".
   // but we can at least check if the type is "function of 0 arguments".
   QualType ExprTy = E.getType();
   QualType ExprTy = E.getType();
-  const FunctionType *FunTy = NULL;
+  const FunctionType *FunTy = nullptr;
   QualType PointeeTy = ExprTy->getPointeeType();
   QualType PointeeTy = ExprTy->getPointeeType();
   if (!PointeeTy.isNull())
   if (!PointeeTy.isNull())
     FunTy = PointeeTy->getAs<FunctionType>();
     FunTy = PointeeTy->getAs<FunctionType>();
@@ -1407,7 +1408,7 @@ bool Sema::tryToRecoverWithCall(ExprResult &E, const PartialDiagnostic &PD,
 
 
     // FIXME: Try this before emitting the fixit, and suppress diagnostics
     // FIXME: Try this before emitting the fixit, and suppress diagnostics
     // while doing so.
     // while doing so.
-    E = ActOnCallExpr(0, E.take(), Range.getEnd(), None,
+    E = ActOnCallExpr(nullptr, E.take(), Range.getEnd(), None,
                       Range.getEnd().getLocWithOffset(1));
                       Range.getEnd().getLocWithOffset(1));
     return true;
     return true;
   }
   }
@@ -1442,7 +1443,7 @@ void Sema::PushCapturedRegionScope(Scope *S, CapturedDecl *CD, RecordDecl *RD,
 
 
 CapturedRegionScopeInfo *Sema::getCurCapturedRegion() {
 CapturedRegionScopeInfo *Sema::getCurCapturedRegion() {
   if (FunctionScopes.empty())
   if (FunctionScopes.empty())
-    return 0;
+    return nullptr;
 
 
   return dyn_cast<CapturedRegionScopeInfo>(FunctionScopes.back());
   return dyn_cast<CapturedRegionScopeInfo>(FunctionScopes.back());
 }
 }

+ 13 - 12
lib/Sema/SemaAccess.cpp

@@ -78,7 +78,7 @@ static CXXRecordDecl *FindDeclaringClass(NamedDecl *D) {
 
 
 namespace {
 namespace {
 struct EffectiveContext {
 struct EffectiveContext {
-  EffectiveContext() : Inner(0), Dependent(false) {}
+  EffectiveContext() : Inner(nullptr), Dependent(false) {}
 
 
   explicit EffectiveContext(DeclContext *DC)
   explicit EffectiveContext(DeclContext *DC)
     : Inner(DC),
     : Inner(DC),
@@ -209,7 +209,8 @@ struct AccessTarget : public AccessedEntity {
 
 
     CalculatedInstanceContext = true;
     CalculatedInstanceContext = true;
     DeclContext *IC = S.computeDeclContext(getBaseObjectType());
     DeclContext *IC = S.computeDeclContext(getBaseObjectType());
-    InstanceContext = (IC ? cast<CXXRecordDecl>(IC)->getCanonicalDecl() : 0);
+    InstanceContext = (IC ? cast<CXXRecordDecl>(IC)->getCanonicalDecl()
+                          : nullptr);
     return InstanceContext;
     return InstanceContext;
   }
   }
 
 
@@ -232,7 +233,7 @@ private:
                           !getBaseObjectType().isNull() &&
                           !getBaseObjectType().isNull() &&
                           getTargetDecl()->isCXXInstanceMember());
                           getTargetDecl()->isCXXInstanceMember());
     CalculatedInstanceContext = false;
     CalculatedInstanceContext = false;
-    InstanceContext = 0;
+    InstanceContext = nullptr;
 
 
     if (isMemberAccess())
     if (isMemberAccess())
       DeclaringClass = FindDeclaringClass(getTargetDecl());
       DeclaringClass = FindDeclaringClass(getTargetDecl());
@@ -709,7 +710,7 @@ struct ProtectedFriendContext {
 static AccessResult GetProtectedFriendKind(Sema &S, const EffectiveContext &EC,
 static AccessResult GetProtectedFriendKind(Sema &S, const EffectiveContext &EC,
                                            const CXXRecordDecl *InstanceContext,
                                            const CXXRecordDecl *InstanceContext,
                                            const CXXRecordDecl *NamingClass) {
                                            const CXXRecordDecl *NamingClass) {
-  assert(InstanceContext == 0 ||
+  assert(InstanceContext == nullptr ||
          InstanceContext->getCanonicalDecl() == InstanceContext);
          InstanceContext->getCanonicalDecl() == InstanceContext);
   assert(NamingClass->getCanonicalDecl() == NamingClass);
   assert(NamingClass->getCanonicalDecl() == NamingClass);
 
 
@@ -842,7 +843,7 @@ static AccessResult HasAccess(Sema &S,
   // and instead rely on whether any potential P is a friend.
   // and instead rely on whether any potential P is a friend.
   if (Access == AS_protected && Target.isInstanceMember()) {
   if (Access == AS_protected && Target.isInstanceMember()) {
     // Compute the instance context if possible.
     // Compute the instance context if possible.
-    const CXXRecordDecl *InstanceContext = 0;
+    const CXXRecordDecl *InstanceContext = nullptr;
     if (Target.hasInstanceContext()) {
     if (Target.hasInstanceContext()) {
       InstanceContext = Target.resolveInstanceContext(S);
       InstanceContext = Target.resolveInstanceContext(S);
       if (!InstanceContext) return AR_dependent;
       if (!InstanceContext) return AR_dependent;
@@ -937,7 +938,7 @@ static CXXBasePath *FindBestPath(Sema &S,
   assert(isDerived && "derived class not actually derived from base");
   assert(isDerived && "derived class not actually derived from base");
   (void) isDerived;
   (void) isDerived;
 
 
-  CXXBasePath *BestPath = 0;
+  CXXBasePath *BestPath = nullptr;
 
 
   assert(FinalAccess != AS_none && "forbidden access after declaring class");
   assert(FinalAccess != AS_none && "forbidden access after declaring class");
 
 
@@ -986,7 +987,7 @@ static CXXBasePath *FindBestPath(Sema &S,
 
 
     // Note that we modify the path's Access field to the
     // Note that we modify the path's Access field to the
     // friend-modified access.
     // friend-modified access.
-    if (BestPath == 0 || PathAccess < BestPath->Access) {
+    if (BestPath == nullptr || PathAccess < BestPath->Access) {
       BestPath = &*PI;
       BestPath = &*PI;
       BestPath->Access = PathAccess;
       BestPath->Access = PathAccess;
 
 
@@ -1004,7 +1005,7 @@ static CXXBasePath *FindBestPath(Sema &S,
   // We didn't find a public path, but at least one path was subject
   // We didn't find a public path, but at least one path was subject
   // to dependent friendship, so delay the check.
   // to dependent friendship, so delay the check.
   if (AnyDependent)
   if (AnyDependent)
-    return 0;
+    return nullptr;
 
 
   return BestPath;
   return BestPath;
 }
 }
@@ -1101,7 +1102,7 @@ static void diagnoseBadDirectAccess(Sema &S,
 
 
   // Find an original declaration.
   // Find an original declaration.
   while (D->isOutOfLine()) {
   while (D->isOutOfLine()) {
-    NamedDecl *PrevDecl = 0;
+    NamedDecl *PrevDecl = nullptr;
     if (VarDecl *VD = dyn_cast<VarDecl>(D))
     if (VarDecl *VD = dyn_cast<VarDecl>(D))
       PrevDecl = VD->getPreviousDecl();
       PrevDecl = VD->getPreviousDecl();
     else if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D))
     else if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D))
@@ -1212,7 +1213,7 @@ static void DiagnoseAccessPath(Sema &S,
     case AR_accessible:
     case AR_accessible:
       accessSoFar = AS_public;
       accessSoFar = AS_public;
       entity.suppressInstanceContext();
       entity.suppressInstanceContext();
-      constrainingBase = 0;
+      constrainingBase = nullptr;
       break;
       break;
     case AR_dependent:
     case AR_dependent:
       llvm_unreachable("cannot diagnose dependent access");
       llvm_unreachable("cannot diagnose dependent access");
@@ -1259,7 +1260,7 @@ static void DiagnoseBadAccess(Sema &S, SourceLocation Loc,
                               AccessTarget &Entity) {
                               AccessTarget &Entity) {
   const CXXRecordDecl *NamingClass = Entity.getNamingClass();
   const CXXRecordDecl *NamingClass = Entity.getNamingClass();
   const CXXRecordDecl *DeclaringClass = Entity.getDeclaringClass();
   const CXXRecordDecl *DeclaringClass = Entity.getDeclaringClass();
-  NamedDecl *D = (Entity.isMemberAccess() ? Entity.getTargetDecl() : 0);
+  NamedDecl *D = (Entity.isMemberAccess() ? Entity.getTargetDecl() : nullptr);
 
 
   S.Diag(Loc, Entity.getDiag())
   S.Diag(Loc, Entity.getDiag())
     << (Entity.getAccess() == AS_protected)
     << (Entity.getAccess() == AS_protected)
@@ -1872,7 +1873,7 @@ bool Sema::IsSimplyAccessible(NamedDecl *Decl, DeclContext *Ctx) {
 
 
     // If we are inside a class or category implementation, determine the
     // If we are inside a class or category implementation, determine the
     // interface we're in.
     // interface we're in.
-    ObjCInterfaceDecl *ClassOfMethodDecl = 0;
+    ObjCInterfaceDecl *ClassOfMethodDecl = nullptr;
     if (ObjCMethodDecl *MD = getCurMethodDecl())
     if (ObjCMethodDecl *MD = getCurMethodDecl())
       ClassOfMethodDecl =  MD->getClassInterface();
       ClassOfMethodDecl =  MD->getClassInterface();
     else if (FunctionDecl *FD = getCurFunctionDecl()) {
     else if (FunctionDecl *FD = getCurFunctionDecl()) {

+ 9 - 9
lib/Sema/SemaAttr.cpp

@@ -109,7 +109,7 @@ bool PragmaPackStack::pop(IdentifierInfo *Name, bool IsReset) {
 /// FreePackedContext - Deallocate and null out PackContext.
 /// FreePackedContext - Deallocate and null out PackContext.
 void Sema::FreePackedContext() {
 void Sema::FreePackedContext() {
   delete static_cast<PragmaPackStack*>(PackContext);
   delete static_cast<PragmaPackStack*>(PackContext);
-  PackContext = 0;
+  PackContext = nullptr;
 }
 }
 
 
 void Sema::AddAlignmentAttributesForRecord(RecordDecl *RD) {
 void Sema::AddAlignmentAttributesForRecord(RecordDecl *RD) {
@@ -143,7 +143,7 @@ void Sema::AddMsStructLayoutForRecord(RecordDecl *RD) {
 
 
 void Sema::ActOnPragmaOptionsAlign(PragmaOptionsAlignKind Kind,
 void Sema::ActOnPragmaOptionsAlign(PragmaOptionsAlignKind Kind,
                                    SourceLocation PragmaLoc) {
                                    SourceLocation PragmaLoc) {
-  if (PackContext == 0)
+  if (!PackContext)
     PackContext = new PragmaPackStack();
     PackContext = new PragmaPackStack();
 
 
   PragmaPackStack *Context = static_cast<PragmaPackStack*>(PackContext);
   PragmaPackStack *Context = static_cast<PragmaPackStack*>(PackContext);
@@ -155,14 +155,14 @@ void Sema::ActOnPragmaOptionsAlign(PragmaOptionsAlignKind Kind,
   case POAK_Native:
   case POAK_Native:
   case POAK_Power:
   case POAK_Power:
   case POAK_Natural:
   case POAK_Natural:
-    Context->push(0);
+    Context->push(nullptr);
     Context->setAlignment(0);
     Context->setAlignment(0);
     break;
     break;
 
 
     // Note that '#pragma options align=packed' is not equivalent to attribute
     // Note that '#pragma options align=packed' is not equivalent to attribute
     // packed, it has a different precedence relative to attribute aligned.
     // packed, it has a different precedence relative to attribute aligned.
   case POAK_Packed:
   case POAK_Packed:
-    Context->push(0);
+    Context->push(nullptr);
     Context->setAlignment(1);
     Context->setAlignment(1);
     break;
     break;
 
 
@@ -172,14 +172,14 @@ void Sema::ActOnPragmaOptionsAlign(PragmaOptionsAlignKind Kind,
       Diag(PragmaLoc, diag::err_pragma_options_align_mac68k_target_unsupported);
       Diag(PragmaLoc, diag::err_pragma_options_align_mac68k_target_unsupported);
       return;
       return;
     }
     }
-    Context->push(0);
+    Context->push(nullptr);
     Context->setAlignment(PackStackEntry::kMac68kAlignmentSentinel);
     Context->setAlignment(PackStackEntry::kMac68kAlignmentSentinel);
     break;
     break;
 
 
   case POAK_Reset:
   case POAK_Reset:
     // Reset just pops the top of the stack, or resets the current alignment to
     // Reset just pops the top of the stack, or resets the current alignment to
     // default.
     // default.
-    if (!Context->pop(0, /*IsReset=*/true)) {
+    if (!Context->pop(nullptr, /*IsReset=*/true)) {
       Diag(PragmaLoc, diag::warn_pragma_options_align_reset_failed)
       Diag(PragmaLoc, diag::warn_pragma_options_align_reset_failed)
         << "stack empty";
         << "stack empty";
     }
     }
@@ -211,7 +211,7 @@ void Sema::ActOnPragmaPack(PragmaPackKind Kind, IdentifierInfo *Name,
     AlignmentVal = (unsigned) Val.getZExtValue();
     AlignmentVal = (unsigned) Val.getZExtValue();
   }
   }
 
 
-  if (PackContext == 0)
+  if (!PackContext)
     PackContext = new PragmaPackStack();
     PackContext = new PragmaPackStack();
 
 
   PragmaPackStack *Context = static_cast<PragmaPackStack*>(PackContext);
   PragmaPackStack *Context = static_cast<PragmaPackStack*>(PackContext);
@@ -436,7 +436,7 @@ void Sema::ActOnPragmaUnused(const Token &IdTok, Scope *curScope,
 
 
   IdentifierInfo *Name = IdTok.getIdentifierInfo();
   IdentifierInfo *Name = IdTok.getIdentifierInfo();
   LookupResult Lookup(*this, Name, IdTok.getLocation(), LookupOrdinaryName);
   LookupResult Lookup(*this, Name, IdTok.getLocation(), LookupOrdinaryName);
-  LookupParsedName(Lookup, curScope, NULL, true);
+  LookupParsedName(Lookup, curScope, nullptr, true);
 
 
   if (Lookup.empty()) {
   if (Lookup.empty()) {
     Diag(PragmaLoc, diag::warn_pragma_unused_undeclared_var)
     Diag(PragmaLoc, diag::warn_pragma_unused_undeclared_var)
@@ -523,7 +523,7 @@ void Sema::AddPushedVisibilityAttribute(Decl *D) {
 /// FreeVisContext - Deallocate and null out VisContext.
 /// FreeVisContext - Deallocate and null out VisContext.
 void Sema::FreeVisContext() {
 void Sema::FreeVisContext() {
   delete static_cast<VisStack*>(VisContext);
   delete static_cast<VisStack*>(VisContext);
-  VisContext = 0;
+  VisContext = nullptr;
 }
 }
 
 
 static void PushPragmaVisibility(Sema &S, unsigned type, SourceLocation loc) {
 static void PushPragmaVisibility(Sema &S, unsigned type, SourceLocation loc) {

+ 19 - 19
lib/Sema/SemaCXXScopeSpec.cpp

@@ -29,7 +29,7 @@ using namespace clang;
 static CXXRecordDecl *getCurrentInstantiationOf(QualType T,
 static CXXRecordDecl *getCurrentInstantiationOf(QualType T,
                                                 DeclContext *CurContext) {
                                                 DeclContext *CurContext) {
   if (T.isNull())
   if (T.isNull())
-    return 0;
+    return nullptr;
 
 
   const Type *Ty = T->getCanonicalTypeInternal().getTypePtr();
   const Type *Ty = T->getCanonicalTypeInternal().getTypePtr();
   if (const RecordType *RecordTy = dyn_cast<RecordType>(Ty)) {
   if (const RecordType *RecordTy = dyn_cast<RecordType>(Ty)) {
@@ -38,11 +38,11 @@ static CXXRecordDecl *getCurrentInstantiationOf(QualType T,
         Record->isCurrentInstantiation(CurContext))
         Record->isCurrentInstantiation(CurContext))
       return Record;
       return Record;
 
 
-    return 0;
+    return nullptr;
   } else if (isa<InjectedClassNameType>(Ty))
   } else if (isa<InjectedClassNameType>(Ty))
     return cast<InjectedClassNameType>(Ty)->getDecl();
     return cast<InjectedClassNameType>(Ty)->getDecl();
   else
   else
-    return 0;
+    return nullptr;
 }
 }
 
 
 /// \brief Compute the DeclContext that is associated with the given type.
 /// \brief Compute the DeclContext that is associated with the given type.
@@ -76,7 +76,7 @@ DeclContext *Sema::computeDeclContext(QualType T) {
 DeclContext *Sema::computeDeclContext(const CXXScopeSpec &SS,
 DeclContext *Sema::computeDeclContext(const CXXScopeSpec &SS,
                                       bool EnteringContext) {
                                       bool EnteringContext) {
   if (!SS.isSet() || SS.isInvalid())
   if (!SS.isSet() || SS.isInvalid())
-    return 0;
+    return nullptr;
 
 
   NestedNameSpecifier *NNS = SS.getScopeRep();
   NestedNameSpecifier *NNS = SS.getScopeRep();
   if (NNS->isDependent()) {
   if (NNS->isDependent()) {
@@ -88,7 +88,7 @@ DeclContext *Sema::computeDeclContext(const CXXScopeSpec &SS,
     if (EnteringContext) {
     if (EnteringContext) {
       const Type *NNSType = NNS->getAsType();
       const Type *NNSType = NNS->getAsType();
       if (!NNSType) {
       if (!NNSType) {
-        return 0;
+        return nullptr;
       }
       }
 
 
       // Look through type alias templates, per C++0x [temp.dep.type]p1.
       // Look through type alias templates, per C++0x [temp.dep.type]p1.
@@ -126,7 +126,7 @@ DeclContext *Sema::computeDeclContext(const CXXScopeSpec &SS,
       }
       }
     }
     }
 
 
-    return 0;
+    return nullptr;
   }
   }
 
 
   switch (NNS->getKind()) {
   switch (NNS->getKind()) {
@@ -170,7 +170,7 @@ CXXRecordDecl *Sema::getCurrentInstantiationOf(NestedNameSpecifier *NNS) {
   assert(NNS->isDependent() && "Only dependent nested-name-specifier allowed");
   assert(NNS->isDependent() && "Only dependent nested-name-specifier allowed");
 
 
   if (!NNS->getAsType())
   if (!NNS->getAsType())
-    return 0;
+    return nullptr;
 
 
   QualType T = QualType(NNS->getAsType(), 0);
   QualType T = QualType(NNS->getAsType(), 0);
   return ::getCurrentInstantiationOf(T, CurContext);
   return ::getCurrentInstantiationOf(T, CurContext);
@@ -187,7 +187,7 @@ CXXRecordDecl *Sema::getCurrentInstantiationOf(NestedNameSpecifier *NNS) {
 /// will attempt to instantiate that class template.
 /// will attempt to instantiate that class template.
 bool Sema::RequireCompleteDeclContext(CXXScopeSpec &SS,
 bool Sema::RequireCompleteDeclContext(CXXScopeSpec &SS,
                                       DeclContext *DC) {
                                       DeclContext *DC) {
-  assert(DC != 0 && "given null context");
+  assert(DC && "given null context");
 
 
   TagDecl *tag = dyn_cast<TagDecl>(DC);
   TagDecl *tag = dyn_cast<TagDecl>(DC);
 
 
@@ -282,13 +282,13 @@ bool Sema::isAcceptableNestedNameSpecifier(const NamedDecl *SD) {
 /// name lookup.
 /// name lookup.
 NamedDecl *Sema::FindFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS) {
 NamedDecl *Sema::FindFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS) {
   if (!S || !NNS)
   if (!S || !NNS)
-    return 0;
+    return nullptr;
 
 
   while (NNS->getPrefix())
   while (NNS->getPrefix())
     NNS = NNS->getPrefix();
     NNS = NNS->getPrefix();
 
 
   if (NNS->getKind() != NestedNameSpecifier::Identifier)
   if (NNS->getKind() != NestedNameSpecifier::Identifier)
-    return 0;
+    return nullptr;
 
 
   LookupResult Found(*this, NNS->getAsIdentifier(), SourceLocation(),
   LookupResult Found(*this, NNS->getAsIdentifier(), SourceLocation(),
                      LookupNestedNameSpecifierName);
                      LookupNestedNameSpecifierName);
@@ -296,13 +296,13 @@ NamedDecl *Sema::FindFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS) {
   assert(!Found.isAmbiguous() && "Cannot handle ambiguities here yet");
   assert(!Found.isAmbiguous() && "Cannot handle ambiguities here yet");
 
 
   if (!Found.isSingleResult())
   if (!Found.isSingleResult())
-    return 0;
+    return nullptr;
 
 
   NamedDecl *Result = Found.getFoundDecl();
   NamedDecl *Result = Found.getFoundDecl();
   if (isAcceptableNestedNameSpecifier(Result))
   if (isAcceptableNestedNameSpecifier(Result))
     return Result;
     return Result;
 
 
-  return 0;
+  return nullptr;
 }
 }
 
 
 bool Sema::isNonTypeNestedNameSpecifier(Scope *S, CXXScopeSpec &SS,
 bool Sema::isNonTypeNestedNameSpecifier(Scope *S, CXXScopeSpec &SS,
@@ -313,7 +313,7 @@ bool Sema::isNonTypeNestedNameSpecifier(Scope *S, CXXScopeSpec &SS,
   LookupResult Found(*this, &II, IdLoc, LookupNestedNameSpecifierName);
   LookupResult Found(*this, &II, IdLoc, LookupNestedNameSpecifierName);
   
   
   // Determine where to perform name lookup
   // Determine where to perform name lookup
-  DeclContext *LookupCtx = 0;
+  DeclContext *LookupCtx = nullptr;
   bool isDependent = false;
   bool isDependent = false;
   if (!ObjectType.isNull()) {
   if (!ObjectType.isNull()) {
     // This nested-name-specifier occurs in a member access expression, e.g.,
     // This nested-name-specifier occurs in a member access expression, e.g.,
@@ -423,7 +423,7 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S,
                      LookupNestedNameSpecifierName);
                      LookupNestedNameSpecifierName);
 
 
   // Determine where to perform name lookup
   // Determine where to perform name lookup
-  DeclContext *LookupCtx = 0;
+  DeclContext *LookupCtx = nullptr;
   bool isDependent = false;
   bool isDependent = false;
   if (IsCorrectedToColon)
   if (IsCorrectedToColon)
     *IsCorrectedToColon = false;
     *IsCorrectedToColon = false;
@@ -746,7 +746,7 @@ bool Sema::ActOnCXXNestedNameSpecifier(Scope *S,
   return BuildCXXNestedNameSpecifier(S, Identifier, IdentifierLoc, CCLoc,
   return BuildCXXNestedNameSpecifier(S, Identifier, IdentifierLoc, CCLoc,
                                      GetTypeFromParser(ObjectType),
                                      GetTypeFromParser(ObjectType),
                                      EnteringContext, SS, 
                                      EnteringContext, SS, 
-                                     /*ScopeLookupResult=*/0, false,
+                                     /*ScopeLookupResult=*/nullptr, false,
                                      IsCorrectedToColon);
                                      IsCorrectedToColon);
 }
 }
 
 
@@ -787,11 +787,11 @@ bool Sema::IsInvalidUnlessNestedName(Scope *S, CXXScopeSpec &SS,
                                      bool EnteringContext) {
                                      bool EnteringContext) {
   if (SS.isInvalid())
   if (SS.isInvalid())
     return false;
     return false;
-  
+
   return !BuildCXXNestedNameSpecifier(S, Identifier, IdentifierLoc, ColonLoc,
   return !BuildCXXNestedNameSpecifier(S, Identifier, IdentifierLoc, ColonLoc,
                                       GetTypeFromParser(ObjectType),
                                       GetTypeFromParser(ObjectType),
                                       EnteringContext, SS, 
                                       EnteringContext, SS, 
-                                      /*ScopeLookupResult=*/0, true);
+                                      /*ScopeLookupResult=*/nullptr, true);
 }
 }
 
 
 bool Sema::ActOnCXXNestedNameSpecifier(Scope *S,
 bool Sema::ActOnCXXNestedNameSpecifier(Scope *S,
@@ -894,8 +894,8 @@ namespace {
 
 
 void *Sema::SaveNestedNameSpecifierAnnotation(CXXScopeSpec &SS) {
 void *Sema::SaveNestedNameSpecifierAnnotation(CXXScopeSpec &SS) {
   if (SS.isEmpty() || SS.isInvalid())
   if (SS.isEmpty() || SS.isInvalid())
-    return 0;
-  
+    return nullptr;
+
   void *Mem = Context.Allocate((sizeof(NestedNameSpecifierAnnotation) +
   void *Mem = Context.Allocate((sizeof(NestedNameSpecifierAnnotation) +
                                                         SS.location_size()),
                                                         SS.location_size()),
                                llvm::alignOf<NestedNameSpecifierAnnotation>());
                                llvm::alignOf<NestedNameSpecifierAnnotation>());

+ 5 - 5
lib/Sema/SemaCast.cpp

@@ -90,7 +90,7 @@ namespace {
       if (IsARCUnbridgedCast) {
       if (IsARCUnbridgedCast) {
         castExpr = ImplicitCastExpr::Create(Self.Context,
         castExpr = ImplicitCastExpr::Create(Self.Context,
                                             Self.Context.ARCUnbridgedCastTy,
                                             Self.Context.ARCUnbridgedCastTy,
-                                            CK_Dependent, castExpr, 0,
+                                            CK_Dependent, castExpr, nullptr,
                                             castExpr->getValueKind());
                                             castExpr->getValueKind());
       }
       }
       return Self.Owned(castExpr);
       return Self.Owned(castExpr);
@@ -286,7 +286,7 @@ Sema::BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind,
     }
     }
     return Op.complete(CXXReinterpretCastExpr::Create(Context, Op.ResultType,
     return Op.complete(CXXReinterpretCastExpr::Create(Context, Op.ResultType,
                                     Op.ValueKind, Op.Kind, Op.SrcExpr.take(),
                                     Op.ValueKind, Op.Kind, Op.SrcExpr.take(),
-                                                      0, DestTInfo, OpLoc,
+                                                      nullptr, DestTInfo, OpLoc,
                                                       Parens.getEnd(),
                                                       Parens.getEnd(),
                                                       AngleBrackets));
                                                       AngleBrackets));
   }
   }
@@ -549,7 +549,7 @@ void CastOperation::CheckDynamicCast() {
 
 
   QualType DestPointee;
   QualType DestPointee;
   const PointerType *DestPointer = DestType->getAs<PointerType>();
   const PointerType *DestPointer = DestType->getAs<PointerType>();
-  const ReferenceType *DestReference = 0;
+  const ReferenceType *DestReference = nullptr;
   if (DestPointer) {
   if (DestPointer) {
     DestPointee = DestPointer->getPointeeType();
     DestPointee = DestPointer->getPointeeType();
   } else if ((DestReference = DestType->getAs<ReferenceType>())) {
   } else if ((DestReference = DestType->getAs<ReferenceType>())) {
@@ -1277,7 +1277,7 @@ TryStaticDowncast(Sema &Self, CanQualType SrcType, CanQualType DestType,
     return TC_Failed;
     return TC_Failed;
   }
   }
 
 
-  if (Paths.getDetectedVirtual() != 0) {
+  if (Paths.getDetectedVirtual() != nullptr) {
     QualType VirtualBase(Paths.getDetectedVirtual(), 0);
     QualType VirtualBase(Paths.getDetectedVirtual(), 0);
     Self.Diag(OpRange.getBegin(), diag::err_static_downcast_via_virtual)
     Self.Diag(OpRange.getBegin(), diag::err_static_downcast_via_virtual)
       << OrigSrcType << OrigDestType << VirtualBase << OpRange;
       << OrigSrcType << OrigDestType << VirtualBase << OpRange;
@@ -1739,7 +1739,7 @@ static TryCastResult TryReinterpretCast(Sema &Self, ExprResult &SrcExpr,
     //   same effect as the conversion *reinterpret_cast<T*>(&x) with the
     //   same effect as the conversion *reinterpret_cast<T*>(&x) with the
     //   built-in & and * operators.
     //   built-in & and * operators.
 
 
-    const char *inappropriate = 0;
+    const char *inappropriate = nullptr;
     switch (SrcExpr.get()->getObjectKind()) {
     switch (SrcExpr.get()->getObjectKind()) {
     case OK_Ordinary:
     case OK_Ordinary:
       break;
       break;

+ 55 - 54
lib/Sema/SemaChecking.cpp

@@ -871,12 +871,13 @@ bool Sema::CheckPointerCall(NamedDecl *NDecl, CallExpr *TheCall,
 /// Checks function calls when a FunctionDecl or a NamedDecl is not available,
 /// Checks function calls when a FunctionDecl or a NamedDecl is not available,
 /// such as function pointers returned from functions.
 /// such as function pointers returned from functions.
 bool Sema::CheckOtherCall(CallExpr *TheCall, const FunctionProtoType *Proto) {
 bool Sema::CheckOtherCall(CallExpr *TheCall, const FunctionProtoType *Proto) {
-  VariadicCallType CallType = getVariadicCallType(/*FDecl=*/0, Proto,
+  VariadicCallType CallType = getVariadicCallType(/*FDecl=*/nullptr, Proto,
                                                   TheCall->getCallee());
                                                   TheCall->getCallee());
   unsigned NumParams = Proto ? Proto->getNumParams() : 0;
   unsigned NumParams = Proto ? Proto->getNumParams() : 0;
 
 
-  checkCall(/*FDecl=*/0, llvm::makeArrayRef<const Expr *>(
-                             TheCall->getArgs(), TheCall->getNumArgs()),
+  checkCall(/*FDecl=*/nullptr,
+            llvm::makeArrayRef<const Expr *>(TheCall->getArgs(),
+                                             TheCall->getNumArgs()),
             NumParams, /*IsMemberFunction=*/false, TheCall->getRParenLoc(),
             NumParams, /*IsMemberFunction=*/false, TheCall->getRParenLoc(),
             TheCall->getCallee()->getSourceRange(), CallType);
             TheCall->getCallee()->getSourceRange(), CallType);
 
 
@@ -1530,7 +1531,7 @@ Sema::SemaBuiltinAtomicOverloaded(ExprResult TheCallResult) {
     LookupName(Res, TUScope, /*AllowBuiltinCreation=*/true);
     LookupName(Res, TUScope, /*AllowBuiltinCreation=*/true);
     assert(Res.getFoundDecl());
     assert(Res.getFoundDecl());
     NewBuiltinDecl = dyn_cast<FunctionDecl>(Res.getFoundDecl());
     NewBuiltinDecl = dyn_cast<FunctionDecl>(Res.getFoundDecl());
-    if (NewBuiltinDecl == 0)
+    if (!NewBuiltinDecl)
       return ExprError();
       return ExprError();
   }
   }
 
 
@@ -1772,7 +1773,7 @@ bool Sema::SemaBuiltinFPClassification(CallExpr *TheCall, unsigned NumArgs) {
     if (CastArg->getType()->isSpecificBuiltinType(BuiltinType::Float)) {
     if (CastArg->getType()->isSpecificBuiltinType(BuiltinType::Float)) {
       assert(Cast->getType()->isSpecificBuiltinType(BuiltinType::Double) &&
       assert(Cast->getType()->isSpecificBuiltinType(BuiltinType::Double) &&
              "promotion from float to double is the only expected cast here");
              "promotion from float to double is the only expected cast here");
-      Cast->setSubExpr(0);
+      Cast->setSubExpr(nullptr);
       TheCall->setArg(NumArgs-1, CastArg);
       TheCall->setArg(NumArgs-1, CastArg);
     }
     }
   }
   }
@@ -1857,7 +1858,7 @@ ExprResult Sema::SemaBuiltinShuffleVector(CallExpr *TheCall) {
 
 
   for (unsigned i = 0, e = TheCall->getNumArgs(); i != e; i++) {
   for (unsigned i = 0, e = TheCall->getNumArgs(); i != e; i++) {
     exprs.push_back(TheCall->getArg(i));
     exprs.push_back(TheCall->getArg(i));
-    TheCall->setArg(i, 0);
+    TheCall->setArg(i, nullptr);
   }
   }
 
 
   return Owned(new (Context) ShuffleVectorExpr(Context, exprs, resType,
   return Owned(new (Context) ShuffleVectorExpr(Context, exprs, resType,
@@ -2145,7 +2146,7 @@ checkFormatStringExpr(Sema &S, const Expr *E, ArrayRef<const Expr *> Args,
   }
   }
   case Stmt::ObjCStringLiteralClass:
   case Stmt::ObjCStringLiteralClass:
   case Stmt::StringLiteralClass: {
   case Stmt::StringLiteralClass: {
-    const StringLiteral *StrE = NULL;
+    const StringLiteral *StrE = nullptr;
 
 
     if (const ObjCStringLiteral *ObjCFExpr = dyn_cast<ObjCStringLiteral>(E))
     if (const ObjCStringLiteral *ObjCFExpr = dyn_cast<ObjCStringLiteral>(E))
       StrE = ObjCFExpr->getString();
       StrE = ObjCFExpr->getString();
@@ -3760,8 +3761,8 @@ static unsigned getAbsoluteValueFunctionKind(const FunctionDecl *FDecl) {
 static void emitReplacement(Sema &S, SourceLocation Loc, SourceRange Range,
 static void emitReplacement(Sema &S, SourceLocation Loc, SourceRange Range,
                             unsigned AbsKind, QualType ArgType) {
                             unsigned AbsKind, QualType ArgType) {
   bool EmitHeaderHint = true;
   bool EmitHeaderHint = true;
-  const char *HeaderName = 0;
-  const char *FunctionName = 0;
+  const char *HeaderName = nullptr;
+  const char *FunctionName = nullptr;
   if (S.getLangOpts().CPlusPlus && !ArgType->isAnyComplexType()) {
   if (S.getLangOpts().CPlusPlus && !ArgType->isAnyComplexType()) {
     FunctionName = "std::abs";
     FunctionName = "std::abs";
     if (ArgType->isIntegralOrEnumerationType()) {
     if (ArgType->isIntegralOrEnumerationType()) {
@@ -3779,7 +3780,7 @@ static void emitReplacement(Sema &S, SourceLocation Loc, SourceRange Range,
       S.LookupQualifiedName(R, Std);
       S.LookupQualifiedName(R, Std);
 
 
       for (const auto *I : R) {
       for (const auto *I : R) {
-        const FunctionDecl *FDecl = 0;
+        const FunctionDecl *FDecl = nullptr;
         if (const UsingShadowDecl *UsingD = dyn_cast<UsingShadowDecl>(I)) {
         if (const UsingShadowDecl *UsingD = dyn_cast<UsingShadowDecl>(I)) {
           FDecl = dyn_cast<FunctionDecl>(UsingD->getTargetDecl());
           FDecl = dyn_cast<FunctionDecl>(UsingD->getTargetDecl());
         } else {
         } else {
@@ -3981,7 +3982,7 @@ static const Expr *getSizeOfExprArg(const Expr* E) {
     if (SizeOf->getKind() == clang::UETT_SizeOf && !SizeOf->isArgumentType())
     if (SizeOf->getKind() == clang::UETT_SizeOf && !SizeOf->isArgumentType())
       return SizeOf->getArgumentExpr()->IgnoreParenImpCasts();
       return SizeOf->getArgumentExpr()->IgnoreParenImpCasts();
 
 
-  return 0;
+  return nullptr;
 }
 }
 
 
 /// \brief If E is a sizeof expression, returns its argument type.
 /// \brief If E is a sizeof expression, returns its argument type.
@@ -4203,7 +4204,7 @@ void Sema::CheckStrlcpycatArguments(const CallExpr *Call,
 
 
   const Expr *SrcArg = ignoreLiteralAdditions(Call->getArg(1), Context);
   const Expr *SrcArg = ignoreLiteralAdditions(Call->getArg(1), Context);
   const Expr *SizeArg = ignoreLiteralAdditions(Call->getArg(2), Context);
   const Expr *SizeArg = ignoreLiteralAdditions(Call->getArg(2), Context);
-  const Expr *CompareWithSrc = NULL;
+  const Expr *CompareWithSrc = nullptr;
 
 
   if (CheckMemorySizeofForComparison(*this, SizeArg, FnName,
   if (CheckMemorySizeofForComparison(*this, SizeArg, FnName,
                                      Call->getLocStart(), Call->getRParenLoc()))
                                      Call->getLocStart(), Call->getRParenLoc()))
@@ -4252,7 +4253,7 @@ void Sema::CheckStrlcpycatArguments(const CallExpr *Call,
   SmallString<128> sizeString;
   SmallString<128> sizeString;
   llvm::raw_svector_ostream OS(sizeString);
   llvm::raw_svector_ostream OS(sizeString);
   OS << "sizeof(";
   OS << "sizeof(";
-  DstArg->printPretty(OS, 0, getPrintingPolicy());
+  DstArg->printPretty(OS, nullptr, getPrintingPolicy());
   OS << ")";
   OS << ")";
   
   
   Diag(OriginalSizeArg->getLocStart(), diag::note_strlcpycat_wrong_size)
   Diag(OriginalSizeArg->getLocStart(), diag::note_strlcpycat_wrong_size)
@@ -4272,10 +4273,10 @@ static const Expr *getStrlenExprArg(const Expr *E) {
   if (const CallExpr *CE = dyn_cast<CallExpr>(E)) {
   if (const CallExpr *CE = dyn_cast<CallExpr>(E)) {
     const FunctionDecl *FD = CE->getDirectCallee();
     const FunctionDecl *FD = CE->getDirectCallee();
     if (!FD || FD->getMemoryFunctionKind() != Builtin::BIstrlen)
     if (!FD || FD->getMemoryFunctionKind() != Builtin::BIstrlen)
-      return 0;
+      return nullptr;
     return CE->getArg(0)->IgnoreParenCasts();
     return CE->getArg(0)->IgnoreParenCasts();
   }
   }
-  return 0;
+  return nullptr;
 }
 }
 
 
 // Warn on anti-patterns as the 'size' argument to strncat.
 // Warn on anti-patterns as the 'size' argument to strncat.
@@ -4353,10 +4354,10 @@ void Sema::CheckStrncatArguments(const CallExpr *CE,
   SmallString<128> sizeString;
   SmallString<128> sizeString;
   llvm::raw_svector_ostream OS(sizeString);
   llvm::raw_svector_ostream OS(sizeString);
   OS << "sizeof(";
   OS << "sizeof(";
-  DstArg->printPretty(OS, 0, getPrintingPolicy());
+  DstArg->printPretty(OS, nullptr, getPrintingPolicy());
   OS << ") - ";
   OS << ") - ";
   OS << "strlen(";
   OS << "strlen(";
-  DstArg->printPretty(OS, 0, getPrintingPolicy());
+  DstArg->printPretty(OS, nullptr, getPrintingPolicy());
   OS << ") - 1";
   OS << ") - 1";
 
 
   Diag(SL, diag::note_strncat_wrong_size)
   Diag(SL, diag::note_strncat_wrong_size)
@@ -4376,19 +4377,19 @@ static void
 CheckReturnStackAddr(Sema &S, Expr *RetValExp, QualType lhsType,
 CheckReturnStackAddr(Sema &S, Expr *RetValExp, QualType lhsType,
                      SourceLocation ReturnLoc) {
                      SourceLocation ReturnLoc) {
 
 
-  Expr *stackE = 0;
+  Expr *stackE = nullptr;
   SmallVector<DeclRefExpr *, 8> refVars;
   SmallVector<DeclRefExpr *, 8> refVars;
 
 
   // Perform checking for returned stack addresses, local blocks,
   // Perform checking for returned stack addresses, local blocks,
   // label addresses or references to temporaries.
   // label addresses or references to temporaries.
   if (lhsType->isPointerType() ||
   if (lhsType->isPointerType() ||
       (!S.getLangOpts().ObjCAutoRefCount && lhsType->isBlockPointerType())) {
       (!S.getLangOpts().ObjCAutoRefCount && lhsType->isBlockPointerType())) {
-    stackE = EvalAddr(RetValExp, refVars, /*ParentDecl=*/0);
+    stackE = EvalAddr(RetValExp, refVars, /*ParentDecl=*/nullptr);
   } else if (lhsType->isReferenceType()) {
   } else if (lhsType->isReferenceType()) {
-    stackE = EvalVal(RetValExp, refVars, /*ParentDecl=*/0);
+    stackE = EvalVal(RetValExp, refVars, /*ParentDecl=*/nullptr);
   }
   }
 
 
-  if (stackE == 0)
+  if (!stackE)
     return; // Nothing suspicious was found.
     return; // Nothing suspicious was found.
 
 
   SourceLocation diagLoc;
   SourceLocation diagLoc;
@@ -4462,7 +4463,7 @@ CheckReturnStackAddr(Sema &S, Expr *RetValExp, QualType lhsType,
 static Expr *EvalAddr(Expr *E, SmallVectorImpl<DeclRefExpr *> &refVars,
 static Expr *EvalAddr(Expr *E, SmallVectorImpl<DeclRefExpr *> &refVars,
                       Decl *ParentDecl) {
                       Decl *ParentDecl) {
   if (E->isTypeDependent())
   if (E->isTypeDependent())
-    return NULL;
+    return nullptr;
 
 
   // We should only be called for evaluating pointer expressions.
   // We should only be called for evaluating pointer expressions.
   assert((E->getType()->isAnyPointerType() ||
   assert((E->getType()->isAnyPointerType() ||
@@ -4481,7 +4482,7 @@ static Expr *EvalAddr(Expr *E, SmallVectorImpl<DeclRefExpr *> &refVars,
 
 
     // If we leave the immediate function, the lifetime isn't about to end.
     // If we leave the immediate function, the lifetime isn't about to end.
     if (DR->refersToEnclosingLocal())
     if (DR->refersToEnclosingLocal())
-      return 0;
+      return nullptr;
 
 
     if (VarDecl *V = dyn_cast<VarDecl>(DR->getDecl()))
     if (VarDecl *V = dyn_cast<VarDecl>(DR->getDecl()))
       // If this is a reference variable, follow through to the expression that
       // If this is a reference variable, follow through to the expression that
@@ -4493,7 +4494,7 @@ static Expr *EvalAddr(Expr *E, SmallVectorImpl<DeclRefExpr *> &refVars,
         return EvalAddr(V->getInit(), refVars, ParentDecl);
         return EvalAddr(V->getInit(), refVars, ParentDecl);
       }
       }
 
 
-    return NULL;
+    return nullptr;
   }
   }
 
 
   case Stmt::UnaryOperatorClass: {
   case Stmt::UnaryOperatorClass: {
@@ -4504,7 +4505,7 @@ static Expr *EvalAddr(Expr *E, SmallVectorImpl<DeclRefExpr *> &refVars,
     if (U->getOpcode() == UO_AddrOf)
     if (U->getOpcode() == UO_AddrOf)
       return EvalVal(U->getSubExpr(), refVars, ParentDecl);
       return EvalVal(U->getSubExpr(), refVars, ParentDecl);
     else
     else
-      return NULL;
+      return nullptr;
   }
   }
 
 
   case Stmt::BinaryOperatorClass: {
   case Stmt::BinaryOperatorClass: {
@@ -4514,7 +4515,7 @@ static Expr *EvalAddr(Expr *E, SmallVectorImpl<DeclRefExpr *> &refVars,
     BinaryOperatorKind op = B->getOpcode();
     BinaryOperatorKind op = B->getOpcode();
 
 
     if (op != BO_Add && op != BO_Sub)
     if (op != BO_Add && op != BO_Sub)
-      return NULL;
+      return nullptr;
 
 
     Expr *Base = B->getLHS();
     Expr *Base = B->getLHS();
 
 
@@ -4542,7 +4543,7 @@ static Expr *EvalAddr(Expr *E, SmallVectorImpl<DeclRefExpr *> &refVars,
 
 
     // In C++, we can have a throw-expression, which has 'void' type.
     // In C++, we can have a throw-expression, which has 'void' type.
     if (C->getRHS()->getType()->isVoidType())
     if (C->getRHS()->getType()->isVoidType())
-      return 0;
+      return nullptr;
 
 
     return EvalAddr(C->getRHS(), refVars, ParentDecl);
     return EvalAddr(C->getRHS(), refVars, ParentDecl);
   }
   }
@@ -4550,7 +4551,7 @@ static Expr *EvalAddr(Expr *E, SmallVectorImpl<DeclRefExpr *> &refVars,
   case Stmt::BlockExprClass:
   case Stmt::BlockExprClass:
     if (cast<BlockExpr>(E)->getBlockDecl()->hasCaptures())
     if (cast<BlockExpr>(E)->getBlockDecl()->hasCaptures())
       return E; // local block.
       return E; // local block.
-    return NULL;
+    return nullptr;
 
 
   case Stmt::AddrLabelExprClass:
   case Stmt::AddrLabelExprClass:
     return E; // address of label.
     return E; // address of label.
@@ -4587,7 +4588,7 @@ static Expr *EvalAddr(Expr *E, SmallVectorImpl<DeclRefExpr *> &refVars,
       return EvalVal(SubExpr, refVars, ParentDecl);
       return EvalVal(SubExpr, refVars, ParentDecl);
 
 
     default:
     default:
-      return 0;
+      return nullptr;
     }
     }
   }
   }
 
 
@@ -4601,7 +4602,7 @@ static Expr *EvalAddr(Expr *E, SmallVectorImpl<DeclRefExpr *> &refVars,
       
       
   // Everything else: we simply don't reason about them.
   // Everything else: we simply don't reason about them.
   default:
   default:
-    return NULL;
+    return nullptr;
   }
   }
 }
 }
 
 
@@ -4627,7 +4628,7 @@ do {
       E = IE->getSubExpr();
       E = IE->getSubExpr();
       continue;
       continue;
     }
     }
-    return NULL;
+    return nullptr;
   }
   }
 
 
   case Stmt::ExprWithCleanupsClass:
   case Stmt::ExprWithCleanupsClass:
@@ -4641,7 +4642,7 @@ do {
 
 
     // If we leave the immediate function, the lifetime isn't about to end.
     // If we leave the immediate function, the lifetime isn't about to end.
     if (DR->refersToEnclosingLocal())
     if (DR->refersToEnclosingLocal())
-      return 0;
+      return nullptr;
 
 
     if (VarDecl *V = dyn_cast<VarDecl>(DR->getDecl())) {
     if (VarDecl *V = dyn_cast<VarDecl>(DR->getDecl())) {
       // Check if it refers to itself, e.g. "int& i = i;".
       // Check if it refers to itself, e.g. "int& i = i;".
@@ -4662,7 +4663,7 @@ do {
       }
       }
     }
     }
 
 
-    return NULL;
+    return nullptr;
   }
   }
 
 
   case Stmt::UnaryOperatorClass: {
   case Stmt::UnaryOperatorClass: {
@@ -4674,7 +4675,7 @@ do {
     if (U->getOpcode() == UO_Deref)
     if (U->getOpcode() == UO_Deref)
       return EvalAddr(U->getSubExpr(), refVars, ParentDecl);
       return EvalAddr(U->getSubExpr(), refVars, ParentDecl);
 
 
-    return NULL;
+    return nullptr;
   }
   }
 
 
   case Stmt::ArraySubscriptExprClass: {
   case Stmt::ArraySubscriptExprClass: {
@@ -4699,7 +4700,7 @@ do {
 
 
     // In C++, we can have a throw-expression, which has 'void' type.
     // In C++, we can have a throw-expression, which has 'void' type.
     if (C->getRHS()->getType()->isVoidType())
     if (C->getRHS()->getType()->isVoidType())
-      return 0;
+      return nullptr;
 
 
     return EvalVal(C->getRHS(), refVars, ParentDecl);
     return EvalVal(C->getRHS(), refVars, ParentDecl);
   }
   }
@@ -4710,12 +4711,12 @@ do {
 
 
     // Check for indirect access.  We only want direct field accesses.
     // Check for indirect access.  We only want direct field accesses.
     if (M->isArrow())
     if (M->isArrow())
-      return NULL;
+      return nullptr;
 
 
     // Check whether the member type is itself a reference, in which case
     // Check whether the member type is itself a reference, in which case
     // we're not going to refer to the member, but to what the member refers to.
     // we're not going to refer to the member, but to what the member refers to.
     if (M->getMemberDecl()->getType()->isReferenceType())
     if (M->getMemberDecl()->getType()->isReferenceType())
-      return NULL;
+      return nullptr;
 
 
     return EvalVal(M->getBase(), refVars, ParentDecl);
     return EvalVal(M->getBase(), refVars, ParentDecl);
   }
   }
@@ -4735,7 +4736,7 @@ do {
       return E;
       return E;
 
 
     // Everything else: we simply don't reason about them.
     // Everything else: we simply don't reason about them.
-    return NULL;
+    return nullptr;
   }
   }
 } while (true);
 } while (true);
 }
 }
@@ -5467,7 +5468,7 @@ static void DiagnoseOutOfRangeComparison(Sema &S, BinaryOperator *E,
 
 
   // If this is a comparison to an enum constant, include that
   // If this is a comparison to an enum constant, include that
   // constant in the diagnostic.
   // constant in the diagnostic.
-  const EnumConstantDecl *ED = 0;
+  const EnumConstantDecl *ED = nullptr;
   if (const DeclRefExpr *DR = dyn_cast<DeclRefExpr>(Constant))
   if (const DeclRefExpr *DR = dyn_cast<DeclRefExpr>(Constant))
     ED = dyn_cast<EnumConstantDecl>(DR->getDecl());
     ED = dyn_cast<EnumConstantDecl>(DR->getDecl());
 
 
@@ -5772,7 +5773,7 @@ void CheckImplicitArgumentConversions(Sema &S, CallExpr *TheCall,
 }
 }
 
 
 void CheckImplicitConversion(Sema &S, Expr *E, QualType T,
 void CheckImplicitConversion(Sema &S, Expr *E, QualType T,
-                             SourceLocation CC, bool *ICContext = 0) {
+                             SourceLocation CC, bool *ICContext = nullptr) {
   if (E->isTypeDependent() || E->isValueDependent()) return;
   if (E->isTypeDependent() || E->isValueDependent()) return;
 
 
   const Type *Source = S.Context.getCanonicalType(E->getType()).getTypePtr();
   const Type *Source = S.Context.getCanonicalType(E->getType()).getTypePtr();
@@ -6178,7 +6179,7 @@ void Sema::DiagnoseAlwaysNonNullPointer(Expr *E,
   }
   }
 
 
   // Expect to find a single Decl.  Skip anything more complicated.
   // Expect to find a single Decl.  Skip anything more complicated.
-  ValueDecl *D = 0;
+  ValueDecl *D = nullptr;
   if (DeclRefExpr *R = dyn_cast<DeclRefExpr>(E)) {
   if (DeclRefExpr *R = dyn_cast<DeclRefExpr>(E)) {
     D = R->getDecl();
     D = R->getDecl();
   } else if (MemberExpr *M = dyn_cast<MemberExpr>(E)) {
   } else if (MemberExpr *M = dyn_cast<MemberExpr>(E)) {
@@ -6209,7 +6210,7 @@ void Sema::DiagnoseAlwaysNonNullPointer(Expr *E,
   // Pretty print the expression for the diagnostic.
   // Pretty print the expression for the diagnostic.
   std::string Str;
   std::string Str;
   llvm::raw_string_ostream S(Str);
   llvm::raw_string_ostream S(Str);
-  E->printPretty(S, 0, getPrintingPolicy());
+  E->printPretty(S, nullptr, getPrintingPolicy());
 
 
   unsigned DiagID = IsCompare ? diag::warn_null_pointer_compare
   unsigned DiagID = IsCompare ? diag::warn_null_pointer_compare
                               : diag::warn_impcast_pointer_to_bool;
                               : diag::warn_impcast_pointer_to_bool;
@@ -6384,7 +6385,7 @@ class SequenceChecker : public EvaluatedExprVisitor<SequenceChecker> {
   };
   };
 
 
   struct Usage {
   struct Usage {
-    Usage() : Use(0), Seq() {}
+    Usage() : Use(nullptr), Seq() {}
     Expr *Use;
     Expr *Use;
     SequenceTree::Seq Seq;
     SequenceTree::Seq Seq;
   };
   };
@@ -6484,7 +6485,7 @@ class SequenceChecker : public EvaluatedExprVisitor<SequenceChecker> {
     } else if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E))
     } else if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E))
       // FIXME: If this is a reference, map through to its value.
       // FIXME: If this is a reference, map through to its value.
       return DRE->getDecl();
       return DRE->getDecl();
-    return 0;
+    return nullptr;
   }
   }
 
 
   /// \brief Note that an object was modified or used by an expression.
   /// \brief Note that an object was modified or used by an expression.
@@ -6544,8 +6545,8 @@ class SequenceChecker : public EvaluatedExprVisitor<SequenceChecker> {
 
 
 public:
 public:
   SequenceChecker(Sema &S, Expr *E, SmallVectorImpl<Expr *> &WorkList)
   SequenceChecker(Sema &S, Expr *E, SmallVectorImpl<Expr *> &WorkList)
-      : Base(S.Context), SemaRef(S), Region(Tree.root()), ModAsSideEffect(0),
-        WorkList(WorkList), EvalTracker(0) {
+      : Base(S.Context), SemaRef(S), Region(Tree.root()),
+        ModAsSideEffect(nullptr), WorkList(WorkList), EvalTracker(nullptr) {
     Visit(E);
     Visit(E);
   }
   }
 
 
@@ -6830,7 +6831,7 @@ bool Sema::CheckParmsForFunctionDef(ParmVarDecl *const *P,
     // C99 6.9.1p5: If the declarator includes a parameter type list, the
     // C99 6.9.1p5: If the declarator includes a parameter type list, the
     // declaration of each parameter shall include an identifier.
     // declaration of each parameter shall include an identifier.
     if (CheckParameterNames &&
     if (CheckParameterNames &&
-        Param->getIdentifier() == 0 &&
+        Param->getIdentifier() == nullptr &&
         !Param->isImplicit() &&
         !Param->isImplicit() &&
         !getLangOpts().CPlusPlus)
         !getLangOpts().CPlusPlus)
       Diag(Param->getLocation(), diag::err_parameter_name_omitted);
       Diag(Param->getLocation(), diag::err_parameter_name_omitted);
@@ -6997,7 +6998,7 @@ void Sema::CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
   if (IndexNegated)
   if (IndexNegated)
     index = -index;
     index = -index;
 
 
-  const NamedDecl *ND = NULL;
+  const NamedDecl *ND = nullptr;
   if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(BaseExpr))
   if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(BaseExpr))
     ND = dyn_cast<NamedDecl>(DRE->getDecl());
     ND = dyn_cast<NamedDecl>(DRE->getDecl());
   if (const MemberExpr *ME = dyn_cast<MemberExpr>(BaseExpr))
   if (const MemberExpr *ME = dyn_cast<MemberExpr>(BaseExpr))
@@ -7140,7 +7141,7 @@ void Sema::CheckArrayAccess(const Expr *expr) {
 
 
 namespace {
 namespace {
   struct RetainCycleOwner {
   struct RetainCycleOwner {
-    RetainCycleOwner() : Variable(0), Indirect(false) {}
+    RetainCycleOwner() : Variable(nullptr), Indirect(false) {}
     VarDecl *Variable;
     VarDecl *Variable;
     SourceRange Range;
     SourceRange Range;
     SourceLocation Loc;
     SourceLocation Loc;
@@ -7251,7 +7252,7 @@ namespace {
   struct FindCaptureVisitor : EvaluatedExprVisitor<FindCaptureVisitor> {
   struct FindCaptureVisitor : EvaluatedExprVisitor<FindCaptureVisitor> {
     FindCaptureVisitor(ASTContext &Context, VarDecl *variable)
     FindCaptureVisitor(ASTContext &Context, VarDecl *variable)
       : EvaluatedExprVisitor<FindCaptureVisitor>(Context),
       : EvaluatedExprVisitor<FindCaptureVisitor>(Context),
-        Variable(variable), Capturer(0) {}
+        Variable(variable), Capturer(nullptr) {}
 
 
     VarDecl *Variable;
     VarDecl *Variable;
     Expr *Capturer;
     Expr *Capturer;
@@ -7295,7 +7296,7 @@ static Expr *findCapturingExpr(Sema &S, Expr *e, RetainCycleOwner &owner) {
     if (Cmd.isUnarySelector() && Cmd.getNameForSlot(0) == "copy") {
     if (Cmd.isUnarySelector() && Cmd.getNameForSlot(0) == "copy") {
       e = ME->getInstanceReceiver();
       e = ME->getInstanceReceiver();
       if (!e)
       if (!e)
-        return 0;
+        return nullptr;
       e = e->IgnoreParenCasts();
       e = e->IgnoreParenCasts();
     }
     }
   } else if (CallExpr *CE = dyn_cast<CallExpr>(e)) {
   } else if (CallExpr *CE = dyn_cast<CallExpr>(e)) {
@@ -7312,7 +7313,7 @@ static Expr *findCapturingExpr(Sema &S, Expr *e, RetainCycleOwner &owner) {
   
   
   BlockExpr *block = dyn_cast<BlockExpr>(e);
   BlockExpr *block = dyn_cast<BlockExpr>(e);
   if (!block || !block->getBlockDecl()->capturesVariable(owner.Variable))
   if (!block || !block->getBlockDecl()->capturesVariable(owner.Variable))
-    return 0;
+    return nullptr;
 
 
   FindCaptureVisitor visitor(S.Context, owner.Variable);
   FindCaptureVisitor visitor(S.Context, owner.Variable);
   visitor.Visit(block->getBlockDecl()->getBody());
   visitor.Visit(block->getBlockDecl()->getBody());
@@ -7388,7 +7389,7 @@ void Sema::checkRetainCycles(Expr *receiver, Expr *argument) {
 
 
 void Sema::checkRetainCycles(VarDecl *Var, Expr *Init) {
 void Sema::checkRetainCycles(VarDecl *Var, Expr *Init) {
   RetainCycleOwner Owner;
   RetainCycleOwner Owner;
-  if (!considerVariable(Var, /*DeclRefExpr=*/0, Owner))
+  if (!considerVariable(Var, /*DeclRefExpr=*/nullptr, Owner))
     return;
     return;
   
   
   // Because we don't have an expression for the variable, we have to set the
   // Because we don't have an expression for the variable, we have to set the
@@ -7899,7 +7900,7 @@ bool GetMatchingCType(
   FoundWrongKind = false;
   FoundWrongKind = false;
 
 
   // Variable declaration that has type_tag_for_datatype attribute.
   // Variable declaration that has type_tag_for_datatype attribute.
-  const ValueDecl *VD = NULL;
+  const ValueDecl *VD = nullptr;
 
 
   uint64_t MagicValue;
   uint64_t MagicValue;
 
 

+ 95 - 88
lib/Sema/SemaCodeComplete.cpp

@@ -104,7 +104,7 @@ namespace {
         if (DeclIndexPairVector *Vec
         if (DeclIndexPairVector *Vec
               = DeclOrVector.dyn_cast<DeclIndexPairVector *>()) {
               = DeclOrVector.dyn_cast<DeclIndexPairVector *>()) {
           delete Vec;
           delete Vec;
-          DeclOrVector = ((NamedDecl *)0);
+          DeclOrVector = ((NamedDecl *)nullptr);
         }
         }
       }
       }
 
 
@@ -172,12 +172,12 @@ namespace {
     explicit ResultBuilder(Sema &SemaRef, CodeCompletionAllocator &Allocator,
     explicit ResultBuilder(Sema &SemaRef, CodeCompletionAllocator &Allocator,
                            CodeCompletionTUInfo &CCTUInfo,
                            CodeCompletionTUInfo &CCTUInfo,
                            const CodeCompletionContext &CompletionContext,
                            const CodeCompletionContext &CompletionContext,
-                           LookupFilter Filter = 0)
+                           LookupFilter Filter = nullptr)
       : SemaRef(SemaRef), Allocator(Allocator), CCTUInfo(CCTUInfo),
       : SemaRef(SemaRef), Allocator(Allocator), CCTUInfo(CCTUInfo),
         Filter(Filter), 
         Filter(Filter), 
         AllowNestedNameSpecifiers(false), HasObjectTypeQualifiers(false), 
         AllowNestedNameSpecifiers(false), HasObjectTypeQualifiers(false), 
         CompletionContext(CompletionContext),
         CompletionContext(CompletionContext),
-        ObjCImplementation(0) 
+        ObjCImplementation(nullptr)
     { 
     { 
       // If this is an Objective-C instance method definition, dig out the 
       // If this is an Objective-C instance method definition, dig out the 
       // corresponding implementation.
       // corresponding implementation.
@@ -212,8 +212,8 @@ namespace {
     void setFilter(LookupFilter Filter) {
     void setFilter(LookupFilter Filter) {
       this->Filter = Filter;
       this->Filter = Filter;
     }
     }
-    
-    Result *data() { return Results.empty()? 0 : &Results.front(); }
+
+    Result *data() { return Results.empty()? nullptr : &Results.front(); }
     unsigned size() const { return Results.size(); }
     unsigned size() const { return Results.size(); }
     bool empty() const { return Results.empty(); }
     bool empty() const { return Results.empty(); }
     
     
@@ -289,8 +289,8 @@ namespace {
     /// \param R the result to add (if it is unique).
     /// \param R the result to add (if it is unique).
     ///
     ///
     /// \param CurContext the context in which this result will be named.
     /// \param CurContext the context in which this result will be named.
-    void MaybeAddResult(Result R, DeclContext *CurContext = 0);
-    
+    void MaybeAddResult(Result R, DeclContext *CurContext = nullptr);
+
     /// \brief Add a new result to this result set, where we already know
     /// \brief Add a new result to this result set, where we already know
     /// the hiding declation (if any).
     /// the hiding declation (if any).
     ///
     ///
@@ -364,8 +364,8 @@ public:
       return &Value;
       return &Value;
     }
     }
   };
   };
-        
-  iterator() : DeclOrIterator((NamedDecl *)0), SingleDeclIndex(0) { }
+
+  iterator() : DeclOrIterator((NamedDecl *)nullptr), SingleDeclIndex(0) {}
 
 
   iterator(const NamedDecl *SingleDecl, unsigned Index)
   iterator(const NamedDecl *SingleDecl, unsigned Index)
     : DeclOrIterator(SingleDecl), SingleDeclIndex(Index) { }
     : DeclOrIterator(SingleDecl), SingleDeclIndex(Index) { }
@@ -375,7 +375,7 @@ public:
 
 
   iterator &operator++() {
   iterator &operator++() {
     if (DeclOrIterator.is<const NamedDecl *>()) {
     if (DeclOrIterator.is<const NamedDecl *>()) {
-      DeclOrIterator = (NamedDecl *)0;
+      DeclOrIterator = (NamedDecl *)nullptr;
       SingleDeclIndex = 0;
       SingleDeclIndex = 0;
       return *this;
       return *this;
     }
     }
@@ -461,8 +461,8 @@ getRequiredQualification(ASTContext &Context,
     
     
     TargetParents.push_back(CommonAncestor);
     TargetParents.push_back(CommonAncestor);
   }
   }
-  
-  NestedNameSpecifier *Result = 0;
+
+  NestedNameSpecifier *Result = nullptr;
   while (!TargetParents.empty()) {
   while (!TargetParents.empty()) {
     const DeclContext *Parent = TargetParents.pop_back_val();
     const DeclContext *Parent = TargetParents.pop_back_val();
 
 
@@ -530,7 +530,7 @@ bool ResultBuilder::isInterestingDecl(const NamedDecl *ND,
       ((isa<NamespaceDecl>(ND) || isa<NamespaceAliasDecl>(ND)) &&
       ((isa<NamespaceDecl>(ND) || isa<NamespaceAliasDecl>(ND)) &&
        Filter != &ResultBuilder::IsNamespace &&
        Filter != &ResultBuilder::IsNamespace &&
        Filter != &ResultBuilder::IsNamespaceOrAlias &&
        Filter != &ResultBuilder::IsNamespaceOrAlias &&
-       Filter != 0))
+       Filter != nullptr))
     AsNestedNameSpecifier = true;
     AsNestedNameSpecifier = true;
 
 
   // Filter out any unwanted results.
   // Filter out any unwanted results.
@@ -779,7 +779,7 @@ void ResultBuilder::MaybeAddConstructorResults(Result R) {
   
   
   ASTContext &Context = SemaRef.Context;
   ASTContext &Context = SemaRef.Context;
   const NamedDecl *D = R.Declaration;
   const NamedDecl *D = R.Declaration;
-  const CXXRecordDecl *Record = 0;
+  const CXXRecordDecl *Record = nullptr;
   if (const ClassTemplateDecl *ClassTemplate = dyn_cast<ClassTemplateDecl>(D))
   if (const ClassTemplateDecl *ClassTemplate = dyn_cast<ClassTemplateDecl>(D))
     Record = ClassTemplate->getTemplatedDecl();
     Record = ClassTemplate->getTemplatedDecl();
   else if ((Record = dyn_cast<CXXRecordDecl>(D))) {
   else if ((Record = dyn_cast<CXXRecordDecl>(D))) {
@@ -910,10 +910,11 @@ void ResultBuilder::MaybeAddResult(Result R, DeclContext *CurContext) {
       !R.StartsNestedNameSpecifier) {
       !R.StartsNestedNameSpecifier) {
     const DeclContext *Ctx = R.Declaration->getDeclContext();
     const DeclContext *Ctx = R.Declaration->getDeclContext();
     if (const NamespaceDecl *Namespace = dyn_cast<NamespaceDecl>(Ctx))
     if (const NamespaceDecl *Namespace = dyn_cast<NamespaceDecl>(Ctx))
-      R.Qualifier = NestedNameSpecifier::Create(SemaRef.Context, 0, Namespace);
+      R.Qualifier = NestedNameSpecifier::Create(SemaRef.Context, nullptr,
+                                                Namespace);
     else if (const TagDecl *Tag = dyn_cast<TagDecl>(Ctx))
     else if (const TagDecl *Tag = dyn_cast<TagDecl>(Ctx))
-      R.Qualifier = NestedNameSpecifier::Create(SemaRef.Context, 0, false, 
-                             SemaRef.Context.getTypeDeclType(Tag).getTypePtr());
+      R.Qualifier = NestedNameSpecifier::Create(SemaRef.Context, nullptr,
+                      false, SemaRef.Context.getTypeDeclType(Tag).getTypePtr());
     else
     else
       R.QualifierIsInformative = false;
       R.QualifierIsInformative = false;
   }
   }
@@ -975,9 +976,10 @@ void ResultBuilder::AddResult(Result R, DeclContext *CurContext,
       !R.StartsNestedNameSpecifier) {
       !R.StartsNestedNameSpecifier) {
     const DeclContext *Ctx = R.Declaration->getDeclContext();
     const DeclContext *Ctx = R.Declaration->getDeclContext();
     if (const NamespaceDecl *Namespace = dyn_cast<NamespaceDecl>(Ctx))
     if (const NamespaceDecl *Namespace = dyn_cast<NamespaceDecl>(Ctx))
-      R.Qualifier = NestedNameSpecifier::Create(SemaRef.Context, 0, Namespace);
+      R.Qualifier = NestedNameSpecifier::Create(SemaRef.Context, nullptr,
+                                                Namespace);
     else if (const TagDecl *Tag = dyn_cast<TagDecl>(Ctx))
     else if (const TagDecl *Tag = dyn_cast<TagDecl>(Ctx))
-      R.Qualifier = NestedNameSpecifier::Create(SemaRef.Context, 0, false, 
+      R.Qualifier = NestedNameSpecifier::Create(SemaRef.Context, nullptr, false,
                             SemaRef.Context.getTypeDeclType(Tag).getTypePtr());
                             SemaRef.Context.getTypeDeclType(Tag).getTypePtr());
     else
     else
       R.QualifierIsInformative = false;
       R.QualifierIsInformative = false;
@@ -1259,9 +1261,9 @@ namespace {
       bool Accessible = true;
       bool Accessible = true;
       if (Ctx)
       if (Ctx)
         Accessible = Results.getSema().IsSimplyAccessible(ND, Ctx);
         Accessible = Results.getSema().IsSimplyAccessible(ND, Ctx);
-      
-      ResultBuilder::Result Result(ND, Results.getBasePriority(ND), 0, false,
-                                   Accessible);
+
+      ResultBuilder::Result Result(ND, Results.getBasePriority(ND), nullptr,
+                                   false, Accessible);
       Results.AddResult(Result, CurContext, Hiding, InBaseClass);
       Results.AddResult(Result, CurContext, Hiding, InBaseClass);
     }
     }
   };
   };
@@ -2444,7 +2446,7 @@ static void AddTypedNameChunk(ASTContext &Context, const PrintingPolicy &Policy,
   
   
   switch (Name.getNameKind()) {
   switch (Name.getNameKind()) {
     case DeclarationName::CXXOperatorName: {
     case DeclarationName::CXXOperatorName: {
-      const char *OperatorName = 0;
+      const char *OperatorName = nullptr;
       switch (Name.getCXXOverloadedOperator()) {
       switch (Name.getCXXOverloadedOperator()) {
       case OO_None: 
       case OO_None: 
       case OO_Conditional:
       case OO_Conditional:
@@ -2483,7 +2485,7 @@ static void AddTypedNameChunk(ASTContext &Context, const PrintingPolicy &Policy,
     break;
     break;
       
       
   case DeclarationName::CXXConstructorName: {
   case DeclarationName::CXXConstructorName: {
-    CXXRecordDecl *Record = 0;
+    CXXRecordDecl *Record = nullptr;
     QualType Ty = Name.getCXXNameType();
     QualType Ty = Name.getCXXNameType();
     if (const RecordType *RecordTy = Ty->getAs<RecordType>())
     if (const RecordType *RecordTy = Ty->getAs<RecordType>())
       Record = cast<CXXRecordDecl>(RecordTy->getDecl());
       Record = cast<CXXRecordDecl>(RecordTy->getDecl());
@@ -3240,7 +3242,7 @@ void Sema::CodeCompleteOrdinaryName(Scope *S,
       Results.setFilter(&ResultBuilder::IsOrdinaryNonTypeName);
       Results.setFilter(&ResultBuilder::IsOrdinaryNonTypeName);
       
       
     if (getLangOpts().CPlusPlus)
     if (getLangOpts().CPlusPlus)
-      MaybeAddOverrideCalls(*this, /*InContext=*/0, Results);
+      MaybeAddOverrideCalls(*this, /*InContext=*/nullptr, Results);
     break;
     break;
       
       
   case PCC_RecoveryInFunction:
   case PCC_RecoveryInFunction:
@@ -3328,7 +3330,7 @@ void Sema::CodeCompleteDeclSpec(Scope *S, DeclSpec &DS,
       CodeCompletionDeclConsumer Consumer(Results, CurContext);
       CodeCompletionDeclConsumer Consumer(Results, CurContext);
       LookupVisibleDecls(S, LookupNestedNameSpecifierName, Consumer,
       LookupVisibleDecls(S, LookupNestedNameSpecifierName, Consumer,
                          CodeCompleter->includeGlobals());
                          CodeCompleter->includeGlobals());
-      Results.setFilter(0);
+      Results.setFilter(nullptr);
     }
     }
   }
   }
   Results.ExitScope();
   Results.ExitScope();
@@ -3465,9 +3467,9 @@ static void AddObjCProperties(ObjCContainerDecl *Container,
   // Add properties in this container.
   // Add properties in this container.
   for (const auto *P : Container->properties())
   for (const auto *P : Container->properties())
     if (AddedProperties.insert(P->getIdentifier()))
     if (AddedProperties.insert(P->getIdentifier()))
-      Results.MaybeAddResult(Result(P, Results.getBasePriority(P), 0),
+      Results.MaybeAddResult(Result(P, Results.getBasePriority(P), nullptr),
                              CurContext);
                              CurContext);
-  
+
   // Add nullary methods
   // Add nullary methods
   if (AllowNullaryMethods) {
   if (AllowNullaryMethods) {
     ASTContext &Context = Container->getASTContext();
     ASTContext &Context = Container->getASTContext();
@@ -3615,7 +3617,7 @@ void Sema::CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base,
   } else if ((IsArrow && BaseType->isObjCObjectPointerType()) ||
   } else if ((IsArrow && BaseType->isObjCObjectPointerType()) ||
              (!IsArrow && BaseType->isObjCObjectType())) {
              (!IsArrow && BaseType->isObjCObjectType())) {
     // Objective-C instance variable access.
     // Objective-C instance variable access.
-    ObjCInterfaceDecl *Class = 0;
+    ObjCInterfaceDecl *Class = nullptr;
     if (const ObjCObjectPointerType *ObjCPtr
     if (const ObjCObjectPointerType *ObjCPtr
                                     = BaseType->getAs<ObjCObjectPointerType>())
                                     = BaseType->getAs<ObjCObjectPointerType>())
       Class = ObjCPtr->getInterfaceDecl();
       Class = ObjCPtr->getInterfaceDecl();
@@ -3644,8 +3646,8 @@ void Sema::CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base,
 void Sema::CodeCompleteTag(Scope *S, unsigned TagSpec) {
 void Sema::CodeCompleteTag(Scope *S, unsigned TagSpec) {
   if (!CodeCompleter)
   if (!CodeCompleter)
     return;
     return;
-  
-  ResultBuilder::LookupFilter Filter = 0;
+
+  ResultBuilder::LookupFilter Filter = nullptr;
   enum CodeCompletionContext::Kind ContextKind
   enum CodeCompletionContext::Kind ContextKind
     = CodeCompletionContext::CCC_Other;
     = CodeCompletionContext::CCC_Other;
   switch ((DeclSpec::TST)TagSpec) {
   switch ((DeclSpec::TST)TagSpec) {
@@ -3734,7 +3736,7 @@ void Sema::CodeCompleteCase(Scope *S) {
   // token, in case we are code-completing in the middle of the switch and not
   // token, in case we are code-completing in the middle of the switch and not
   // at the end. However, we aren't able to do so at the moment.
   // at the end. However, we aren't able to do so at the moment.
   llvm::SmallPtrSet<EnumConstantDecl *, 8> EnumeratorsSeen;
   llvm::SmallPtrSet<EnumConstantDecl *, 8> EnumeratorsSeen;
-  NestedNameSpecifier *Qualifier = 0;
+  NestedNameSpecifier *Qualifier = nullptr;
   for (SwitchCase *SC = Switch->getSwitchCaseList(); SC; 
   for (SwitchCase *SC = Switch->getSwitchCaseList(); SC; 
        SC = SC->getNextSwitchCase()) {
        SC = SC->getNextSwitchCase()) {
     CaseStmt *Case = dyn_cast<CaseStmt>(SC);
     CaseStmt *Case = dyn_cast<CaseStmt>(SC);
@@ -3785,7 +3787,7 @@ void Sema::CodeCompleteCase(Scope *S) {
       continue;
       continue;
     
     
     CodeCompletionResult R(E, CCP_EnumInCase, Qualifier);
     CodeCompletionResult R(E, CCP_EnumInCase, Qualifier);
-    Results.AddResult(R, CurContext, 0, false);
+    Results.AddResult(R, CurContext, nullptr, false);
   }
   }
   Results.ExitScope();
   Results.ExitScope();
 
 
@@ -4141,8 +4143,9 @@ void Sema::CodeCompleteNamespaceDecl(Scope *S)  {
            NSEnd = OrigToLatest.end();
            NSEnd = OrigToLatest.end();
          NS != NSEnd; ++NS)
          NS != NSEnd; ++NS)
       Results.AddResult(CodeCompletionResult(
       Results.AddResult(CodeCompletionResult(
-                          NS->second, Results.getBasePriority(NS->second), 0),
-                        CurContext, 0, false);
+                          NS->second, Results.getBasePriority(NS->second),
+                          nullptr),
+                        CurContext, nullptr, false);
     Results.ExitScope();
     Results.ExitScope();
   }
   }
   
   
@@ -4347,7 +4350,7 @@ void Sema::CodeCompleteLambdaIntroducer(Scope *S, LambdaIntroducer &Intro,
       
       
       if (Known.insert(Var->getIdentifier()))
       if (Known.insert(Var->getIdentifier()))
         Results.AddResult(CodeCompletionResult(Var, CCP_LocalDeclaration),
         Results.AddResult(CodeCompletionResult(Var, CCP_LocalDeclaration),
-                          CurContext, 0, false);
+                          CurContext, nullptr, false);
     }
     }
   }
   }
 
 
@@ -4816,8 +4819,8 @@ static void AddObjCMethods(ObjCContainerDecl *Container,
 
 
       if (!Selectors.insert(M->getSelector()))
       if (!Selectors.insert(M->getSelector()))
         continue;
         continue;
-      
-      Result R = Result(M, Results.getBasePriority(M), 0);
+
+      Result R = Result(M, Results.getBasePriority(M), nullptr);
       R.StartParameter = SelIdents.size();
       R.StartParameter = SelIdents.size();
       R.AllParametersAreInformative = (WantKind != MK_Any);
       R.AllParametersAreInformative = (WantKind != MK_Any);
       if (!InOriginalClass)
       if (!InOriginalClass)
@@ -5019,22 +5022,22 @@ void Sema::CodeCompleteObjCPassingType(Scope *S, ObjCDeclSpec &DS,
 static ObjCInterfaceDecl *GetAssumedMessageSendExprType(Expr *E) {
 static ObjCInterfaceDecl *GetAssumedMessageSendExprType(Expr *E) {
   ObjCMessageExpr *Msg = dyn_cast_or_null<ObjCMessageExpr>(E);
   ObjCMessageExpr *Msg = dyn_cast_or_null<ObjCMessageExpr>(E);
   if (!Msg)
   if (!Msg)
-    return 0;
+    return nullptr;
 
 
   Selector Sel = Msg->getSelector();
   Selector Sel = Msg->getSelector();
   if (Sel.isNull())
   if (Sel.isNull())
-    return 0;
+    return nullptr;
 
 
   IdentifierInfo *Id = Sel.getIdentifierInfoForSlot(0);
   IdentifierInfo *Id = Sel.getIdentifierInfoForSlot(0);
   if (!Id)
   if (!Id)
-    return 0;
+    return nullptr;
 
 
   ObjCMethodDecl *Method = Msg->getMethodDecl();
   ObjCMethodDecl *Method = Msg->getMethodDecl();
   if (!Method)
   if (!Method)
-    return 0;
+    return nullptr;
 
 
   // Determine the class that we're sending the message to.
   // Determine the class that we're sending the message to.
-  ObjCInterfaceDecl *IFace = 0;
+  ObjCInterfaceDecl *IFace = nullptr;
   switch (Msg->getReceiverKind()) {
   switch (Msg->getReceiverKind()) {
   case ObjCMessageExpr::Class:
   case ObjCMessageExpr::Class:
     if (const ObjCObjectType *ObjType
     if (const ObjCObjectType *ObjType
@@ -5055,7 +5058,7 @@ static ObjCInterfaceDecl *GetAssumedMessageSendExprType(Expr *E) {
   }
   }
 
 
   if (!IFace)
   if (!IFace)
-    return 0;
+    return nullptr;
 
 
   ObjCInterfaceDecl *Super = IFace->getSuperClass();
   ObjCInterfaceDecl *Super = IFace->getSuperClass();
   if (Method->isInstanceMethod())
   if (Method->isInstanceMethod())
@@ -5072,7 +5075,7 @@ static ObjCInterfaceDecl *GetAssumedMessageSendExprType(Expr *E) {
       .Case("class", IFace)
       .Case("class", IFace)
       .Case("classForCoder", IFace)
       .Case("classForCoder", IFace)
       .Case("superclass", Super)
       .Case("superclass", Super)
-      .Default(0);
+      .Default(nullptr);
 
 
   return llvm::StringSwitch<ObjCInterfaceDecl *>(Id->getName())
   return llvm::StringSwitch<ObjCInterfaceDecl *>(Id->getName())
     .Case("new", IFace)
     .Case("new", IFace)
@@ -5080,7 +5083,7 @@ static ObjCInterfaceDecl *GetAssumedMessageSendExprType(Expr *E) {
     .Case("allocWithZone", IFace)
     .Case("allocWithZone", IFace)
     .Case("class", IFace)
     .Case("class", IFace)
     .Case("superclass", Super)
     .Case("superclass", Super)
-    .Default(0);
+    .Default(nullptr);
 }
 }
 
 
 // Add a special completion for a message send to "super", which fills in the
 // Add a special completion for a message send to "super", which fills in the
@@ -5105,14 +5108,14 @@ static ObjCMethodDecl *AddSuperSendCompletion(
                                           ResultBuilder &Results) {
                                           ResultBuilder &Results) {
   ObjCMethodDecl *CurMethod = S.getCurMethodDecl();
   ObjCMethodDecl *CurMethod = S.getCurMethodDecl();
   if (!CurMethod)
   if (!CurMethod)
-    return 0;
-  
+    return nullptr;
+
   ObjCInterfaceDecl *Class = CurMethod->getClassInterface();
   ObjCInterfaceDecl *Class = CurMethod->getClassInterface();
   if (!Class)
   if (!Class)
-    return 0;
-  
+    return nullptr;
+
   // Try to find a superclass method with the same selector.
   // Try to find a superclass method with the same selector.
-  ObjCMethodDecl *SuperMethod = 0;
+  ObjCMethodDecl *SuperMethod = nullptr;
   while ((Class = Class->getSuperClass()) && !SuperMethod) {
   while ((Class = Class->getSuperClass()) && !SuperMethod) {
     // Check in the class
     // Check in the class
     SuperMethod = Class->getMethod(CurMethod->getSelector(), 
     SuperMethod = Class->getMethod(CurMethod->getSelector(), 
@@ -5129,13 +5132,13 @@ static ObjCMethodDecl *AddSuperSendCompletion(
   }
   }
 
 
   if (!SuperMethod)
   if (!SuperMethod)
-    return 0;
-  
+    return nullptr;
+
   // Check whether the superclass method has the same signature.
   // Check whether the superclass method has the same signature.
   if (CurMethod->param_size() != SuperMethod->param_size() ||
   if (CurMethod->param_size() != SuperMethod->param_size() ||
       CurMethod->isVariadic() != SuperMethod->isVariadic())
       CurMethod->isVariadic() != SuperMethod->isVariadic())
-    return 0;
-      
+    return nullptr;
+
   for (ObjCMethodDecl::param_iterator CurP = CurMethod->param_begin(),
   for (ObjCMethodDecl::param_iterator CurP = CurMethod->param_begin(),
                                    CurPEnd = CurMethod->param_end(),
                                    CurPEnd = CurMethod->param_end(),
                                     SuperP = SuperMethod->param_begin();
                                     SuperP = SuperMethod->param_begin();
@@ -5143,11 +5146,11 @@ static ObjCMethodDecl *AddSuperSendCompletion(
     // Make sure the parameter types are compatible.
     // Make sure the parameter types are compatible.
     if (!S.Context.hasSameUnqualifiedType((*CurP)->getType(), 
     if (!S.Context.hasSameUnqualifiedType((*CurP)->getType(), 
                                           (*SuperP)->getType()))
                                           (*SuperP)->getType()))
-      return 0;
-    
+      return nullptr;
+
     // Make sure we have a parameter name to forward!
     // Make sure we have a parameter name to forward!
     if (!(*CurP)->getIdentifier())
     if (!(*CurP)->getIdentifier())
-      return 0;
+      return nullptr;
   }
   }
   
   
   // We have a superclass method. Now, form the send-to-super completion.
   // We have a superclass method. Now, form the send-to-super completion.
@@ -5242,7 +5245,7 @@ void Sema::CodeCompleteObjCMessageReceiver(Scope *S) {
 void Sema::CodeCompleteObjCSuperMessage(Scope *S, SourceLocation SuperLoc,
 void Sema::CodeCompleteObjCSuperMessage(Scope *S, SourceLocation SuperLoc,
                                         ArrayRef<IdentifierInfo *> SelIdents,
                                         ArrayRef<IdentifierInfo *> SelIdents,
                                         bool AtArgumentExpression) {
                                         bool AtArgumentExpression) {
-  ObjCInterfaceDecl *CDecl = 0;
+  ObjCInterfaceDecl *CDecl = nullptr;
   if (ObjCMethodDecl *CurMethod = getCurMethodDecl()) {
   if (ObjCMethodDecl *CurMethod = getCurMethodDecl()) {
     // Figure out which interface we're in.
     // Figure out which interface we're in.
     CDecl = CurMethod->getClassInterface();
     CDecl = CurMethod->getClassInterface();
@@ -5258,7 +5261,7 @@ void Sema::CodeCompleteObjCSuperMessage(Scope *S, SourceLocation SuperLoc,
       // We are inside an instance method, which means that the message
       // We are inside an instance method, which means that the message
       // send [super ...] is actually calling an instance method on the
       // send [super ...] is actually calling an instance method on the
       // current object.
       // current object.
-      return CodeCompleteObjCInstanceMessage(S, 0, SelIdents,
+      return CodeCompleteObjCInstanceMessage(S, nullptr, SelIdents,
                                              AtArgumentExpression,
                                              AtArgumentExpression,
                                              CDecl);
                                              CDecl);
     }
     }
@@ -5343,12 +5346,12 @@ static void AddClassMessageCompletions(Sema &SemaRef, Scope *S,
                                        bool IsSuper,
                                        bool IsSuper,
                                        ResultBuilder &Results) {
                                        ResultBuilder &Results) {
   typedef CodeCompletionResult Result;
   typedef CodeCompletionResult Result;
-  ObjCInterfaceDecl *CDecl = 0;
-  
+  ObjCInterfaceDecl *CDecl = nullptr;
+
   // If the given name refers to an interface type, retrieve the
   // If the given name refers to an interface type, retrieve the
   // corresponding declaration.
   // corresponding declaration.
   if (Receiver) {
   if (Receiver) {
-    QualType T = SemaRef.GetTypeFromParser(Receiver, 0);
+    QualType T = SemaRef.GetTypeFromParser(Receiver, nullptr);
     if (!T.isNull()) 
     if (!T.isNull()) 
       if (const ObjCObjectType *Interface = T->getAs<ObjCObjectType>())
       if (const ObjCObjectType *Interface = T->getAs<ObjCObjectType>())
         CDecl = Interface->getInterface();
         CDecl = Interface->getInterface();
@@ -5401,8 +5404,9 @@ static void AddClassMessageCompletions(Sema &SemaRef, Scope *S,
            MethList = MethList->getNext()) {
            MethList = MethList->getNext()) {
         if (!isAcceptableObjCMethod(MethList->Method, MK_Any, SelIdents))
         if (!isAcceptableObjCMethod(MethList->Method, MK_Any, SelIdents))
           continue;
           continue;
-        
-        Result R(MethList->Method, Results.getBasePriority(MethList->Method),0);
+
+        Result R(MethList->Method, Results.getBasePriority(MethList->Method),
+                 nullptr);
         R.StartParameter = SelIdents.size();
         R.StartParameter = SelIdents.size();
         R.AllParametersAreInformative = false;
         R.AllParametersAreInformative = false;
         Results.MaybeAddResult(R, SemaRef.CurContext);
         Results.MaybeAddResult(R, SemaRef.CurContext);
@@ -5576,8 +5580,9 @@ void Sema::CodeCompleteObjCInstanceMessage(Scope *S, Expr *Receiver,
         
         
         if (!Selectors.insert(MethList->Method->getSelector()))
         if (!Selectors.insert(MethList->Method->getSelector()))
           continue;
           continue;
-        
-        Result R(MethList->Method, Results.getBasePriority(MethList->Method),0);
+
+        Result R(MethList->Method, Results.getBasePriority(MethList->Method),
+                 nullptr);
         R.StartParameter = SelIdents.size();
         R.StartParameter = SelIdents.size();
         R.AllParametersAreInformative = false;
         R.AllParametersAreInformative = false;
         Results.MaybeAddResult(R, CurContext);
         Results.MaybeAddResult(R, CurContext);
@@ -5693,8 +5698,8 @@ static void AddProtocolResults(DeclContext *Ctx, DeclContext *CurContext,
     // Record any protocols we find.
     // Record any protocols we find.
     if (const auto *Proto = dyn_cast<ObjCProtocolDecl>(D))
     if (const auto *Proto = dyn_cast<ObjCProtocolDecl>(D))
       if (!OnlyForwardDeclarations || !Proto->hasDefinition())
       if (!OnlyForwardDeclarations || !Proto->hasDefinition())
-        Results.AddResult(Result(Proto, Results.getBasePriority(Proto), 0),
-                          CurContext, 0, false);
+        Results.AddResult(Result(Proto, Results.getBasePriority(Proto),nullptr),
+                          CurContext, nullptr, false);
   }
   }
 }
 }
 
 
@@ -5760,8 +5765,8 @@ static void AddInterfaceResults(DeclContext *Ctx, DeclContext *CurContext,
     if (const auto *Class = dyn_cast<ObjCInterfaceDecl>(D))
     if (const auto *Class = dyn_cast<ObjCInterfaceDecl>(D))
       if ((!OnlyForwardDeclarations || !Class->hasDefinition()) &&
       if ((!OnlyForwardDeclarations || !Class->hasDefinition()) &&
           (!OnlyUnimplemented || !Class->getImplementation()))
           (!OnlyUnimplemented || !Class->getImplementation()))
-        Results.AddResult(Result(Class, Results.getBasePriority(Class), 0),
-                          CurContext, 0, false);
+        Results.AddResult(Result(Class, Results.getBasePriority(Class),nullptr),
+                          CurContext, nullptr, false);
   }
   }
 }
 }
 
 
@@ -5854,8 +5859,9 @@ void Sema::CodeCompleteObjCInterfaceCategory(Scope *S,
   for (const auto *D : TU->decls()) 
   for (const auto *D : TU->decls()) 
     if (const auto *Category = dyn_cast<ObjCCategoryDecl>(D))
     if (const auto *Category = dyn_cast<ObjCCategoryDecl>(D))
       if (CategoryNames.insert(Category->getIdentifier()))
       if (CategoryNames.insert(Category->getIdentifier()))
-        Results.AddResult(Result(Category, Results.getBasePriority(Category),0),
-                          CurContext, 0, false);
+        Results.AddResult(Result(Category, Results.getBasePriority(Category),
+                                 nullptr),
+                          CurContext, nullptr, false);
   Results.ExitScope();
   Results.ExitScope();
   
   
   HandleCodeCompleteResults(this, CodeCompleter, 
   HandleCodeCompleteResults(this, CodeCompleter, 
@@ -5891,8 +5897,8 @@ void Sema::CodeCompleteObjCImplementationCategory(Scope *S,
     for (const auto *Cat : Class->visible_categories()) {
     for (const auto *Cat : Class->visible_categories()) {
       if ((!IgnoreImplemented || !Cat->getImplementation()) &&
       if ((!IgnoreImplemented || !Cat->getImplementation()) &&
           CategoryNames.insert(Cat->getIdentifier()))
           CategoryNames.insert(Cat->getIdentifier()))
-        Results.AddResult(Result(Cat, Results.getBasePriority(Cat), 0),
-                          CurContext, 0, false);
+        Results.AddResult(Result(Cat, Results.getBasePriority(Cat), nullptr),
+                          CurContext, nullptr, false);
     }
     }
     
     
     Class = Class->getSuperClass();
     Class = Class->getSuperClass();
@@ -5959,7 +5965,7 @@ void Sema::CodeCompleteObjCPropertySynthesizeIvar(Scope *S,
     return; 
     return; 
   
   
   // Figure out which interface we're looking into.
   // Figure out which interface we're looking into.
-  ObjCInterfaceDecl *Class = 0;
+  ObjCInterfaceDecl *Class = nullptr;
   if (ObjCImplementationDecl *ClassImpl
   if (ObjCImplementationDecl *ClassImpl
                                  = dyn_cast<ObjCImplementationDecl>(Container))  
                                  = dyn_cast<ObjCImplementationDecl>(Container))  
     Class = ClassImpl->getClassInterface();
     Class = ClassImpl->getClassInterface();
@@ -5991,9 +5997,9 @@ void Sema::CodeCompleteObjCPropertySynthesizeIvar(Scope *S,
   for(; Class; Class = Class->getSuperClass()) {
   for(; Class; Class = Class->getSuperClass()) {
     for (ObjCIvarDecl *Ivar = Class->all_declared_ivar_begin(); Ivar; 
     for (ObjCIvarDecl *Ivar = Class->all_declared_ivar_begin(); Ivar; 
          Ivar = Ivar->getNextIvar()) {
          Ivar = Ivar->getNextIvar()) {
-      Results.AddResult(Result(Ivar, Results.getBasePriority(Ivar), 0),
-                        CurContext, 0, false);
-      
+      Results.AddResult(Result(Ivar, Results.getBasePriority(Ivar), nullptr),
+                        CurContext, nullptr, false);
+
       // Determine whether we've seen an ivar with a name similar to the 
       // Determine whether we've seen an ivar with a name similar to the 
       // property.
       // property.
       if ((PropertyName == Ivar->getIdentifier() ||
       if ((PropertyName == Ivar->getIdentifier() ||
@@ -6186,10 +6192,10 @@ static void AddObjCKeyValueCompletions(ObjCPropertyDecl *Property,
     CodeCompletionAllocator &Allocator;
     CodeCompletionAllocator &Allocator;
     StringRef Key;
     StringRef Key;
     const char *CopiedKey;
     const char *CopiedKey;
-    
+
     KeyHolder(CodeCompletionAllocator &Allocator, StringRef Key)
     KeyHolder(CodeCompletionAllocator &Allocator, StringRef Key)
-    : Allocator(Allocator), Key(Key), CopiedKey(0) { }
-    
+    : Allocator(Allocator), Key(Key), CopiedKey(nullptr) {}
+
     operator const char *() {
     operator const char *() {
       if (CopiedKey)
       if (CopiedKey)
         return CopiedKey;
         return CopiedKey;
@@ -6791,13 +6797,13 @@ void Sema::CodeCompleteObjCMethodDecl(Scope *S,
   // Determine the return type of the method we're declaring, if
   // Determine the return type of the method we're declaring, if
   // provided.
   // provided.
   QualType ReturnType = GetTypeFromParser(ReturnTy);
   QualType ReturnType = GetTypeFromParser(ReturnTy);
-  Decl *IDecl = 0;
+  Decl *IDecl = nullptr;
   if (CurContext->isObjCContainer()) {
   if (CurContext->isObjCContainer()) {
       ObjCContainerDecl *OCD = dyn_cast<ObjCContainerDecl>(CurContext);
       ObjCContainerDecl *OCD = dyn_cast<ObjCContainerDecl>(CurContext);
       IDecl = cast<Decl>(OCD);
       IDecl = cast<Decl>(OCD);
   }
   }
   // Determine where we should start searching for methods.
   // Determine where we should start searching for methods.
-  ObjCContainerDecl *SearchDecl = 0;
+  ObjCContainerDecl *SearchDecl = nullptr;
   bool IsInImplementation = false;
   bool IsInImplementation = false;
   if (Decl *D = IDecl) {
   if (Decl *D = IDecl) {
     if (ObjCImplementationDecl *Impl = dyn_cast<ObjCImplementationDecl>(D)) {
     if (ObjCImplementationDecl *Impl = dyn_cast<ObjCImplementationDecl>(D)) {
@@ -6819,7 +6825,7 @@ void Sema::CodeCompleteObjCMethodDecl(Scope *S,
   if (!SearchDecl) {
   if (!SearchDecl) {
     HandleCodeCompleteResults(this, CodeCompleter, 
     HandleCodeCompleteResults(this, CodeCompleter, 
                               CodeCompletionContext::CCC_Other,
                               CodeCompletionContext::CCC_Other,
-                              0, 0);
+                              nullptr, 0);
     return;
     return;
   }
   }
     
     
@@ -7000,8 +7006,9 @@ void Sema::CodeCompleteObjCMethodDeclSelector(Scope *S,
         
         
         continue;
         continue;
       }
       }
-      
-      Result R(MethList->Method, Results.getBasePriority(MethList->Method), 0);
+
+      Result R(MethList->Method, Results.getBasePriority(MethList->Method),
+               nullptr);
       R.StartParameter = SelIdents.size();
       R.StartParameter = SelIdents.size();
       R.AllParametersAreInformative = false;
       R.AllParametersAreInformative = false;
       R.DeclaringEntity = true;
       R.DeclaringEntity = true;
@@ -7247,7 +7254,7 @@ void Sema::CodeCompletePreprocessorMacroArgument(Scope *S,
 void Sema::CodeCompleteNaturalLanguage() {
 void Sema::CodeCompleteNaturalLanguage() {
   HandleCodeCompleteResults(this, CodeCompleter,
   HandleCodeCompleteResults(this, CodeCompleter,
                             CodeCompletionContext::CCC_NaturalLanguage,
                             CodeCompletionContext::CCC_NaturalLanguage,
-                            0, 0);
+                            nullptr, 0);
 }
 }
 
 
 void Sema::GatherGlobalCodeCompletions(CodeCompletionAllocator &Allocator,
 void Sema::GatherGlobalCodeCompletions(CodeCompletionAllocator &Allocator,

Datei-Diff unterdrückt, da er zu groß ist
+ 135 - 130
lib/Sema/SemaDecl.cpp


+ 39 - 39
lib/Sema/SemaDeclAttr.cpp

@@ -48,7 +48,7 @@ namespace AttributeLangSupport {
 /// type (function or function-typed variable) or an Objective-C
 /// type (function or function-typed variable) or an Objective-C
 /// method.
 /// method.
 static bool isFunctionOrMethod(const Decl *D) {
 static bool isFunctionOrMethod(const Decl *D) {
-  return (D->getFunctionType() != NULL) || isa<ObjCMethodDecl>(D);
+  return (D->getFunctionType() != nullptr) || isa<ObjCMethodDecl>(D);
 }
 }
 
 
 /// Return true if the given decl has a declarator that should have
 /// Return true if the given decl has a declarator that should have
@@ -361,7 +361,7 @@ static const RecordType *getRecordType(QualType QT) {
   if (const PointerType *PT = QT->getAs<PointerType>())
   if (const PointerType *PT = QT->getAs<PointerType>())
     return PT->getPointeeType()->getAs<RecordType>();
     return PT->getPointeeType()->getAs<RecordType>();
 
 
-  return 0;
+  return nullptr;
 }
 }
 
 
 static bool checkRecordTypeForCapability(Sema &S, QualType Ty) {
 static bool checkRecordTypeForCapability(Sema &S, QualType Ty) {
@@ -391,7 +391,7 @@ static bool checkRecordTypeForCapability(Sema &S, QualType Ty) {
       void *) {
       void *) {
       return BS->getType()->getAs<RecordType>()
       return BS->getType()->getAs<RecordType>()
         ->getDecl()->hasAttr<CapabilityAttr>();
         ->getDecl()->hasAttr<CapabilityAttr>();
-    }, 0, BPaths))
+    }, nullptr, BPaths))
       return true;
       return true;
   }
   }
   return false;
   return false;
@@ -558,7 +558,7 @@ static bool checkGuardedByAttrCommon(Sema &S, Decl *D,
 }
 }
 
 
 static void handleGuardedByAttr(Sema &S, Decl *D, const AttributeList &Attr) {
 static void handleGuardedByAttr(Sema &S, Decl *D, const AttributeList &Attr) {
-  Expr *Arg = 0;
+  Expr *Arg = nullptr;
   if (!checkGuardedByAttrCommon(S, D, Attr, Arg))
   if (!checkGuardedByAttrCommon(S, D, Attr, Arg))
     return;
     return;
 
 
@@ -568,7 +568,7 @@ static void handleGuardedByAttr(Sema &S, Decl *D, const AttributeList &Attr) {
 
 
 static void handlePtGuardedByAttr(Sema &S, Decl *D,
 static void handlePtGuardedByAttr(Sema &S, Decl *D,
                                   const AttributeList &Attr) {
                                   const AttributeList &Attr) {
-  Expr *Arg = 0;
+  Expr *Arg = nullptr;
   if (!checkGuardedByAttrCommon(S, D, Attr, Arg))
   if (!checkGuardedByAttrCommon(S, D, Attr, Arg))
     return;
     return;
 
 
@@ -648,7 +648,7 @@ static void handleAssertSharedLockAttr(Sema &S, Decl *D,
     return;
     return;
 
 
   unsigned Size = Args.size();
   unsigned Size = Args.size();
-  Expr **StartArg = Size == 0 ? 0 : &Args[0];
+  Expr **StartArg = Size == 0 ? nullptr : &Args[0];
   D->addAttr(::new (S.Context)
   D->addAttr(::new (S.Context)
              AssertSharedLockAttr(Attr.getRange(), S.Context, StartArg, Size,
              AssertSharedLockAttr(Attr.getRange(), S.Context, StartArg, Size,
                                   Attr.getAttributeSpellingListIndex()));
                                   Attr.getAttributeSpellingListIndex()));
@@ -661,7 +661,7 @@ static void handleAssertExclusiveLockAttr(Sema &S, Decl *D,
     return;
     return;
 
 
   unsigned Size = Args.size();
   unsigned Size = Args.size();
-  Expr **StartArg = Size == 0 ? 0 : &Args[0];
+  Expr **StartArg = Size == 0 ? nullptr : &Args[0];
   D->addAttr(::new (S.Context)
   D->addAttr(::new (S.Context)
              AssertExclusiveLockAttr(Attr.getRange(), S.Context,
              AssertExclusiveLockAttr(Attr.getRange(), S.Context,
                                      StartArg, Size,
                                      StartArg, Size,
@@ -1080,7 +1080,7 @@ static void handleIBOutletCollection(Sema &S, Decl *D,
     }
     }
   }
   }
 
 
-  TypeSourceInfo *QTLoc = 0;
+  TypeSourceInfo *QTLoc = nullptr;
   QualType QT = S.GetTypeFromParser(PT, &QTLoc);
   QualType QT = S.GetTypeFromParser(PT, &QTLoc);
   if (!QTLoc)
   if (!QTLoc)
     QTLoc = S.Context.getTrivialTypeSourceInfo(QT, Attr.getLoc());
     QTLoc = S.Context.getTrivialTypeSourceInfo(QT, Attr.getLoc());
@@ -1192,7 +1192,7 @@ static void handleNonNullAttrParameter(Sema &S, ParmVarDecl *D,
     return;
     return;
 
 
   D->addAttr(::new (S.Context)
   D->addAttr(::new (S.Context)
-             NonNullAttr(Attr.getRange(), S.Context, 0, 0,
+             NonNullAttr(Attr.getRange(), S.Context, nullptr, 0,
                          Attr.getAttributeSpellingListIndex()));
                          Attr.getAttributeSpellingListIndex()));
 }
 }
 
 
@@ -1225,7 +1225,7 @@ static void handleOwnershipAttr(Sema &S, Decl *D, const AttributeList &AL) {
 
 
   // Figure out our Kind.
   // Figure out our Kind.
   OwnershipAttr::OwnershipKind K =
   OwnershipAttr::OwnershipKind K =
-      OwnershipAttr(AL.getLoc(), S.Context, 0, 0, 0,
+      OwnershipAttr(AL.getLoc(), S.Context, nullptr, nullptr, 0,
                     AL.getAttributeSpellingListIndex()).getOwnKind();
                     AL.getAttributeSpellingListIndex()).getOwnKind();
 
 
   // Check arguments.
   // Check arguments.
@@ -1480,8 +1480,8 @@ static void handleAnalyzerNoReturnAttr(Sema &S, Decl *D,
   // because 'analyzer_noreturn' does not impact the type.
   // because 'analyzer_noreturn' does not impact the type.
   if (!isFunctionOrMethod(D) && !isa<BlockDecl>(D)) {
   if (!isFunctionOrMethod(D) && !isa<BlockDecl>(D)) {
     ValueDecl *VD = dyn_cast<ValueDecl>(D);
     ValueDecl *VD = dyn_cast<ValueDecl>(D);
-    if (VD == 0 || (!VD->getType()->isBlockPointerType()
-                    && !VD->getType()->isFunctionPointerType())) {
+    if (!VD || (!VD->getType()->isBlockPointerType() &&
+                !VD->getType()->isFunctionPointerType())) {
       S.Diag(Attr.getLoc(),
       S.Diag(Attr.getLoc(),
              Attr.isCXX11Attribute() ? diag::err_attribute_wrong_decl_type
              Attr.isCXX11Attribute() ? diag::err_attribute_wrong_decl_type
              : diag::warn_attribute_wrong_decl_type)
              : diag::warn_attribute_wrong_decl_type)
@@ -1820,7 +1820,7 @@ AvailabilityAttr *Sema::mergeAvailabilityAttr(NamedDecl *D, SourceRange Range,
       MergedIntroduced == Introduced &&
       MergedIntroduced == Introduced &&
       MergedDeprecated == Deprecated &&
       MergedDeprecated == Deprecated &&
       MergedObsoleted == Obsoleted)
       MergedObsoleted == Obsoleted)
-    return NULL;
+    return nullptr;
 
 
   // Only create a new attribute if !Override, but we want to do
   // Only create a new attribute if !Override, but we want to do
   // the checking.
   // the checking.
@@ -1832,7 +1832,7 @@ AvailabilityAttr *Sema::mergeAvailabilityAttr(NamedDecl *D, SourceRange Range,
                                             Obsoleted, IsUnavailable, Message,
                                             Obsoleted, IsUnavailable, Message,
                                             AttrSpellingListIndex);
                                             AttrSpellingListIndex);
   }
   }
-  return NULL;
+  return nullptr;
 }
 }
 
 
 static void handleAvailabilityAttr(Sema &S, Decl *D,
 static void handleAvailabilityAttr(Sema &S, Decl *D,
@@ -1881,7 +1881,7 @@ static T *mergeVisibilityAttr(Sema &S, Decl *D, SourceRange range,
   if (existingAttr) {
   if (existingAttr) {
     typename T::VisibilityType existingValue = existingAttr->getVisibility();
     typename T::VisibilityType existingValue = existingAttr->getVisibility();
     if (existingValue == value)
     if (existingValue == value)
-      return NULL;
+      return nullptr;
     S.Diag(existingAttr->getLocation(), diag::err_mismatched_visibility);
     S.Diag(existingAttr->getLocation(), diag::err_mismatched_visibility);
     S.Diag(range.getBegin(), diag::note_previous_attribute);
     S.Diag(range.getBegin(), diag::note_previous_attribute);
     D->dropAttr<T>();
     D->dropAttr<T>();
@@ -2209,7 +2209,7 @@ static void handleVecTypeHint(Sema &S, Decl *D, const AttributeList &Attr) {
     return;
     return;
   }
   }
 
 
-  TypeSourceInfo *ParmTSI = 0;
+  TypeSourceInfo *ParmTSI = nullptr;
   QualType ParmType = S.GetTypeFromParser(Attr.getTypeArg(), &ParmTSI);
   QualType ParmType = S.GetTypeFromParser(Attr.getTypeArg(), &ParmTSI);
   assert(ParmTSI && "no type source info for attribute argument");
   assert(ParmTSI && "no type source info for attribute argument");
 
 
@@ -2238,10 +2238,10 @@ SectionAttr *Sema::mergeSectionAttr(Decl *D, SourceRange Range,
                                     unsigned AttrSpellingListIndex) {
                                     unsigned AttrSpellingListIndex) {
   if (SectionAttr *ExistingAttr = D->getAttr<SectionAttr>()) {
   if (SectionAttr *ExistingAttr = D->getAttr<SectionAttr>()) {
     if (ExistingAttr->getName() == Name)
     if (ExistingAttr->getName() == Name)
-      return NULL;
+      return nullptr;
     Diag(ExistingAttr->getLocation(), diag::warn_mismatched_section);
     Diag(ExistingAttr->getLocation(), diag::warn_mismatched_section);
     Diag(Range.getBegin(), diag::note_previous_attribute);
     Diag(Range.getBegin(), diag::note_previous_attribute);
-    return NULL;
+    return nullptr;
   }
   }
   return ::new (Context) SectionAttr(Range, Context, Name,
   return ::new (Context) SectionAttr(Range, Context, Name,
                                      AttrSpellingListIndex);
                                      AttrSpellingListIndex);
@@ -2279,7 +2279,7 @@ static void handleCleanupAttr(Sema &S, Decl *D, const AttributeList &Attr) {
 
 
   Expr *E = Attr.getArgAsExpr(0);
   Expr *E = Attr.getArgAsExpr(0);
   SourceLocation Loc = E->getExprLoc();
   SourceLocation Loc = E->getExprLoc();
-  FunctionDecl *FD = 0;
+  FunctionDecl *FD = nullptr;
   DeclarationNameInfo NI;
   DeclarationNameInfo NI;
 
 
   // gcc only allows for simple identifiers. Since we support more than gcc, we
   // gcc only allows for simple identifiers. Since we support more than gcc, we
@@ -2459,7 +2459,7 @@ FormatAttr *Sema::mergeFormatAttr(Decl *D, SourceRange Range,
       // location.
       // location.
       if (F->getLocation().isInvalid())
       if (F->getLocation().isInvalid())
         F->setRange(Range);
         F->setRange(Range);
-      return NULL;
+      return nullptr;
     }
     }
   }
   }
 
 
@@ -2595,7 +2595,7 @@ static void handleFormatAttr(Sema &S, Decl *D, const AttributeList &Attr) {
 static void handleTransparentUnionAttr(Sema &S, Decl *D,
 static void handleTransparentUnionAttr(Sema &S, Decl *D,
                                        const AttributeList &Attr) {
                                        const AttributeList &Attr) {
   // Try to find the underlying union declaration.
   // Try to find the underlying union declaration.
-  RecordDecl *RD = 0;
+  RecordDecl *RD = nullptr;
   TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(D);
   TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(D);
   if (TD && TD->getUnderlyingType()->isUnionType())
   if (TD && TD->getUnderlyingType()->isUnionType())
     RD = TD->getUnderlyingType()->getAsUnionType()->getDecl();
     RD = TD->getUnderlyingType()->getAsUnionType()->getDecl();
@@ -2689,7 +2689,7 @@ static void handleAlignedAttr(Sema &S, Decl *D, const AttributeList &Attr) {
 
 
   if (Attr.getNumArgs() == 0) {
   if (Attr.getNumArgs() == 0) {
     D->addAttr(::new (S.Context) AlignedAttr(Attr.getRange(), S.Context,
     D->addAttr(::new (S.Context) AlignedAttr(Attr.getRange(), S.Context,
-               true, 0, Attr.getAttributeSpellingListIndex()));
+               true, nullptr, Attr.getAttributeSpellingListIndex()));
     return;
     return;
   }
   }
 
 
@@ -2817,7 +2817,7 @@ void Sema::CheckAlignasUnderalignment(Decl *D) {
   //   The combined effect of all alignment attributes in a declaration shall
   //   The combined effect of all alignment attributes in a declaration shall
   //   not specify an alignment that is less strict than the alignment that
   //   not specify an alignment that is less strict than the alignment that
   //   would otherwise be required for the entity being declared.
   //   would otherwise be required for the entity being declared.
-  AlignedAttr *AlignasAttr = 0;
+  AlignedAttr *AlignasAttr = nullptr;
   unsigned Align = 0;
   unsigned Align = 0;
   for (auto *I : D->specific_attrs<AlignedAttr>()) {
   for (auto *I : D->specific_attrs<AlignedAttr>()) {
     if (I->isAlignmentDependent())
     if (I->isAlignmentDependent())
@@ -3332,7 +3332,7 @@ static void handleTypeTagForDatatypeAttr(Sema &S, Decl *D,
   }
   }
 
 
   IdentifierInfo *PointerKind = Attr.getArgAsIdent(0)->Ident;
   IdentifierInfo *PointerKind = Attr.getArgAsIdent(0)->Ident;
-  TypeSourceInfo *MatchingCTypeLoc = 0;
+  TypeSourceInfo *MatchingCTypeLoc = nullptr;
   S.GetTypeFromParser(Attr.getMatchingCType(), &MatchingCTypeLoc);
   S.GetTypeFromParser(Attr.getMatchingCType(), &MatchingCTypeLoc);
   assert(MatchingCTypeLoc && "no type source info for attribute argument");
   assert(MatchingCTypeLoc && "no type source info for attribute argument");
 
 
@@ -3536,7 +3536,7 @@ static void handleCFUnknownTransferAttr(Sema &S, Decl *D,
 
 
 static void handleObjCBridgeAttr(Sema &S, Scope *Sc, Decl *D,
 static void handleObjCBridgeAttr(Sema &S, Scope *Sc, Decl *D,
                                 const AttributeList &Attr) {
                                 const AttributeList &Attr) {
-  IdentifierLoc * Parm = Attr.isArgIdent(0) ? Attr.getArgAsIdent(0) : 0;
+  IdentifierLoc * Parm = Attr.isArgIdent(0) ? Attr.getArgAsIdent(0) : nullptr;
 
 
   if (!Parm) {
   if (!Parm) {
     S.Diag(D->getLocStart(), diag::err_objc_attr_not_id) << Attr.getName() << 0;
     S.Diag(D->getLocStart(), diag::err_objc_attr_not_id) << Attr.getName() << 0;
@@ -3550,8 +3550,8 @@ static void handleObjCBridgeAttr(Sema &S, Scope *Sc, Decl *D,
 
 
 static void handleObjCBridgeMutableAttr(Sema &S, Scope *Sc, Decl *D,
 static void handleObjCBridgeMutableAttr(Sema &S, Scope *Sc, Decl *D,
                                         const AttributeList &Attr) {
                                         const AttributeList &Attr) {
-  IdentifierLoc * Parm = Attr.isArgIdent(0) ? Attr.getArgAsIdent(0) : 0;
-  
+  IdentifierLoc * Parm = Attr.isArgIdent(0) ? Attr.getArgAsIdent(0) : nullptr;
+
   if (!Parm) {
   if (!Parm) {
     S.Diag(D->getLocStart(), diag::err_objc_attr_not_id) << Attr.getName() << 0;
     S.Diag(D->getLocStart(), diag::err_objc_attr_not_id) << Attr.getName() << 0;
     return;
     return;
@@ -3565,15 +3565,15 @@ static void handleObjCBridgeMutableAttr(Sema &S, Scope *Sc, Decl *D,
 static void handleObjCBridgeRelatedAttr(Sema &S, Scope *Sc, Decl *D,
 static void handleObjCBridgeRelatedAttr(Sema &S, Scope *Sc, Decl *D,
                                  const AttributeList &Attr) {
                                  const AttributeList &Attr) {
   IdentifierInfo *RelatedClass =
   IdentifierInfo *RelatedClass =
-    Attr.isArgIdent(0) ? Attr.getArgAsIdent(0)->Ident : 0;
+    Attr.isArgIdent(0) ? Attr.getArgAsIdent(0)->Ident : nullptr;
   if (!RelatedClass) {
   if (!RelatedClass) {
     S.Diag(D->getLocStart(), diag::err_objc_attr_not_id) << Attr.getName() << 0;
     S.Diag(D->getLocStart(), diag::err_objc_attr_not_id) << Attr.getName() << 0;
     return;
     return;
   }
   }
   IdentifierInfo *ClassMethod =
   IdentifierInfo *ClassMethod =
-    Attr.getArgAsIdent(1) ? Attr.getArgAsIdent(1)->Ident : 0;
+    Attr.getArgAsIdent(1) ? Attr.getArgAsIdent(1)->Ident : nullptr;
   IdentifierInfo *InstanceMethod =
   IdentifierInfo *InstanceMethod =
-    Attr.getArgAsIdent(2) ? Attr.getArgAsIdent(2)->Ident : 0;
+    Attr.getArgAsIdent(2) ? Attr.getArgAsIdent(2)->Ident : nullptr;
   D->addAttr(::new (S.Context)
   D->addAttr(::new (S.Context)
              ObjCBridgeRelatedAttr(Attr.getRange(), S.Context, RelatedClass,
              ObjCBridgeRelatedAttr(Attr.getRange(), S.Context, RelatedClass,
                                    ClassMethod, InstanceMethod,
                                    ClassMethod, InstanceMethod,
@@ -3826,11 +3826,11 @@ DLLImportAttr *Sema::mergeDLLImportAttr(Decl *D, SourceRange Range,
                                         unsigned AttrSpellingListIndex) {
                                         unsigned AttrSpellingListIndex) {
   if (D->hasAttr<DLLExportAttr>()) {
   if (D->hasAttr<DLLExportAttr>()) {
     Diag(Range.getBegin(), diag::warn_attribute_ignored) << "'dllimport'";
     Diag(Range.getBegin(), diag::warn_attribute_ignored) << "'dllimport'";
-    return NULL;
+    return nullptr;
   }
   }
 
 
   if (D->hasAttr<DLLImportAttr>())
   if (D->hasAttr<DLLImportAttr>())
-    return NULL;
+    return nullptr;
 
 
   return ::new (Context) DLLImportAttr(Range, Context, AttrSpellingListIndex);
   return ::new (Context) DLLImportAttr(Range, Context, AttrSpellingListIndex);
 }
 }
@@ -3850,7 +3850,7 @@ DLLExportAttr *Sema::mergeDLLExportAttr(Decl *D, SourceRange Range,
   }
   }
 
 
   if (D->hasAttr<DLLExportAttr>())
   if (D->hasAttr<DLLExportAttr>())
-    return NULL;
+    return nullptr;
 
 
   return ::new (Context) DLLExportAttr(Range, Context, AttrSpellingListIndex);
   return ::new (Context) DLLExportAttr(Range, Context, AttrSpellingListIndex);
 }
 }
@@ -3868,7 +3868,7 @@ Sema::mergeMSInheritanceAttr(Decl *D, SourceRange Range, bool BestCase,
                              MSInheritanceAttr::Spelling SemanticSpelling) {
                              MSInheritanceAttr::Spelling SemanticSpelling) {
   if (MSInheritanceAttr *IA = D->getAttr<MSInheritanceAttr>()) {
   if (MSInheritanceAttr *IA = D->getAttr<MSInheritanceAttr>()) {
     if (IA->getSemanticSpelling() == SemanticSpelling)
     if (IA->getSemanticSpelling() == SemanticSpelling)
-      return 0;
+      return nullptr;
     Diag(IA->getLocation(), diag::err_mismatched_ms_inheritance)
     Diag(IA->getLocation(), diag::err_mismatched_ms_inheritance)
         << 1 /*previous declaration*/;
         << 1 /*previous declaration*/;
     Diag(Range.getBegin(), diag::note_previous_ms_inheritance);
     Diag(Range.getBegin(), diag::note_previous_ms_inheritance);
@@ -3879,18 +3879,18 @@ Sema::mergeMSInheritanceAttr(Decl *D, SourceRange Range, bool BestCase,
   if (RD->hasDefinition()) {
   if (RD->hasDefinition()) {
     if (checkMSInheritanceAttrOnDefinition(RD, Range, BestCase,
     if (checkMSInheritanceAttrOnDefinition(RD, Range, BestCase,
                                            SemanticSpelling)) {
                                            SemanticSpelling)) {
-      return 0;
+      return nullptr;
     }
     }
   } else {
   } else {
     if (isa<ClassTemplatePartialSpecializationDecl>(RD)) {
     if (isa<ClassTemplatePartialSpecializationDecl>(RD)) {
       Diag(Range.getBegin(), diag::warn_ignored_ms_inheritance)
       Diag(Range.getBegin(), diag::warn_ignored_ms_inheritance)
           << 1 /*partial specialization*/;
           << 1 /*partial specialization*/;
-      return 0;
+      return nullptr;
     }
     }
     if (RD->getDescribedClassTemplate()) {
     if (RD->getDescribedClassTemplate()) {
       Diag(Range.getBegin(), diag::warn_ignored_ms_inheritance)
       Diag(Range.getBegin(), diag::warn_ignored_ms_inheritance)
           << 0 /*primary template*/;
           << 0 /*primary template*/;
-      return 0;
+      return nullptr;
     }
     }
   }
   }
 
 
@@ -4600,7 +4600,7 @@ void Sema::checkUnusedDeclAttributes(Declarator &D) {
 NamedDecl * Sema::DeclClonePragmaWeak(NamedDecl *ND, IdentifierInfo *II,
 NamedDecl * Sema::DeclClonePragmaWeak(NamedDecl *ND, IdentifierInfo *II,
                                       SourceLocation Loc) {
                                       SourceLocation Loc) {
   assert(isa<FunctionDecl>(ND) || isa<VarDecl>(ND));
   assert(isa<FunctionDecl>(ND) || isa<VarDecl>(ND));
-  NamedDecl *NewD = 0;
+  NamedDecl *NewD = nullptr;
   if (FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)) {
   if (FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)) {
     FunctionDecl *NewFD;
     FunctionDecl *NewFD;
     // FIXME: Missing call to CheckFunctionDeclaration().
     // FIXME: Missing call to CheckFunctionDeclaration().
@@ -4673,7 +4673,7 @@ void Sema::ProcessPragmaWeak(Scope *S, Decl *D) {
   // have to do this.
   // have to do this.
   LoadExternalWeakUndeclaredIdentifiers();
   LoadExternalWeakUndeclaredIdentifiers();
   if (!WeakUndeclaredIdentifiers.empty()) {
   if (!WeakUndeclaredIdentifiers.empty()) {
-    NamedDecl *ND = NULL;
+    NamedDecl *ND = nullptr;
     if (VarDecl *VD = dyn_cast<VarDecl>(D))
     if (VarDecl *VD = dyn_cast<VarDecl>(D))
       if (VD->isExternC())
       if (VD->isExternC())
         ND = VD;
         ND = VD;

Datei-Diff unterdrückt, da er zu groß ist
+ 140 - 135
lib/Sema/SemaDeclCXX.cpp


+ 53 - 51
lib/Sema/SemaDeclObjC.cpp

@@ -70,7 +70,7 @@ bool Sema::checkInitMethod(ObjCMethodDecl *method,
     } else {
     } else {
       // If this method was declared in a protocol, we can't check
       // If this method was declared in a protocol, we can't check
       // anything unless we have a receiver type that's an interface.
       // anything unless we have a receiver type that's an interface.
-      const ObjCInterfaceDecl *receiverClass = 0;
+      const ObjCInterfaceDecl *receiverClass = nullptr;
       if (isa<ObjCProtocolDecl>(method->getDeclContext())) {
       if (isa<ObjCProtocolDecl>(method->getDeclContext())) {
         if (receiverTypeIfCall.isNull())
         if (receiverTypeIfCall.isNull())
           return false;
           return false;
@@ -303,7 +303,7 @@ HasExplicitOwnershipAttr(Sema &S, ParmVarDecl *Param) {
 /// ActOnStartOfObjCMethodDef - This routine sets up parameters; invisible
 /// ActOnStartOfObjCMethodDef - This routine sets up parameters; invisible
 /// and user declared, in the method definition's AST.
 /// and user declared, in the method definition's AST.
 void Sema::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) {
 void Sema::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) {
-  assert((getCurMethodDecl() == 0) && "Methodparsing confused");
+  assert((getCurMethodDecl() == nullptr) && "Methodparsing confused");
   ObjCMethodDecl *MDecl = dyn_cast_or_null<ObjCMethodDecl>(D);
   ObjCMethodDecl *MDecl = dyn_cast_or_null<ObjCMethodDecl>(D);
   
   
   // If we don't have a valid method decl, simply return.
   // If we don't have a valid method decl, simply return.
@@ -375,7 +375,7 @@ void Sema::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) {
         dyn_cast<ObjCImplDecl>(MDecl->getDeclContext());
         dyn_cast<ObjCImplDecl>(MDecl->getDeclContext());
       ObjCContainerDecl *ContDeclOfMethodDecl = 
       ObjCContainerDecl *ContDeclOfMethodDecl = 
         dyn_cast<ObjCContainerDecl>(IMD->getDeclContext());
         dyn_cast<ObjCContainerDecl>(IMD->getDeclContext());
-      ObjCImplDecl *ImplDeclOfMethodDecl = 0;
+      ObjCImplDecl *ImplDeclOfMethodDecl = nullptr;
       if (ObjCInterfaceDecl *OID = dyn_cast<ObjCInterfaceDecl>(ContDeclOfMethodDecl))
       if (ObjCInterfaceDecl *OID = dyn_cast<ObjCInterfaceDecl>(ContDeclOfMethodDecl))
         ImplDeclOfMethodDecl = OID->getImplementation();
         ImplDeclOfMethodDecl = OID->getImplementation();
       else if (ObjCCategoryDecl *CD = dyn_cast<ObjCCategoryDecl>(ContDeclOfMethodDecl)) {
       else if (ObjCCategoryDecl *CD = dyn_cast<ObjCCategoryDecl>(ContDeclOfMethodDecl)) {
@@ -397,7 +397,7 @@ void Sema::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) {
       if (MDecl->isDesignatedInitializerForTheInterface()) {
       if (MDecl->isDesignatedInitializerForTheInterface()) {
         getCurFunction()->ObjCIsDesignatedInit = true;
         getCurFunction()->ObjCIsDesignatedInit = true;
         getCurFunction()->ObjCWarnForNoDesignatedInitChain =
         getCurFunction()->ObjCWarnForNoDesignatedInitChain =
-            IC->getSuperClass() != 0;
+            IC->getSuperClass() != nullptr;
       } else if (IC->hasDesignatedInitializers()) {
       } else if (IC->hasDesignatedInitializers()) {
         getCurFunction()->ObjCIsSecondaryInit = true;
         getCurFunction()->ObjCIsSecondaryInit = true;
         getCurFunction()->ObjCWarnForNoInitDelegation = true;
         getCurFunction()->ObjCWarnForNoInitDelegation = true;
@@ -437,7 +437,7 @@ namespace {
 // function will reject corrections to that class.
 // function will reject corrections to that class.
 class ObjCInterfaceValidatorCCC : public CorrectionCandidateCallback {
 class ObjCInterfaceValidatorCCC : public CorrectionCandidateCallback {
  public:
  public:
-  ObjCInterfaceValidatorCCC() : CurrentIDecl(0) {}
+  ObjCInterfaceValidatorCCC() : CurrentIDecl(nullptr) {}
   explicit ObjCInterfaceValidatorCCC(ObjCInterfaceDecl *IDecl)
   explicit ObjCInterfaceValidatorCCC(ObjCInterfaceDecl *IDecl)
       : CurrentIDecl(IDecl) {}
       : CurrentIDecl(IDecl) {}
 
 
@@ -523,7 +523,7 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
       ObjCInterfaceValidatorCCC Validator(IDecl);
       ObjCInterfaceValidatorCCC Validator(IDecl);
       if (TypoCorrection Corrected = CorrectTypo(
       if (TypoCorrection Corrected = CorrectTypo(
           DeclarationNameInfo(SuperName, SuperLoc), LookupOrdinaryName, TUScope,
           DeclarationNameInfo(SuperName, SuperLoc), LookupOrdinaryName, TUScope,
-          NULL, Validator, CTK_ErrorRecovery)) {
+          nullptr, Validator, CTK_ErrorRecovery)) {
         diagnoseTypo(Corrected, PDiag(diag::err_undef_superclass_suggest)
         diagnoseTypo(Corrected, PDiag(diag::err_undef_superclass_suggest)
                                     << SuperName << ClassName);
                                     << SuperName << ClassName);
         PrevDecl = Corrected.getCorrectionDeclAs<ObjCInterfaceDecl>();
         PrevDecl = Corrected.getCorrectionDeclAs<ObjCInterfaceDecl>();
@@ -542,7 +542,7 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
       if (SuperClassDecl)
       if (SuperClassDecl)
         (void)DiagnoseUseOfDecl(SuperClassDecl, SuperLoc);
         (void)DiagnoseUseOfDecl(SuperClassDecl, SuperLoc);
 
 
-      if (PrevDecl && SuperClassDecl == 0) {
+      if (PrevDecl && !SuperClassDecl) {
         // The previous declaration was not a class decl. Check if we have a
         // The previous declaration was not a class decl. Check if we have a
         // typedef. If we do, get the underlying class type.
         // typedef. If we do, get the underlying class type.
         if (const TypedefNameDecl *TDecl =
         if (const TypedefNameDecl *TDecl =
@@ -581,7 +581,7 @@ ActOnStartClassInterface(SourceLocation AtInterfaceLoc,
                                      SuperClassDecl->getDeclName(),
                                      SuperClassDecl->getDeclName(),
                                      ClassName,
                                      ClassName,
                                      SourceRange(AtInterfaceLoc, ClassLoc))) {
                                      SourceRange(AtInterfaceLoc, ClassLoc))) {
-          SuperClassDecl = 0;
+          SuperClassDecl = nullptr;
         }
         }
       }
       }
       IDecl->setSuperClass(SuperClassDecl);
       IDecl->setSuperClass(SuperClassDecl);
@@ -638,7 +638,7 @@ Decl *Sema::ActOnCompatibilityAlias(SourceLocation AtLoc,
   if (ADecl) {
   if (ADecl) {
     Diag(AliasLocation, diag::err_conflicting_aliasing_type) << AliasName;
     Diag(AliasLocation, diag::err_conflicting_aliasing_type) << AliasName;
     Diag(ADecl->getLocation(), diag::note_previous_declaration);
     Diag(ADecl->getLocation(), diag::note_previous_declaration);
-    return 0;
+    return nullptr;
   }
   }
   // Check for class declaration
   // Check for class declaration
   NamedDecl *CDeclU = LookupSingleName(TUScope, ClassName, ClassLocation,
   NamedDecl *CDeclU = LookupSingleName(TUScope, ClassName, ClassLocation,
@@ -655,11 +655,11 @@ Decl *Sema::ActOnCompatibilityAlias(SourceLocation AtLoc,
     }
     }
   }
   }
   ObjCInterfaceDecl *CDecl = dyn_cast_or_null<ObjCInterfaceDecl>(CDeclU);
   ObjCInterfaceDecl *CDecl = dyn_cast_or_null<ObjCInterfaceDecl>(CDeclU);
-  if (CDecl == 0) {
+  if (!CDecl) {
     Diag(ClassLocation, diag::warn_undef_interface) << ClassName;
     Diag(ClassLocation, diag::warn_undef_interface) << ClassName;
     if (CDeclU)
     if (CDeclU)
       Diag(CDeclU->getLocation(), diag::note_previous_declaration);
       Diag(CDeclU->getLocation(), diag::note_previous_declaration);
-    return 0;
+    return nullptr;
   }
   }
 
 
   // Everything checked out, instantiate a new alias declaration AST.
   // Everything checked out, instantiate a new alias declaration AST.
@@ -713,8 +713,8 @@ Sema::ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc,
   assert(ProtocolName && "Missing protocol identifier");
   assert(ProtocolName && "Missing protocol identifier");
   ObjCProtocolDecl *PrevDecl = LookupProtocol(ProtocolName, ProtocolLoc,
   ObjCProtocolDecl *PrevDecl = LookupProtocol(ProtocolName, ProtocolLoc,
                                               ForRedeclaration);
                                               ForRedeclaration);
-  ObjCProtocolDecl *PDecl = 0;
-  if (ObjCProtocolDecl *Def = PrevDecl? PrevDecl->getDefinition() : 0) {
+  ObjCProtocolDecl *PDecl = nullptr;
+  if (ObjCProtocolDecl *Def = PrevDecl? PrevDecl->getDefinition() : nullptr) {
     // If we already have a definition, complain.
     // If we already have a definition, complain.
     Diag(ProtocolLoc, diag::warn_duplicate_protocol_def) << ProtocolName;
     Diag(ProtocolLoc, diag::warn_duplicate_protocol_def) << ProtocolName;
     Diag(Def->getLocation(), diag::note_previous_definition);
     Diag(Def->getLocation(), diag::note_previous_definition);
@@ -725,7 +725,7 @@ Sema::ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc,
     // FIXME: Can we turn this into an error?
     // FIXME: Can we turn this into an error?
     PDecl = ObjCProtocolDecl::Create(Context, CurContext, ProtocolName,
     PDecl = ObjCProtocolDecl::Create(Context, CurContext, ProtocolName,
                                      ProtocolLoc, AtProtoInterfaceLoc,
                                      ProtocolLoc, AtProtoInterfaceLoc,
-                                     /*PrevDecl=*/0);
+                                     /*PrevDecl=*/nullptr);
     PDecl->startDefinition();
     PDecl->startDefinition();
   } else {
   } else {
     if (PrevDecl) {
     if (PrevDecl) {
@@ -793,7 +793,8 @@ Sema::FindProtocolDeclaration(bool WarnOnDeclarations,
       DeclFilterCCC<ObjCProtocolDecl> Validator;
       DeclFilterCCC<ObjCProtocolDecl> Validator;
       TypoCorrection Corrected = CorrectTypo(
       TypoCorrection Corrected = CorrectTypo(
           DeclarationNameInfo(ProtocolId[i].first, ProtocolId[i].second),
           DeclarationNameInfo(ProtocolId[i].first, ProtocolId[i].second),
-          LookupObjCProtocolName, TUScope, NULL, Validator, CTK_ErrorRecovery);
+          LookupObjCProtocolName, TUScope, nullptr, Validator,
+          CTK_ErrorRecovery);
       if ((PDecl = Corrected.getCorrectionDeclAs<ObjCProtocolDecl>()))
       if ((PDecl = Corrected.getCorrectionDeclAs<ObjCProtocolDecl>()))
         diagnoseTypo(Corrected, PDiag(diag::err_undeclared_protocol_suggest)
         diagnoseTypo(Corrected, PDiag(diag::err_undeclared_protocol_suggest)
                                     << ProtocolId[i].first);
                                     << ProtocolId[i].first);
@@ -900,7 +901,7 @@ ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc,
   if (!IDecl 
   if (!IDecl 
       || RequireCompleteType(ClassLoc, Context.getObjCInterfaceType(IDecl),
       || RequireCompleteType(ClassLoc, Context.getObjCInterfaceType(IDecl),
                              diag::err_category_forward_interface,
                              diag::err_category_forward_interface,
-                             CategoryName == 0)) {
+                             CategoryName == nullptr)) {
     // Create an invalid ObjCCategoryDecl to serve as context for
     // Create an invalid ObjCCategoryDecl to serve as context for
     // the enclosing method declarations.  We mark the decl invalid
     // the enclosing method declarations.  We mark the decl invalid
     // to make it clear that this isn't a valid AST.
     // to make it clear that this isn't a valid AST.
@@ -957,7 +958,7 @@ Decl *Sema::ActOnStartCategoryImplementation(
                       IdentifierInfo *ClassName, SourceLocation ClassLoc,
                       IdentifierInfo *ClassName, SourceLocation ClassLoc,
                       IdentifierInfo *CatName, SourceLocation CatLoc) {
                       IdentifierInfo *CatName, SourceLocation CatLoc) {
   ObjCInterfaceDecl *IDecl = getObjCInterfaceDecl(ClassName, ClassLoc, true);
   ObjCInterfaceDecl *IDecl = getObjCInterfaceDecl(ClassName, ClassLoc, true);
-  ObjCCategoryDecl *CatIDecl = 0;
+  ObjCCategoryDecl *CatIDecl = nullptr;
   if (IDecl && IDecl->hasDefinition()) {
   if (IDecl && IDecl->hasDefinition()) {
     CatIDecl = IDecl->FindCategoryDeclaration(CatName);
     CatIDecl = IDecl->FindCategoryDeclaration(CatName);
     if (!CatIDecl) {
     if (!CatIDecl) {
@@ -1016,7 +1017,7 @@ Decl *Sema::ActOnStartClassImplementation(
                       IdentifierInfo *ClassName, SourceLocation ClassLoc,
                       IdentifierInfo *ClassName, SourceLocation ClassLoc,
                       IdentifierInfo *SuperClassname,
                       IdentifierInfo *SuperClassname,
                       SourceLocation SuperClassLoc) {
                       SourceLocation SuperClassLoc) {
-  ObjCInterfaceDecl *IDecl = 0;
+  ObjCInterfaceDecl *IDecl = nullptr;
   // Check for another declaration kind with the same name.
   // Check for another declaration kind with the same name.
   NamedDecl *PrevDecl
   NamedDecl *PrevDecl
     = LookupSingleName(TUScope, ClassName, ClassLoc, LookupOrdinaryName,
     = LookupSingleName(TUScope, ClassName, ClassLoc, LookupOrdinaryName,
@@ -1033,7 +1034,7 @@ Decl *Sema::ActOnStartClassImplementation(
     ObjCInterfaceValidatorCCC Validator;
     ObjCInterfaceValidatorCCC Validator;
     TypoCorrection Corrected =
     TypoCorrection Corrected =
             CorrectTypo(DeclarationNameInfo(ClassName, ClassLoc),
             CorrectTypo(DeclarationNameInfo(ClassName, ClassLoc),
-                        LookupOrdinaryName, TUScope, NULL, Validator,
+                        LookupOrdinaryName, TUScope, nullptr, Validator,
                         CTK_NonError);
                         CTK_NonError);
     if (Corrected.getCorrectionDeclAs<ObjCInterfaceDecl>()) {
     if (Corrected.getCorrectionDeclAs<ObjCInterfaceDecl>()) {
       // Suggest the (potentially) correct interface name. Don't provide a
       // Suggest the (potentially) correct interface name. Don't provide a
@@ -1048,7 +1049,7 @@ Decl *Sema::ActOnStartClassImplementation(
   }
   }
 
 
   // Check that super class name is valid class name
   // Check that super class name is valid class name
-  ObjCInterfaceDecl* SDecl = 0;
+  ObjCInterfaceDecl *SDecl = nullptr;
   if (SuperClassname) {
   if (SuperClassname) {
     // Check if a different kind of symbol declared in this scope.
     // Check if a different kind of symbol declared in this scope.
     PrevDecl = LookupSingleName(TUScope, SuperClassname, SuperClassLoc,
     PrevDecl = LookupSingleName(TUScope, SuperClassname, SuperClassLoc,
@@ -1060,7 +1061,7 @@ Decl *Sema::ActOnStartClassImplementation(
     } else {
     } else {
       SDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
       SDecl = dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
       if (SDecl && !SDecl->hasDefinition())
       if (SDecl && !SDecl->hasDefinition())
-        SDecl = 0;
+        SDecl = nullptr;
       if (!SDecl)
       if (!SDecl)
         Diag(SuperClassLoc, diag::err_undef_superclass)
         Diag(SuperClassLoc, diag::err_undef_superclass)
           << SuperClassname << ClassName;
           << SuperClassname << ClassName;
@@ -1081,7 +1082,7 @@ Decl *Sema::ActOnStartClassImplementation(
     // FIXME: Do we support attributes on the @implementation? If so we should
     // FIXME: Do we support attributes on the @implementation? If so we should
     // copy them over.
     // copy them over.
     IDecl = ObjCInterfaceDecl::Create(Context, CurContext, AtClassImplLoc,
     IDecl = ObjCInterfaceDecl::Create(Context, CurContext, AtClassImplLoc,
-                                      ClassName, /*PrevDecl=*/0, ClassLoc, 
+                                      ClassName, /*PrevDecl=*/nullptr, ClassLoc,
                                       true);
                                       true);
     IDecl->startDefinition();
     IDecl->startDefinition();
     if (SDecl) {
     if (SDecl) {
@@ -1244,7 +1245,7 @@ static void WarnUndefinedMethod(Sema &S, SourceLocation ImpLoc,
                                 ObjCMethodDecl *method,
                                 ObjCMethodDecl *method,
                                 bool &IncompleteImpl,
                                 bool &IncompleteImpl,
                                 unsigned DiagID,
                                 unsigned DiagID,
-                                NamedDecl *NeededFor = 0) {
+                                NamedDecl *NeededFor = nullptr) {
   // No point warning no definition of method which is 'unavailable'.
   // No point warning no definition of method which is 'unavailable'.
   switch (method->getAvailability()) {
   switch (method->getAvailability()) {
   case AR_Available:
   case AR_Available:
@@ -1688,7 +1689,7 @@ static void CheckProtocolMethodDefs(Sema &S,
   assert (IDecl && "CheckProtocolMethodDefs - IDecl is null");
   assert (IDecl && "CheckProtocolMethodDefs - IDecl is null");
   
   
   ObjCInterfaceDecl *Super = IDecl->getSuperClass();
   ObjCInterfaceDecl *Super = IDecl->getSuperClass();
-  ObjCInterfaceDecl *NSIDecl = 0;
+  ObjCInterfaceDecl *NSIDecl = nullptr;
 
 
   // If this protocol is marked 'objc_protocol_requires_explicit_implementation'
   // If this protocol is marked 'objc_protocol_requires_explicit_implementation'
   // then we should check if any class in the super class hierarchy also
   // then we should check if any class in the super class hierarchy also
@@ -1712,7 +1713,7 @@ static void CheckProtocolMethodDefs(Sema &S,
 
 
     // If no super class conforms to the protocol, we should not search
     // If no super class conforms to the protocol, we should not search
     // for methods in the super class to implicitly satisfy the protocol.
     // for methods in the super class to implicitly satisfy the protocol.
-    Super = NULL;
+    Super = nullptr;
   }
   }
 
 
   if (S.getLangOpts().ObjCRuntime.isNeXTFamily()) {
   if (S.getLangOpts().ObjCRuntime.isNeXTFamily()) {
@@ -1751,7 +1752,7 @@ static void CheckProtocolMethodDefs(Sema &S,
                                           true /* instance */,
                                           true /* instance */,
                                           false /* shallowCategory */,
                                           false /* shallowCategory */,
                                           true /* followsSuper */,
                                           true /* followsSuper */,
-                                          NULL /* category */))) {
+                                          nullptr /* category */))) {
             // If a method is not implemented in the category implementation but
             // If a method is not implemented in the category implementation but
             // has been declared in its primary class, superclass,
             // has been declared in its primary class, superclass,
             // or in one of their protocols, no need to issue the warning. 
             // or in one of their protocols, no need to issue the warning. 
@@ -1784,7 +1785,7 @@ static void CheckProtocolMethodDefs(Sema &S,
                                         false /* class method */,
                                         false /* class method */,
                                         false /* shallowCategoryLookup */,
                                         false /* shallowCategoryLookup */,
                                         true  /* followSuper */,
                                         true  /* followSuper */,
-                                        NULL /* category */))) {
+                                        nullptr /* category */))) {
       // See above comment for instance method lookups.
       // See above comment for instance method lookups.
       if (C && IDecl->lookupMethod(method->getSelector(),
       if (C && IDecl->lookupMethod(method->getSelector(),
                                    false /* class */,
                                    false /* class */,
@@ -2220,9 +2221,9 @@ void Sema::addMethodToGlobalList(ObjCMethodList *List, ObjCMethodDecl *Method) {
         List->setBits(List->getBits()+1);
         List->setBits(List->getBits()+1);
 
 
   // If the list is empty, make it a singleton list.
   // If the list is empty, make it a singleton list.
-  if (List->Method == 0) {
+  if (List->Method == nullptr) {
     List->Method = Method;
     List->Method = Method;
-    List->setNext(0);
+    List->setNext(nullptr);
     return;
     return;
   }
   }
   
   
@@ -2262,7 +2263,7 @@ void Sema::addMethodToGlobalList(ObjCMethodList *List, ObjCMethodDecl *Method) {
   // We have a new signature for an existing method - add it.
   // We have a new signature for an existing method - add it.
   // This is extremely rare. Only 1% of Cocoa selectors are "overloaded".
   // This is extremely rare. Only 1% of Cocoa selectors are "overloaded".
   ObjCMethodList *Mem = BumpAlloc.Allocate<ObjCMethodList>();
   ObjCMethodList *Mem = BumpAlloc.Allocate<ObjCMethodList>();
-  Previous->setNext(new (Mem) ObjCMethodList(Method, 0));
+  Previous->setNext(new (Mem) ObjCMethodList(Method, nullptr));
 }
 }
 
 
 /// \brief Read the contents of the method pool for a given selector from
 /// \brief Read the contents of the method pool for a given selector from
@@ -2319,7 +2320,7 @@ ObjCMethodDecl *Sema::LookupMethodInGlobalPool(Selector Sel, SourceRange R,
     
     
   GlobalMethodPool::iterator Pos = MethodPool.find(Sel);
   GlobalMethodPool::iterator Pos = MethodPool.find(Sel);
   if (Pos == MethodPool.end())
   if (Pos == MethodPool.end())
-    return 0;
+    return nullptr;
 
 
   // Gather the non-hidden methods.
   // Gather the non-hidden methods.
   ObjCMethodList &MethList = instance ? Pos->second.first : Pos->second.second;
   ObjCMethodList &MethList = instance ? Pos->second.first : Pos->second.second;
@@ -2337,7 +2338,7 @@ ObjCMethodDecl *Sema::LookupMethodInGlobalPool(Selector Sel, SourceRange R,
   // If there aren't any visible methods, we're done.
   // If there aren't any visible methods, we're done.
   // FIXME: Recover if there are any known-but-hidden methods?
   // FIXME: Recover if there are any known-but-hidden methods?
   if (Methods.empty())
   if (Methods.empty())
-    return 0;
+    return nullptr;
 
 
   if (Methods.size() == 1)
   if (Methods.size() == 1)
     return Methods[0];
     return Methods[0];
@@ -2399,7 +2400,7 @@ ObjCMethodDecl *Sema::LookupMethodInGlobalPool(Selector Sel, SourceRange R,
 ObjCMethodDecl *Sema::LookupImplementedMethodInGlobalPool(Selector Sel) {
 ObjCMethodDecl *Sema::LookupImplementedMethodInGlobalPool(Selector Sel) {
   GlobalMethodPool::iterator Pos = MethodPool.find(Sel);
   GlobalMethodPool::iterator Pos = MethodPool.find(Sel);
   if (Pos == MethodPool.end())
   if (Pos == MethodPool.end())
-    return 0;
+    return nullptr;
 
 
   GlobalMethods &Methods = Pos->second;
   GlobalMethods &Methods = Pos->second;
   for (const ObjCMethodList *Method = &Methods.first; Method;
   for (const ObjCMethodList *Method = &Methods.first; Method;
@@ -2411,7 +2412,7 @@ ObjCMethodDecl *Sema::LookupImplementedMethodInGlobalPool(Selector Sel) {
        Method = Method->getNext())
        Method = Method->getNext())
     if (Method->Method && Method->Method->isDefined())
     if (Method->Method && Method->Method->isDefined())
       return Method->Method;
       return Method->Method;
-  return 0;
+  return nullptr;
 }
 }
 
 
 static void
 static void
@@ -2443,7 +2444,8 @@ static bool HelperIsMethodInObjCType(Sema &S, Selector Sel,
     return true;
     return true;
   if (S.LookupMethodInObjectType(Sel, ObjectType, true/*Instance method*/))
   if (S.LookupMethodInObjectType(Sel, ObjectType, true/*Instance method*/))
     return true;
     return true;
-  return S.LookupMethodInObjectType(Sel, ObjectType, false/*Class method*/) != 0;
+  return S.LookupMethodInObjectType(Sel, ObjectType, false/*Class method*/) !=
+         nullptr;
 }
 }
 
 
 const ObjCMethodDecl *
 const ObjCMethodDecl *
@@ -2455,7 +2457,7 @@ Sema::SelectorsForTypoCorrection(Selector Sel,
   if (ObjectType.isNull())
   if (ObjectType.isNull())
     ObjectIsId = ObjectIsClass = false;
     ObjectIsId = ObjectIsClass = false;
   else if (!ObjectType->isObjCObjectPointerType())
   else if (!ObjectType->isObjCObjectPointerType())
-    return 0;
+    return nullptr;
   else if (const ObjCObjectPointerType *ObjCPtr =
   else if (const ObjCObjectPointerType *ObjCPtr =
            ObjectType->getAsObjCInterfacePointerType()) {
            ObjectType->getAsObjCInterfacePointerType()) {
     ObjectType = QualType(ObjCPtr->getInterfaceType(), 0);
     ObjectType = QualType(ObjCPtr->getInterfaceType(), 0);
@@ -2466,8 +2468,8 @@ Sema::SelectorsForTypoCorrection(Selector Sel,
   else if (ObjectType->isObjCClassType() || ObjectType->isObjCQualifiedClassType())
   else if (ObjectType->isObjCClassType() || ObjectType->isObjCQualifiedClassType())
     ObjectIsId = false;
     ObjectIsId = false;
   else
   else
-    return 0;
-  
+    return nullptr;
+
   for (GlobalMethodPool::iterator b = MethodPool.begin(),
   for (GlobalMethodPool::iterator b = MethodPool.begin(),
        e = MethodPool.end(); b != e; b++) {
        e = MethodPool.end(); b != e; b++) {
     // instance methods
     // instance methods
@@ -2499,7 +2501,7 @@ Sema::SelectorsForTypoCorrection(Selector Sel,
     HelperSelectorsForTypoCorrection(SelectedMethods,
     HelperSelectorsForTypoCorrection(SelectedMethods,
                                      Sel.getAsString(), Methods[i]);
                                      Sel.getAsString(), Methods[i]);
   }
   }
-  return (SelectedMethods.size() == 1) ? SelectedMethods[0] : NULL;
+  return (SelectedMethods.size() == 1) ? SelectedMethods[0] : nullptr;
 }
 }
 
 
 /// DiagnoseDuplicateIvars -
 /// DiagnoseDuplicateIvars -
@@ -2548,7 +2550,7 @@ Sema::ObjCContainerKind Sema::getObjCContainerKind() const {
 Decl *Sema::ActOnAtEnd(Scope *S, SourceRange AtEnd, ArrayRef<Decl *> allMethods,
 Decl *Sema::ActOnAtEnd(Scope *S, SourceRange AtEnd, ArrayRef<Decl *> allMethods,
                        ArrayRef<DeclGroupPtrTy> allTUVars) {
                        ArrayRef<DeclGroupPtrTy> allTUVars) {
   if (getObjCContainerKind() == Sema::OCK_None)
   if (getObjCContainerKind() == Sema::OCK_None)
-    return 0;
+    return nullptr;
 
 
   assert(AtEnd.isValid() && "Invalid location for '@end'");
   assert(AtEnd.isValid() && "Invalid location for '@end'");
 
 
@@ -2675,7 +2677,7 @@ Decl *Sema::ActOnAtEnd(Scope *S, SourceRange AtEnd, ArrayRef<Decl *> allMethods,
         DiagnoseMissingDesignatedInitOverrides(IC, IDecl);
         DiagnoseMissingDesignatedInitOverrides(IC, IDecl);
 
 
       bool HasRootClassAttr = IDecl->hasAttr<ObjCRootClassAttr>();
       bool HasRootClassAttr = IDecl->hasAttr<ObjCRootClassAttr>();
-      if (IDecl->getSuperClass() == NULL) {
+      if (IDecl->getSuperClass() == nullptr) {
         // This class has no superclass, so check that it has been marked with
         // This class has no superclass, so check that it has been marked with
         // __attribute((objc_root_class)).
         // __attribute((objc_root_class)).
         if (!HasRootClassAttr) {
         if (!HasRootClassAttr) {
@@ -3058,19 +3060,19 @@ Decl *Sema::ActOnMethodDeclaration(
   // Make sure we can establish a context for the method.
   // Make sure we can establish a context for the method.
   if (!CurContext->isObjCContainer()) {
   if (!CurContext->isObjCContainer()) {
     Diag(MethodLoc, diag::error_missing_method_context);
     Diag(MethodLoc, diag::error_missing_method_context);
-    return 0;
+    return nullptr;
   }
   }
   ObjCContainerDecl *OCD = dyn_cast<ObjCContainerDecl>(CurContext);
   ObjCContainerDecl *OCD = dyn_cast<ObjCContainerDecl>(CurContext);
   Decl *ClassDecl = cast<Decl>(OCD); 
   Decl *ClassDecl = cast<Decl>(OCD); 
   QualType resultDeclType;
   QualType resultDeclType;
 
 
   bool HasRelatedResultType = false;
   bool HasRelatedResultType = false;
-  TypeSourceInfo *ReturnTInfo = 0;
+  TypeSourceInfo *ReturnTInfo = nullptr;
   if (ReturnType) {
   if (ReturnType) {
     resultDeclType = GetTypeFromParser(ReturnType, &ReturnTInfo);
     resultDeclType = GetTypeFromParser(ReturnType, &ReturnTInfo);
 
 
     if (CheckFunctionReturnType(resultDeclType, MethodLoc))
     if (CheckFunctionReturnType(resultDeclType, MethodLoc))
-      return 0;
+      return nullptr;
 
 
     HasRelatedResultType = (resultDeclType == Context.getObjCInstanceType());
     HasRelatedResultType = (resultDeclType == Context.getObjCInstanceType());
   } else { // get the type for "id".
   } else { // get the type for "id".
@@ -3096,7 +3098,7 @@ Decl *Sema::ActOnMethodDeclaration(
 
 
     if (!ArgInfo[i].Type) {
     if (!ArgInfo[i].Type) {
       ArgType = Context.getObjCIdType();
       ArgType = Context.getObjCIdType();
-      DI = 0;
+      DI = nullptr;
     } else {
     } else {
       ArgType = GetTypeFromParser(ArgInfo[i].Type, &DI);
       ArgType = GetTypeFromParser(ArgInfo[i].Type, &DI);
     }
     }
@@ -3163,7 +3165,7 @@ Decl *Sema::ActOnMethodDeclaration(
     ProcessDeclAttributeList(TUScope, ObjCMethod, AttrList);
     ProcessDeclAttributeList(TUScope, ObjCMethod, AttrList);
 
 
   // Add the method now.
   // Add the method now.
-  const ObjCMethodDecl *PrevMethod = 0;
+  const ObjCMethodDecl *PrevMethod = nullptr;
   if (ObjCImplDecl *ImpDecl = dyn_cast<ObjCImplDecl>(ClassDecl)) {
   if (ObjCImplDecl *ImpDecl = dyn_cast<ObjCImplDecl>(ClassDecl)) {
     if (MethodType == tok::minus) {
     if (MethodType == tok::minus) {
       PrevMethod = ImpDecl->getInstanceMethod(Sel);
       PrevMethod = ImpDecl->getInstanceMethod(Sel);
@@ -3173,7 +3175,7 @@ Decl *Sema::ActOnMethodDeclaration(
       ImpDecl->addClassMethod(ObjCMethod);
       ImpDecl->addClassMethod(ObjCMethod);
     }
     }
 
 
-    ObjCMethodDecl *IMD = 0;
+    ObjCMethodDecl *IMD = nullptr;
     if (ObjCInterfaceDecl *IDecl = ImpDecl->getClassInterface())
     if (ObjCInterfaceDecl *IDecl = ImpDecl->getClassInterface())
       IMD = IDecl->lookupMethod(ObjCMethod->getSelector(), 
       IMD = IDecl->lookupMethod(ObjCMethod->getSelector(), 
                                 ObjCMethod->isInstanceMethod());
                                 ObjCMethod->isInstanceMethod());
@@ -3459,15 +3461,15 @@ ObjCIvarDecl *
 Sema::GetIvarBackingPropertyAccessor(const ObjCMethodDecl *Method,
 Sema::GetIvarBackingPropertyAccessor(const ObjCMethodDecl *Method,
                                      const ObjCPropertyDecl *&PDecl) const {
                                      const ObjCPropertyDecl *&PDecl) const {
   if (Method->isClassMethod())
   if (Method->isClassMethod())
-    return 0;
+    return nullptr;
   const ObjCInterfaceDecl *IDecl = Method->getClassInterface();
   const ObjCInterfaceDecl *IDecl = Method->getClassInterface();
   if (!IDecl)
   if (!IDecl)
-    return 0;
+    return nullptr;
   Method = IDecl->lookupMethod(Method->getSelector(), /*isInstance=*/true,
   Method = IDecl->lookupMethod(Method->getSelector(), /*isInstance=*/true,
                                /*shallowCategoryLookup=*/false,
                                /*shallowCategoryLookup=*/false,
                                /*followSuper=*/false);
                                /*followSuper=*/false);
   if (!Method || !Method->isPropertyAccessor())
   if (!Method || !Method->isPropertyAccessor())
-    return 0;
+    return nullptr;
   if ((PDecl = Method->findPropertyDecl()))
   if ((PDecl = Method->findPropertyDecl()))
     if (ObjCIvarDecl *IV = PDecl->getPropertyIvarDecl()) {
     if (ObjCIvarDecl *IV = PDecl->getPropertyIvarDecl()) {
       // property backing ivar must belong to property's class
       // property backing ivar must belong to property's class
@@ -3477,7 +3479,7 @@ Sema::GetIvarBackingPropertyAccessor(const ObjCMethodDecl *Method,
                                                         IV->getIdentifier());
                                                         IV->getIdentifier());
       return IV;
       return IV;
     }
     }
-  return 0;
+  return nullptr;
 }
 }
 
 
 namespace {
 namespace {

+ 2 - 2
lib/Sema/SemaExceptionSpec.cpp

@@ -283,7 +283,7 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) {
 
 
   case EST_ComputedNoexcept:
   case EST_ComputedNoexcept:
     OS << "noexcept(";
     OS << "noexcept(";
-    OldProto->getNoexceptExpr()->printPretty(OS, 0, getPrintingPolicy());
+    OldProto->getNoexceptExpr()->printPretty(OS, nullptr, getPrintingPolicy());
     OS << ")";
     OS << ")";
     break;
     break;
 
 
@@ -455,7 +455,7 @@ bool Sema::CheckEquivalentExceptionSpec(const PartialDiagnostic &DiagID,
   // throw(std::bad_alloc) as equivalent for operator new and operator new[].
   // throw(std::bad_alloc) as equivalent for operator new and operator new[].
   // This is because the implicit declaration changed, but old code would break.
   // This is because the implicit declaration changed, but old code would break.
   if (getLangOpts().CPlusPlus11 && IsOperatorNew) {
   if (getLangOpts().CPlusPlus11 && IsOperatorNew) {
-    const FunctionProtoType *WithExceptions = 0;
+    const FunctionProtoType *WithExceptions = nullptr;
     if (OldEST == EST_None && NewEST == EST_Dynamic)
     if (OldEST == EST_None && NewEST == EST_Dynamic)
       WithExceptions = New;
       WithExceptions = New;
     else if (OldEST == EST_Dynamic && NewEST == EST_None)
     else if (OldEST == EST_Dynamic && NewEST == EST_None)

+ 94 - 89
lib/Sema/SemaExpr.cpp

@@ -94,11 +94,11 @@ static AvailabilityResult DiagnoseAvailabilityOfDecl(Sema &S,
         Result = TheEnumDecl->getAvailability(&Message);
         Result = TheEnumDecl->getAvailability(&Message);
     }
     }
 
 
-  const ObjCPropertyDecl *ObjCPDecl = 0;
+  const ObjCPropertyDecl *ObjCPDecl = nullptr;
   if (Result == AR_Deprecated || Result == AR_Unavailable) {
   if (Result == AR_Deprecated || Result == AR_Unavailable) {
     if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) {
     if (const ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) {
       if (const ObjCPropertyDecl *PD = MD->findPropertyDecl()) {
       if (const ObjCPropertyDecl *PD = MD->findPropertyDecl()) {
-        AvailabilityResult PDeclResult = PD->getAvailability(0);
+        AvailabilityResult PDeclResult = PD->getAvailability(nullptr);
         if (PDeclResult == Result)
         if (PDeclResult == Result)
           ObjCPDecl = PD;
           ObjCPDecl = PD;
       }
       }
@@ -342,7 +342,7 @@ void Sema::DiagnoseSentinelCalls(NamedDecl *D, SourceLocation Loc,
     calleeType = CT_Function;
     calleeType = CT_Function;
   } else if (isa<VarDecl>(D)) {
   } else if (isa<VarDecl>(D)) {
     QualType type = cast<ValueDecl>(D)->getType();
     QualType type = cast<ValueDecl>(D)->getType();
-    const FunctionType *fn = 0;
+    const FunctionType *fn = nullptr;
     if (const PointerType *ptr = type->getAs<PointerType>()) {
     if (const PointerType *ptr = type->getAs<PointerType>()) {
       fn = ptr->getPointeeType()->getAs<FunctionType>();
       fn = ptr->getPointeeType()->getAs<FunctionType>();
       if (!fn) return;
       if (!fn) return;
@@ -497,7 +497,7 @@ static void DiagnoseDirectIsaAccess(Sema &S, const ObjCIvarRefExpr *OIRE,
     BaseType = BaseType->getPointeeType();
     BaseType = BaseType->getPointeeType();
   if (const ObjCObjectType *OTy = BaseType->getAs<ObjCObjectType>())
   if (const ObjCObjectType *OTy = BaseType->getAs<ObjCObjectType>())
     if (ObjCInterfaceDecl *IDecl = OTy->getInterface()) {
     if (ObjCInterfaceDecl *IDecl = OTy->getInterface()) {
-      ObjCInterfaceDecl *ClassDeclared = 0;
+      ObjCInterfaceDecl *ClassDeclared = nullptr;
       ObjCIvarDecl *IV = IDecl->lookupInstanceVariable(Member, ClassDeclared);
       ObjCIvarDecl *IV = IDecl->lookupInstanceVariable(Member, ClassDeclared);
       if (!ClassDeclared->getSuperClass()
       if (!ClassDeclared->getSuperClass()
           && (*ClassDeclared->ivar_begin()) == IV) {
           && (*ClassDeclared->ivar_begin()) == IV) {
@@ -590,8 +590,8 @@ ExprResult Sema::DefaultLvalueConversion(Expr *E) {
   }
   }
   else if (const ObjCIvarRefExpr *OIRE =
   else if (const ObjCIvarRefExpr *OIRE =
             dyn_cast<ObjCIvarRefExpr>(E->IgnoreParenCasts()))
             dyn_cast<ObjCIvarRefExpr>(E->IgnoreParenCasts()))
-    DiagnoseDirectIsaAccess(*this, OIRE, SourceLocation(), /* Expr*/0);
-  
+    DiagnoseDirectIsaAccess(*this, OIRE, SourceLocation(), /* Expr*/nullptr);
+
   // C++ [conv.lval]p1:
   // C++ [conv.lval]p1:
   //   [...] If T is a non-class type, the type of the prvalue is the
   //   [...] If T is a non-class type, the type of the prvalue is the
   //   cv-unqualified version of T. Otherwise, the type of the
   //   cv-unqualified version of T. Otherwise, the type of the
@@ -613,7 +613,7 @@ ExprResult Sema::DefaultLvalueConversion(Expr *E) {
     ExprNeedsCleanups = true;
     ExprNeedsCleanups = true;
 
 
   ExprResult Res = Owned(ImplicitCastExpr::Create(Context, T, CK_LValueToRValue,
   ExprResult Res = Owned(ImplicitCastExpr::Create(Context, T, CK_LValueToRValue,
-                                                  E, 0, VK_RValue));
+                                                  E, nullptr, VK_RValue));
 
 
   // C11 6.3.2.1p2:
   // C11 6.3.2.1p2:
   //   ... if the lvalue has atomic type, the value has the non-atomic version 
   //   ... if the lvalue has atomic type, the value has the non-atomic version 
@@ -621,7 +621,7 @@ ExprResult Sema::DefaultLvalueConversion(Expr *E) {
   if (const AtomicType *Atomic = T->getAs<AtomicType>()) {
   if (const AtomicType *Atomic = T->getAs<AtomicType>()) {
     T = Atomic->getValueType().getUnqualifiedType();
     T = Atomic->getValueType().getUnqualifiedType();
     Res = Owned(ImplicitCastExpr::Create(Context, T, CK_AtomicToNonAtomic,
     Res = Owned(ImplicitCastExpr::Create(Context, T, CK_AtomicToNonAtomic,
-                                         Res.get(), 0, VK_RValue));
+                                         Res.get(), nullptr, VK_RValue));
   }
   }
   
   
   return Res;
   return Res;
@@ -806,7 +806,7 @@ void Sema::checkVariadicArgument(const Expr *E, VariadicCallType CT) {
   switch (VAK) {
   switch (VAK) {
   case VAK_ValidInCXX11:
   case VAK_ValidInCXX11:
     DiagRuntimeBehavior(
     DiagRuntimeBehavior(
-        E->getLocStart(), 0,
+        E->getLocStart(), nullptr,
         PDiag(diag::warn_cxx98_compat_pass_non_pod_arg_to_vararg)
         PDiag(diag::warn_cxx98_compat_pass_non_pod_arg_to_vararg)
           << Ty << CT);
           << Ty << CT);
     // Fall through.
     // Fall through.
@@ -814,7 +814,7 @@ void Sema::checkVariadicArgument(const Expr *E, VariadicCallType CT) {
     if (Ty->isRecordType()) {
     if (Ty->isRecordType()) {
       // This is unlikely to be what the user intended. If the class has a
       // This is unlikely to be what the user intended. If the class has a
       // 'c_str' member function, the user probably meant to call that.
       // 'c_str' member function, the user probably meant to call that.
-      DiagRuntimeBehavior(E->getLocStart(), 0,
+      DiagRuntimeBehavior(E->getLocStart(), nullptr,
                           PDiag(diag::warn_pass_class_arg_to_vararg)
                           PDiag(diag::warn_pass_class_arg_to_vararg)
                             << Ty << CT << hasCStrMethod(E) << ".c_str()");
                             << Ty << CT << hasCStrMethod(E) << ".c_str()");
     }
     }
@@ -822,7 +822,7 @@ void Sema::checkVariadicArgument(const Expr *E, VariadicCallType CT) {
 
 
   case VAK_Undefined:
   case VAK_Undefined:
     DiagRuntimeBehavior(
     DiagRuntimeBehavior(
-        E->getLocStart(), 0,
+        E->getLocStart(), nullptr,
         PDiag(diag::warn_cannot_pass_non_pod_arg_to_vararg)
         PDiag(diag::warn_cannot_pass_non_pod_arg_to_vararg)
           << getLangOpts().CPlusPlus11 << Ty << CT);
           << getLangOpts().CPlusPlus11 << Ty << CT);
     break;
     break;
@@ -830,7 +830,7 @@ void Sema::checkVariadicArgument(const Expr *E, VariadicCallType CT) {
   case VAK_Invalid:
   case VAK_Invalid:
     if (Ty->isObjCObjectType())
     if (Ty->isObjCObjectType())
       DiagRuntimeBehavior(
       DiagRuntimeBehavior(
-          E->getLocStart(), 0,
+          E->getLocStart(), nullptr,
           PDiag(diag::err_cannot_pass_objc_interface_to_vararg)
           PDiag(diag::err_cannot_pass_objc_interface_to_vararg)
             << Ty << CT);
             << Ty << CT);
     else
     else
@@ -1302,7 +1302,7 @@ Sema::ActOnGenericSelectionExpr(SourceLocation KeyLoc,
     if (ArgTypes[i])
     if (ArgTypes[i])
       (void) GetTypeFromParser(ArgTypes[i], &Types[i]);
       (void) GetTypeFromParser(ArgTypes[i], &Types[i]);
     else
     else
-      Types[i] = 0;
+      Types[i] = nullptr;
   }
   }
 
 
   ExprResult ER = CreateGenericSelectionExpr(KeyLoc, DefaultLoc, RParenLoc,
   ExprResult ER = CreateGenericSelectionExpr(KeyLoc, DefaultLoc, RParenLoc,
@@ -1715,7 +1715,7 @@ Sema::DecomposeUnqualifiedId(const UnqualifiedId &Id,
     TemplateArgs = &Buffer;
     TemplateArgs = &Buffer;
   } else {
   } else {
     NameInfo = GetNameFromUnqualifiedId(Id);
     NameInfo = GetNameFromUnqualifiedId(Id);
-    TemplateArgs = 0;
+    TemplateArgs = nullptr;
   }
   }
 }
 }
 
 
@@ -1742,7 +1742,7 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R,
   // original lookup would not have found something because it was a
   // original lookup would not have found something because it was a
   // dependent name.
   // dependent name.
   DeclContext *DC = (SS.isEmpty() && !CallsUndergoingInstantiation.empty())
   DeclContext *DC = (SS.isEmpty() && !CallsUndergoingInstantiation.empty())
-    ? CurContext : 0;
+    ? CurContext : nullptr;
   while (DC) {
   while (DC) {
     if (isa<CXXRecordDecl>(DC)) {
     if (isa<CXXRecordDecl>(DC)) {
       LookupQualifiedName(R, DC);
       LookupQualifiedName(R, DC);
@@ -1800,9 +1800,9 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R,
               CXXDependentScopeMemberExpr::Create(
               CXXDependentScopeMemberExpr::Create(
                   Context, DepThis, DepThisType, true, SourceLocation(),
                   Context, DepThis, DepThisType, true, SourceLocation(),
                   SS.getWithLocInContext(Context),
                   SS.getWithLocInContext(Context),
-                  ULE->getTemplateKeywordLoc(), 0,
+                  ULE->getTemplateKeywordLoc(), nullptr,
                   R.getLookupNameInfo(),
                   R.getLookupNameInfo(),
-                  ULE->hasExplicitTemplateArgs() ? &TList : 0);
+                  ULE->hasExplicitTemplateArgs() ? &TList : nullptr);
           CallsUndergoingInstantiation.back()->setCallee(DepExpr);
           CallsUndergoingInstantiation.back()->setCallee(DepExpr);
         } else {
         } else {
           Diag(R.getNameLoc(), diagnostic) << Name;
           Diag(R.getNameLoc(), diagnostic) << Name;
@@ -2059,9 +2059,9 @@ ExprResult Sema::ActOnIdExpression(Scope *S,
           QualType ThisType = MD->getThisType(Context);
           QualType ThisType = MD->getThisType(Context);
           // Since the 'this' expression is synthesized, we don't need to
           // Since the 'this' expression is synthesized, we don't need to
           // perform the double-lookup check.
           // perform the double-lookup check.
-          NamedDecl *FirstQualifierInScope = 0;
+          NamedDecl *FirstQualifierInScope = nullptr;
           return Owned(CXXDependentScopeMemberExpr::Create(
           return Owned(CXXDependentScopeMemberExpr::Create(
-              Context, /*This=*/0, ThisType, /*IsArrow=*/true,
+              Context, /*This=*/nullptr, ThisType, /*IsArrow=*/true,
               /*Op=*/SourceLocation(), SS.getWithLocInContext(Context),
               /*Op=*/SourceLocation(), SS.getWithLocInContext(Context),
               TemplateKWLoc, FirstQualifierInScope, NameInfo, TemplateArgs));
               TemplateKWLoc, FirstQualifierInScope, NameInfo, TemplateArgs));
         }
         }
@@ -2168,7 +2168,7 @@ Sema::BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS,
   DeclContext *DC = computeDeclContext(SS, false);
   DeclContext *DC = computeDeclContext(SS, false);
   if (!DC)
   if (!DC)
     return BuildDependentDeclRefExpr(SS, /*TemplateKWLoc=*/SourceLocation(),
     return BuildDependentDeclRefExpr(SS, /*TemplateKWLoc=*/SourceLocation(),
-                                     NameInfo, /*TemplateArgs=*/0);
+                                     NameInfo, /*TemplateArgs=*/nullptr);
 
 
   if (RequireCompleteDeclContext(SS, DC))
   if (RequireCompleteDeclContext(SS, DC))
     return ExprError();
     return ExprError();
@@ -2181,7 +2181,7 @@ Sema::BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS,
 
 
   if (R.getResultKind() == LookupResult::NotFoundInCurrentInstantiation)
   if (R.getResultKind() == LookupResult::NotFoundInCurrentInstantiation)
     return BuildDependentDeclRefExpr(SS, /*TemplateKWLoc=*/SourceLocation(),
     return BuildDependentDeclRefExpr(SS, /*TemplateKWLoc=*/SourceLocation(),
-                                     NameInfo, /*TemplateArgs=*/0);
+                                     NameInfo, /*TemplateArgs=*/nullptr);
 
 
   if (R.empty()) {
   if (R.empty()) {
     Diag(NameInfo.getLoc(), diag::err_no_member)
     Diag(NameInfo.getLoc(), diag::err_no_member)
@@ -2196,7 +2196,7 @@ Sema::BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS,
   if (!R.empty() && (*R.begin())->isCXXClassMember() && !IsAddressOfOperand)
   if (!R.empty() && (*R.begin())->isCXXClassMember() && !IsAddressOfOperand)
     return BuildPossibleImplicitMemberExpr(SS,
     return BuildPossibleImplicitMemberExpr(SS,
                                            /*TemplateKWLoc=*/SourceLocation(),
                                            /*TemplateKWLoc=*/SourceLocation(),
-                                           R, /*TemplateArgs=*/0);
+                                           R, /*TemplateArgs=*/nullptr);
 
 
   return BuildDeclarationNameExpr(SS, R, /* ADL */ false);
   return BuildDeclarationNameExpr(SS, R, /* ADL */ false);
 }
 }
@@ -2238,11 +2238,11 @@ Sema::LookupInObjCMethod(LookupResult &Lookup, Scope *S,
   else
   else
     LookForIvars = (Lookup.isSingleResult() &&
     LookForIvars = (Lookup.isSingleResult() &&
                     Lookup.getFoundDecl()->isDefinedOutsideFunctionOrMethod());
                     Lookup.getFoundDecl()->isDefinedOutsideFunctionOrMethod());
-  ObjCInterfaceDecl *IFace = 0;
+  ObjCInterfaceDecl *IFace = nullptr;
   if (LookForIvars) {
   if (LookForIvars) {
     IFace = CurMethod->getClassInterface();
     IFace = CurMethod->getClassInterface();
     ObjCInterfaceDecl *ClassDeclared;
     ObjCInterfaceDecl *ClassDeclared;
-    ObjCIvarDecl *IV = 0;
+    ObjCIvarDecl *IV = nullptr;
     if (IFace && (IV = IFace->lookupInstanceVariable(II, ClassDeclared))) {
     if (IFace && (IV = IFace->lookupInstanceVariable(II, ClassDeclared))) {
       // Diagnose using an ivar in a class method.
       // Diagnose using an ivar in a class method.
       if (IsClassMethod)
       if (IsClassMethod)
@@ -2338,7 +2338,7 @@ Sema::LookupInObjCMethod(LookupResult &Lookup, Scope *S,
     }
     }
   }
   }
   // Sentinel value saying that we didn't do anything special.
   // Sentinel value saying that we didn't do anything special.
-  return Owned((Expr*) 0);
+  return Owned((Expr*) nullptr);
 }
 }
 
 
 /// \brief Cast a base object to a member's actual type.
 /// \brief Cast a base object to a member's actual type.
@@ -2831,7 +2831,7 @@ ExprResult Sema::BuildDeclarationNameExpr(
 ExprResult Sema::BuildPredefinedExpr(SourceLocation Loc,
 ExprResult Sema::BuildPredefinedExpr(SourceLocation Loc,
                                      PredefinedExpr::IdentType IT) {
                                      PredefinedExpr::IdentType IT) {
   // Pick the current block, lambda, captured statement or function.
   // Pick the current block, lambda, captured statement or function.
-  Decl *currentDecl = 0;
+  Decl *currentDecl = nullptr;
   if (const BlockScopeInfo *BSI = getCurBlock())
   if (const BlockScopeInfo *BSI = getCurBlock())
     currentDecl = BSI->TheDecl;
     currentDecl = BSI->TheDecl;
   else if (const LambdaScopeInfo *LSI = getCurLambda())
   else if (const LambdaScopeInfo *LSI = getCurLambda())
@@ -3232,7 +3232,7 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) {
 }
 }
 
 
 ExprResult Sema::ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E) {
 ExprResult Sema::ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E) {
-  assert((E != 0) && "ActOnParenExpr() missing expr");
+  assert(E && "ActOnParenExpr() missing expr");
   return Owned(new (Context) ParenExpr(L, R, E));
   return Owned(new (Context) ParenExpr(L, R, E));
 }
 }
 
 
@@ -3452,7 +3452,7 @@ static bool CheckAlignOfExpr(Sema &S, Expr *E) {
     return true;
     return true;
   }
   }
 
 
-  ValueDecl *D = 0;
+  ValueDecl *D = nullptr;
   if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E)) {
   if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E)) {
     D = DRE->getDecl();
     D = DRE->getDecl();
   } else if (MemberExpr *ME = dyn_cast<MemberExpr>(E)) {
   } else if (MemberExpr *ME = dyn_cast<MemberExpr>(E)) {
@@ -3587,7 +3587,7 @@ Sema::ActOnUnaryExprOrTypeTraitExpr(SourceLocation OpLoc,
                                     UnaryExprOrTypeTrait ExprKind, bool IsType,
                                     UnaryExprOrTypeTrait ExprKind, bool IsType,
                                     void *TyOrEx, const SourceRange &ArgRange) {
                                     void *TyOrEx, const SourceRange &ArgRange) {
   // If error parsing type, ignore.
   // If error parsing type, ignore.
-  if (TyOrEx == 0) return ExprError();
+  if (!TyOrEx) return ExprError();
 
 
   if (IsType) {
   if (IsType) {
     TypeSourceInfo *TInfo;
     TypeSourceInfo *TInfo;
@@ -3768,7 +3768,8 @@ Sema::CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc,
     // Use custom logic if this should be the pseudo-object subscript
     // Use custom logic if this should be the pseudo-object subscript
     // expression.
     // expression.
     if (!LangOpts.isSubscriptPointerArithmetic())
     if (!LangOpts.isSubscriptPointerArithmetic())
-      return BuildObjCSubscriptExpression(RLoc, BaseExpr, IndexExpr, 0, 0);
+      return BuildObjCSubscriptExpression(RLoc, BaseExpr, IndexExpr, nullptr,
+                                          nullptr);
 
 
     ResultType = PTy->getPointeeType();
     ResultType = PTy->getPointeeType();
   } else if (const PointerType *PTy = RHSTy->getAs<PointerType>()) {
   } else if (const PointerType *PTy = RHSTy->getAs<PointerType>()) {
@@ -3886,7 +3887,7 @@ ExprResult Sema::BuildCXXDefaultArgExpr(SourceLocation CallLoc,
 
 
     // Instantiate the expression.
     // Instantiate the expression.
     MultiLevelTemplateArgumentList MutiLevelArgList
     MultiLevelTemplateArgumentList MutiLevelArgList
-      = getTemplateInstantiationArgs(FD, 0, /*RelativeToPrimary=*/true);
+      = getTemplateInstantiationArgs(FD, nullptr, /*RelativeToPrimary=*/true);
 
 
     InstantiatingTemplate Inst(*this, CallLoc, Param,
     InstantiatingTemplate Inst(*this, CallLoc, Param,
                                MutiLevelArgList.getInnermost());
                                MutiLevelArgList.getInnermost());
@@ -4004,7 +4005,7 @@ static TypoCorrection TryTypoCorrectionForCall(Sema &S, Expr *Fn,
 
 
   if (TypoCorrection Corrected = S.CorrectTypo(
   if (TypoCorrection Corrected = S.CorrectTypo(
           DeclarationNameInfo(FuncName, NameLoc), Sema::LookupOrdinaryName,
           DeclarationNameInfo(FuncName, NameLoc), Sema::LookupOrdinaryName,
-          S.getScopeForContext(S.CurContext), NULL, CCC,
+          S.getScopeForContext(S.CurContext), nullptr, CCC,
           Sema::CTK_ErrorRecovery)) {
           Sema::CTK_ErrorRecovery)) {
     if (NamedDecl *ND = Corrected.getCorrectionDecl()) {
     if (NamedDecl *ND = Corrected.getCorrectionDecl()) {
       if (Corrected.isOverloaded()) {
       if (Corrected.isOverloaded()) {
@@ -4480,7 +4481,7 @@ Sema::ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc,
 
 
   Expr *NakedFn = Fn->IgnoreParens();
   Expr *NakedFn = Fn->IgnoreParens();
 
 
-  NamedDecl *NDecl = 0;
+  NamedDecl *NDecl = nullptr;
   if (UnaryOperator *UnOp = dyn_cast<UnaryOperator>(NakedFn))
   if (UnaryOperator *UnOp = dyn_cast<UnaryOperator>(NakedFn))
     if (UnOp->getOpcode() == UO_AddrOf)
     if (UnOp->getOpcode() == UO_AddrOf)
       NakedFn = UnOp->getSubExpr()->IgnoreParens();
       NakedFn = UnOp->getSubExpr()->IgnoreParens();
@@ -4522,7 +4523,7 @@ Sema::ActOnCUDAExecConfigExpr(Scope *S, SourceLocation LLLLoc,
       ConfigDecl, false, ConfigQTy, VK_LValue, LLLLoc);
       ConfigDecl, false, ConfigQTy, VK_LValue, LLLLoc);
   MarkFunctionReferenced(LLLLoc, ConfigDecl);
   MarkFunctionReferenced(LLLLoc, ConfigDecl);
 
 
-  return ActOnCallExpr(S, ConfigDR, LLLLoc, ExecConfig, GGGLoc, 0,
+  return ActOnCallExpr(S, ConfigDR, LLLLoc, ExecConfig, GGGLoc, nullptr,
                        /*IsExecConfig=*/true);
                        /*IsExecConfig=*/true);
 }
 }
 
 
@@ -4612,7 +4613,7 @@ Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl,
     // C99 6.5.2.2p1 - "The expression that denotes the called function shall
     // C99 6.5.2.2p1 - "The expression that denotes the called function shall
     // have type pointer to function".
     // have type pointer to function".
     FuncT = PT->getPointeeType()->getAs<FunctionType>();
     FuncT = PT->getPointeeType()->getAs<FunctionType>();
-    if (FuncT == 0)
+    if (!FuncT)
       return ExprError(Diag(LParenLoc, diag::err_typecheck_call_not_function)
       return ExprError(Diag(LParenLoc, diag::err_typecheck_call_not_function)
                          << Fn->getType() << Fn->getSourceRange());
                          << Fn->getType() << Fn->getSourceRange());
   } else if (const BlockPointerType *BPT =
   } else if (const BlockPointerType *BPT =
@@ -4671,7 +4672,7 @@ Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl,
     if (FDecl) {
     if (FDecl) {
       // Check if we have too few/too many template arguments, based
       // Check if we have too few/too many template arguments, based
       // on our knowledge of the function definition.
       // on our knowledge of the function definition.
-      const FunctionDecl *Def = 0;
+      const FunctionDecl *Def = nullptr;
       if (FDecl->hasBody(Def) && Args.size() != Def->param_size()) {
       if (FDecl->hasBody(Def) && Args.size() != Def->param_size()) {
         Proto = Def->getType()->getAs<FunctionProtoType>();
         Proto = Def->getType()->getAs<FunctionProtoType>();
        if (!Proto || !(Proto->isVariadic() && Args.size() >= Def->param_size()))
        if (!Proto || !(Proto->isVariadic() && Args.size() >= Def->param_size()))
@@ -4793,7 +4794,7 @@ Sema::BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo,
     return ExprError();
     return ExprError();
   LiteralExpr = Result.get();
   LiteralExpr = Result.get();
 
 
-  bool isFileScope = getCurFunctionOrMethodDecl() == 0;
+  bool isFileScope = getCurFunctionOrMethodDecl() == nullptr;
   if (isFileScope &&
   if (isFileScope &&
       !LiteralExpr->isTypeDependent() &&
       !LiteralExpr->isTypeDependent() &&
       !LiteralExpr->isValueDependent() &&
       !LiteralExpr->isValueDependent() &&
@@ -4846,7 +4847,7 @@ static void maybeExtendBlockObject(Sema &S, ExprResult &E) {
 
 
   E = ImplicitCastExpr::Create(S.Context, E.get()->getType(),
   E = ImplicitCastExpr::Create(S.Context, E.get()->getType(),
                                CK_ARCExtendBlockObject, E.get(),
                                CK_ARCExtendBlockObject, E.get(),
-                               /*base path*/ 0, VK_RValue);
+                               /*base path*/ nullptr, VK_RValue);
   S.ExprNeedsCleanups = true;
   S.ExprNeedsCleanups = true;
 }
 }
 
 
@@ -5141,7 +5142,7 @@ ExprResult
 Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc,
 Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc,
                     Declarator &D, ParsedType &Ty,
                     Declarator &D, ParsedType &Ty,
                     SourceLocation RParenLoc, Expr *CastExpr) {
                     SourceLocation RParenLoc, Expr *CastExpr) {
-  assert(!D.isInvalidType() && (CastExpr != 0) &&
+  assert(!D.isInvalidType() && (CastExpr != nullptr) &&
          "ActOnCastExpr(): missing type or expr");
          "ActOnCastExpr(): missing type or expr");
 
 
   TypeSourceInfo *castTInfo = GetTypeForDeclaratorCast(D, CastExpr->getType());
   TypeSourceInfo *castTInfo = GetTypeForDeclaratorCast(D, CastExpr->getType());
@@ -5962,9 +5963,9 @@ ExprResult Sema::ActOnConditionalOp(SourceLocation QuestionLoc,
                                     Expr *RHSExpr) {
                                     Expr *RHSExpr) {
   // If this is the gnu "x ?: y" extension, analyze the types as though the LHS
   // If this is the gnu "x ?: y" extension, analyze the types as though the LHS
   // was the condition.
   // was the condition.
-  OpaqueValueExpr *opaqueValue = 0;
-  Expr *commonExpr = 0;
-  if (LHSExpr == 0) {
+  OpaqueValueExpr *opaqueValue = nullptr;
+  Expr *commonExpr = nullptr;
+  if (!LHSExpr) {
     commonExpr = CondExpr;
     commonExpr = CondExpr;
     // Lower out placeholder types first.  This is important so that we don't
     // Lower out placeholder types first.  This is important so that we don't
     // try to capture a placeholder. This happens in few cases in C++; such
     // try to capture a placeholder. This happens in few cases in C++; such
@@ -6540,7 +6541,7 @@ Sema::CheckTransparentUnionArgumentConstraints(QualType ArgType,
 
 
   // The field to initialize within the transparent union.
   // The field to initialize within the transparent union.
   RecordDecl *UD = UT->getDecl();
   RecordDecl *UD = UT->getDecl();
-  FieldDecl *InitField = 0;
+  FieldDecl *InitField = nullptr;
   // It's compatible if the expression matches any of the fields.
   // It's compatible if the expression matches any of the fields.
   for (auto *it : UD->fields()) {
   for (auto *it : UD->fields()) {
     if (it->getType()->isPointerType()) {
     if (it->getType()->isPointerType()) {
@@ -6776,8 +6777,9 @@ QualType Sema::CheckVectorOperands(ExprResult &LHS, ExprResult &RHS,
       return LHSType;
       return LHSType;
   }
   }
   if (!LHSVecType && isa<ExtVectorType>(RHSVecType)) {
   if (!LHSVecType && isa<ExtVectorType>(RHSVecType)) {
-    if (!tryVectorConvertAndSplat(*this, (IsCompAssign ? 0 : &LHS), LHSType,
-                                  RHSVecType->getElementType(), RHSType))
+    if (!tryVectorConvertAndSplat(*this, (IsCompAssign ? nullptr : &LHS),
+                                  LHSType, RHSVecType->getElementType(),
+                                  RHSType))
       return RHSType;
       return RHSType;
   }
   }
 
 
@@ -7257,7 +7259,7 @@ QualType Sema::CheckSubtractionOperands(ExprResult &LHS, ExprResult &RHS,
         return QualType();
         return QualType();
 
 
       // Check array bounds for pointer arithemtic
       // Check array bounds for pointer arithemtic
-      CheckArrayAccess(LHS.get(), RHS.get(), /*ArraySubscriptExpr*/0,
+      CheckArrayAccess(LHS.get(), RHS.get(), /*ArraySubscriptExpr*/nullptr,
                        /*AllowOnePastEnd*/true, /*IndexNegated*/true);
                        /*AllowOnePastEnd*/true, /*IndexNegated*/true);
 
 
       if (CompLHSTy) *CompLHSTy = LHS.get()->getType();
       if (CompLHSTy) *CompLHSTy = LHS.get()->getType();
@@ -7507,7 +7509,7 @@ static bool convertPointersToCompositeType(Sema &S, SourceLocation Loc,
          (LHSType->isMemberPointerType() && RHSType->isMemberPointerType()));
          (LHSType->isMemberPointerType() && RHSType->isMemberPointerType()));
 
 
   bool NonStandardCompositeType = false;
   bool NonStandardCompositeType = false;
-  bool *BoolPtr = S.isSFINAEContext() ? 0 : &NonStandardCompositeType;
+  bool *BoolPtr = S.isSFINAEContext() ? nullptr : &NonStandardCompositeType;
   QualType T = S.FindCompositePointerType(Loc, LHS, RHS, BoolPtr);
   QualType T = S.FindCompositePointerType(Loc, LHS, RHS, BoolPtr);
   if (T.isNull()) {
   if (T.isNull()) {
     diagnoseDistinctPointerComparison(S, Loc, LHS, RHS, /*isError*/true);
     diagnoseDistinctPointerComparison(S, Loc, LHS, RHS, /*isError*/true);
@@ -7744,7 +7746,7 @@ static ValueDecl *getCompareDecl(Expr *E) {
     if (Mem->isImplicitAccess())
     if (Mem->isImplicitAccess())
       return Mem->getMemberDecl();
       return Mem->getMemberDecl();
   }
   }
-  return 0;
+  return nullptr;
 }
 }
 
 
 // C99 6.5.8, C++ [expr.rel]
 // C99 6.5.8, C++ [expr.rel]
@@ -7787,7 +7789,7 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS,
     ValueDecl *DL = getCompareDecl(LHSStripped);
     ValueDecl *DL = getCompareDecl(LHSStripped);
     ValueDecl *DR = getCompareDecl(RHSStripped);
     ValueDecl *DR = getCompareDecl(RHSStripped);
     if (DL && DR && DL == DR && !IsWithinTemplateSpecialization(DL)) {
     if (DL && DR && DL == DR && !IsWithinTemplateSpecialization(DL)) {
-      DiagRuntimeBehavior(Loc, 0, PDiag(diag::warn_comparison_always)
+      DiagRuntimeBehavior(Loc, nullptr, PDiag(diag::warn_comparison_always)
                           << 0 // self-
                           << 0 // self-
                           << (Opc == BO_EQ
                           << (Opc == BO_EQ
                               || Opc == BO_LE
                               || Opc == BO_LE
@@ -7809,7 +7811,7 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS,
           always_evals_to = 2; // e.g. array1 <= array2
           always_evals_to = 2; // e.g. array1 <= array2
           break;
           break;
         }
         }
-        DiagRuntimeBehavior(Loc, 0, PDiag(diag::warn_comparison_always)
+        DiagRuntimeBehavior(Loc, nullptr, PDiag(diag::warn_comparison_always)
                             << 1 // array
                             << 1 // array
                             << always_evals_to);
                             << always_evals_to);
     }
     }
@@ -7821,8 +7823,8 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS,
 
 
     // Warn about comparisons against a string constant (unless the other
     // Warn about comparisons against a string constant (unless the other
     // operand is null), the user probably wants strcmp.
     // operand is null), the user probably wants strcmp.
-    Expr *literalString = 0;
-    Expr *literalStringStripped = 0;
+    Expr *literalString = nullptr;
+    Expr *literalStringStripped = nullptr;
     if ((isa<StringLiteral>(LHSStripped) || isa<ObjCEncodeExpr>(LHSStripped)) &&
     if ((isa<StringLiteral>(LHSStripped) || isa<ObjCEncodeExpr>(LHSStripped)) &&
         !RHSStripped->isNullPointerConstant(Context,
         !RHSStripped->isNullPointerConstant(Context,
                                             Expr::NPC_ValueDependentIsNull)) {
                                             Expr::NPC_ValueDependentIsNull)) {
@@ -7837,7 +7839,7 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS,
     }
     }
 
 
     if (literalString) {
     if (literalString) {
-      DiagRuntimeBehavior(Loc, 0,
+      DiagRuntimeBehavior(Loc, nullptr,
         PDiag(diag::warn_stringcompare)
         PDiag(diag::warn_stringcompare)
           << isa<ObjCEncodeExpr>(literalStringStripped)
           << isa<ObjCEncodeExpr>(literalStringStripped)
           << literalString->getSourceRange());
           << literalString->getSourceRange());
@@ -8182,7 +8184,7 @@ QualType Sema::CheckVectorCompareOperands(ExprResult &LHS, ExprResult &RHS,
       if (DeclRefExpr* DRR
       if (DeclRefExpr* DRR
             = dyn_cast<DeclRefExpr>(RHS.get()->IgnoreParenImpCasts()))
             = dyn_cast<DeclRefExpr>(RHS.get()->IgnoreParenImpCasts()))
         if (DRL->getDecl() == DRR->getDecl())
         if (DRL->getDecl() == DRR->getDecl())
-          DiagRuntimeBehavior(Loc, 0,
+          DiagRuntimeBehavior(Loc, nullptr,
                               PDiag(diag::warn_comparison_always)
                               PDiag(diag::warn_comparison_always)
                                 << 0 // self-
                                 << 0 // self-
                                 << 2 // "a constant"
                                 << 2 // "a constant"
@@ -8339,7 +8341,7 @@ static bool IsReadonlyMessage(Expr *E, Sema &S) {
   ObjCMessageExpr *Base =
   ObjCMessageExpr *Base =
     dyn_cast<ObjCMessageExpr>(ME->getBase()->IgnoreParenImpCasts());
     dyn_cast<ObjCMessageExpr>(ME->getBase()->IgnoreParenImpCasts());
   if (!Base) return false;
   if (!Base) return false;
-  return Base->getMethodDecl() != 0;
+  return Base->getMethodDecl() != nullptr;
 }
 }
 
 
 /// Is the given expression (which must be 'const') a reference to a
 /// Is the given expression (which must be 'const') a reference to a
@@ -8362,7 +8364,7 @@ static NonConstCaptureKind isReferenceToNonConstCapture(Sema &S, Expr *E) {
   assert(var->hasLocalStorage() && "capture added 'const' to non-local?");
   assert(var->hasLocalStorage() && "capture added 'const' to non-local?");
 
 
   // Decide whether the first capture was for a block or a lambda.
   // Decide whether the first capture was for a block or a lambda.
-  DeclContext *DC = S.CurContext, *Prev = 0;
+  DeclContext *DC = S.CurContext, *Prev = nullptr;
   while (DC != var->getDeclContext()) {
   while (DC != var->getDeclContext()) {
     Prev = DC;
     Prev = DC;
     DC = DC->getParent();
     DC = DC->getParent();
@@ -8742,7 +8744,7 @@ static ValueDecl *getPrimaryDecl(Expr *E) {
     // the base's value, so the object the base refers to is
     // the base's value, so the object the base refers to is
     // irrelevant.
     // irrelevant.
     if (cast<MemberExpr>(E)->isArrow())
     if (cast<MemberExpr>(E)->isArrow())
-      return 0;
+      return nullptr;
     // Otherwise, the expression refers to a part of the base
     // Otherwise, the expression refers to a part of the base
     return getPrimaryDecl(cast<MemberExpr>(E)->getBase());
     return getPrimaryDecl(cast<MemberExpr>(E)->getBase());
   case Stmt::ArraySubscriptExprClass: {
   case Stmt::ArraySubscriptExprClass: {
@@ -8753,7 +8755,7 @@ static ValueDecl *getPrimaryDecl(Expr *E) {
       if (ICE->getSubExpr()->getType()->isArrayType())
       if (ICE->getSubExpr()->getType()->isArrayType())
         return getPrimaryDecl(ICE->getSubExpr());
         return getPrimaryDecl(ICE->getSubExpr());
     }
     }
-    return 0;
+    return nullptr;
   }
   }
   case Stmt::UnaryOperatorClass: {
   case Stmt::UnaryOperatorClass: {
     UnaryOperator *UO = cast<UnaryOperator>(E);
     UnaryOperator *UO = cast<UnaryOperator>(E);
@@ -8764,7 +8766,7 @@ static ValueDecl *getPrimaryDecl(Expr *E) {
     case UO_Extension:
     case UO_Extension:
       return getPrimaryDecl(UO->getSubExpr());
       return getPrimaryDecl(UO->getSubExpr());
     default:
     default:
-      return 0;
+      return nullptr;
     }
     }
   }
   }
   case Stmt::ParenExprClass:
   case Stmt::ParenExprClass:
@@ -8774,7 +8776,7 @@ static ValueDecl *getPrimaryDecl(Expr *E) {
     // the sub-expression; otherwise, the result here doesn't matter.
     // the sub-expression; otherwise, the result here doesn't matter.
     return getPrimaryDecl(cast<ImplicitCastExpr>(E)->getSubExpr());
     return getPrimaryDecl(cast<ImplicitCastExpr>(E)->getSubExpr());
   default:
   default:
-    return 0;
+    return nullptr;
   }
   }
 }
 }
 
 
@@ -9159,7 +9161,7 @@ static void checkObjCPointerIntrospection(Sema &S, ExprResult &L, ExprResult &R,
   if (!S.getLangOpts().ObjC1)
   if (!S.getLangOpts().ObjC1)
     return;
     return;
 
 
-  const Expr *ObjCPointerExpr = 0, *OtherExpr = 0;
+  const Expr *ObjCPointerExpr = nullptr, *OtherExpr = nullptr;
   const Expr *LHS = L.get();
   const Expr *LHS = L.get();
   const Expr *RHS = R.get();
   const Expr *RHS = R.get();
 
 
@@ -9583,8 +9585,8 @@ ExprResult Sema::ActOnBinOp(Scope *S, SourceLocation TokLoc,
                             tok::TokenKind Kind,
                             tok::TokenKind Kind,
                             Expr *LHSExpr, Expr *RHSExpr) {
                             Expr *LHSExpr, Expr *RHSExpr) {
   BinaryOperatorKind Opc = ConvertTokenKindToBinaryOpcode(Kind);
   BinaryOperatorKind Opc = ConvertTokenKindToBinaryOpcode(Kind);
-  assert((LHSExpr != 0) && "ActOnBinOp(): missing left expression");
-  assert((RHSExpr != 0) && "ActOnBinOp(): missing right expression");
+  assert(LHSExpr && "ActOnBinOp(): missing left expression");
+  assert(RHSExpr && "ActOnBinOp(): missing right expression");
 
 
   // Emit warnings for tricky precedence issues, e.g. "bitfield & 0x4 == 0"
   // Emit warnings for tricky precedence issues, e.g. "bitfield & 0x4 == 0"
   DiagnoseBinOpPrecedence(*this, Opc, TokLoc, LHSExpr, RHSExpr);
   DiagnoseBinOpPrecedence(*this, Opc, TokLoc, LHSExpr, RHSExpr);
@@ -9963,11 +9965,11 @@ ExprResult Sema::ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc,
 static Expr *maybeRebuildARCConsumingStmt(Stmt *Statement) {
 static Expr *maybeRebuildARCConsumingStmt(Stmt *Statement) {
   // Should always be wrapped with one of these.
   // Should always be wrapped with one of these.
   ExprWithCleanups *cleanups = dyn_cast<ExprWithCleanups>(Statement);
   ExprWithCleanups *cleanups = dyn_cast<ExprWithCleanups>(Statement);
-  if (!cleanups) return 0;
+  if (!cleanups) return nullptr;
 
 
   ImplicitCastExpr *cast = dyn_cast<ImplicitCastExpr>(cleanups->getSubExpr());
   ImplicitCastExpr *cast = dyn_cast<ImplicitCastExpr>(cleanups->getSubExpr());
   if (!cast || cast->getCastKind() != CK_ARCConsumeObject)
   if (!cast || cast->getCastKind() != CK_ARCConsumeObject)
-    return 0;
+    return nullptr;
 
 
   // Splice out the cast.  This shouldn't modify any interesting
   // Splice out the cast.  This shouldn't modify any interesting
   // features of the statement.
   // features of the statement.
@@ -10002,7 +10004,7 @@ Sema::ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStmt,
   PopExpressionEvaluationContext();
   PopExpressionEvaluationContext();
 
 
   bool isFileScope
   bool isFileScope
-    = (getCurFunctionOrMethodDecl() == 0) && (getCurBlock() == 0);
+    = (getCurFunctionOrMethodDecl() == nullptr) && (getCurBlock() == nullptr);
   if (isFileScope)
   if (isFileScope)
     return ExprError(Diag(LPLoc, diag::err_stmtexpr_file_scope));
     return ExprError(Diag(LPLoc, diag::err_stmtexpr_file_scope));
 
 
@@ -10016,7 +10018,7 @@ Sema::ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStmt,
   bool StmtExprMayBindToTemp = false;
   bool StmtExprMayBindToTemp = false;
   if (!Compound->body_empty()) {
   if (!Compound->body_empty()) {
     Stmt *LastStmt = Compound->body_back();
     Stmt *LastStmt = Compound->body_back();
-    LabelStmt *LastLabelStmt = 0;
+    LabelStmt *LastLabelStmt = nullptr;
     // If LastStmt is a label, skip down through into the body.
     // If LastStmt is a label, skip down through into the body.
     while (LabelStmt *Label = dyn_cast<LabelStmt>(LastStmt)) {
     while (LabelStmt *Label = dyn_cast<LabelStmt>(LastStmt)) {
       LastLabelStmt = Label;
       LastLabelStmt = Label;
@@ -10052,7 +10054,7 @@ Sema::ActOnStmtExpr(SourceLocation LPLoc, Stmt *SubStmt,
 
 
         if (LastExpr.isInvalid())
         if (LastExpr.isInvalid())
           return ExprError();
           return ExprError();
-        if (LastExpr.get() != 0) {
+        if (LastExpr.get() != nullptr) {
           if (!LastLabelStmt)
           if (!LastLabelStmt)
             Compound->setLastStmt(LastExpr.take());
             Compound->setLastStmt(LastExpr.take());
           else
           else
@@ -10174,7 +10176,7 @@ ExprResult Sema::BuildBuiltinOffsetOf(SourceLocation BuiltinLoc,
                             : diag::warn_offsetof_non_pod_type;
                             : diag::warn_offsetof_non_pod_type;
 
 
       if (!IsSafe && !DidWarnAboutNonPOD &&
       if (!IsSafe && !DidWarnAboutNonPOD &&
-          DiagRuntimeBehavior(BuiltinLoc, 0,
+          DiagRuntimeBehavior(BuiltinLoc, nullptr,
                               PDiag(DiagID)
                               PDiag(DiagID)
                               << SourceRange(CompPtr[0].LocStart, OC.LocEnd)
                               << SourceRange(CompPtr[0].LocStart, OC.LocEnd)
                               << CurrentType))
                               << CurrentType))
@@ -10185,7 +10187,7 @@ ExprResult Sema::BuildBuiltinOffsetOf(SourceLocation BuiltinLoc,
     LookupResult R(*this, OC.U.IdentInfo, OC.LocStart, LookupMemberName);
     LookupResult R(*this, OC.U.IdentInfo, OC.LocStart, LookupMemberName);
     LookupQualifiedName(R, RD);
     LookupQualifiedName(R, RD);
     FieldDecl *MemberDecl = R.getAsSingle<FieldDecl>();
     FieldDecl *MemberDecl = R.getAsSingle<FieldDecl>();
-    IndirectFieldDecl *IndirectMemberDecl = 0;
+    IndirectFieldDecl *IndirectMemberDecl = nullptr;
     if (!MemberDecl) {
     if (!MemberDecl) {
       if ((IndirectMemberDecl = R.getAsSingle<IndirectFieldDecl>()))
       if ((IndirectMemberDecl = R.getAsSingle<IndirectFieldDecl>()))
         MemberDecl = IndirectMemberDecl->getAnonField();
         MemberDecl = IndirectMemberDecl->getAnonField();
@@ -10340,7 +10342,8 @@ void Sema::ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope) {
 
 
 void Sema::ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo,
 void Sema::ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo,
                                Scope *CurScope) {
                                Scope *CurScope) {
-  assert(ParamInfo.getIdentifier()==0 && "block-id should have no identifier!");
+  assert(ParamInfo.getIdentifier() == nullptr &&
+         "block-id should have no identifier!");
   assert(ParamInfo.getContext() == Declarator::BlockLiteralContext);
   assert(ParamInfo.getContext() == Declarator::BlockLiteralContext);
   BlockScopeInfo *CurBlock = getCurBlock();
   BlockScopeInfo *CurBlock = getCurBlock();
 
 
@@ -10411,7 +10414,7 @@ void Sema::ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo,
   if (ExplicitSignature) {
   if (ExplicitSignature) {
     for (unsigned I = 0, E = ExplicitSignature.getNumParams(); I != E; ++I) {
     for (unsigned I = 0, E = ExplicitSignature.getNumParams(); I != E; ++I) {
       ParmVarDecl *Param = ExplicitSignature.getParam(I);
       ParmVarDecl *Param = ExplicitSignature.getParam(I);
-      if (Param->getIdentifier() == 0 &&
+      if (Param->getIdentifier() == nullptr &&
           !Param->isImplicit() &&
           !Param->isImplicit() &&
           !Param->isInvalidDecl() &&
           !Param->isInvalidDecl() &&
           !getLangOpts().CPlusPlus)
           !getLangOpts().CPlusPlus)
@@ -11081,7 +11084,7 @@ namespace {
     // FIXME: This does the right thing, but maybe we need a more general
     // FIXME: This does the right thing, but maybe we need a more general
     // fix to TreeTransform?
     // fix to TreeTransform?
     StmtResult TransformLabelStmt(LabelStmt *S) {
     StmtResult TransformLabelStmt(LabelStmt *S) {
-      S->getDecl()->setStmt(0);
+      S->getDecl()->setStmt(nullptr);
       return BaseTransform::TransformLabelStmt(S);
       return BaseTransform::TransformLabelStmt(S);
     }
     }
 
 
@@ -11509,7 +11512,7 @@ static DeclContext *getParentOfCapturingContextOrNull(DeclContext *DC, VarDecl *
     if (Diagnose)
     if (Diagnose)
        diagnoseUncapturableValueReference(S, Loc, Var, DC);
        diagnoseUncapturableValueReference(S, Loc, Var, DC);
   }
   }
-  return 0;
+  return nullptr;
 }
 }
 
 
 // Certain capturing entities (lambdas, blocks etc.) are not allowed to capture 
 // Certain capturing entities (lambdas, blocks etc.) are not allowed to capture 
@@ -11586,7 +11589,7 @@ static bool captureInBlock(BlockScopeInfo *BSI, VarDecl *Var,
                                  QualType &DeclRefType, 
                                  QualType &DeclRefType, 
                                  const bool Nested,
                                  const bool Nested,
                                  Sema &S) {
                                  Sema &S) {
-  Expr *CopyExpr = 0;
+  Expr *CopyExpr = nullptr;
   bool ByRef = false;
   bool ByRef = false;
       
       
   // Blocks are not allowed to capture arrays.
   // Blocks are not allowed to capture arrays.
@@ -11683,7 +11686,7 @@ static bool captureInCapturedRegion(CapturedRegionScopeInfo *RSI,
   bool ByRef = true;
   bool ByRef = true;
   // Using an LValue reference type is consistent with Lambdas (see below).
   // Using an LValue reference type is consistent with Lambdas (see below).
   CaptureType = S.Context.getLValueReferenceType(DeclRefType);
   CaptureType = S.Context.getLValueReferenceType(DeclRefType);
-  Expr *CopyExpr = 0;
+  Expr *CopyExpr = nullptr;
   if (BuildAndDiagnose) {
   if (BuildAndDiagnose) {
     // The current implementation assumes that all variables are captured
     // The current implementation assumes that all variables are captured
     // by references. Since there is no capture by copy, no expression
     // by references. Since there is no capture by copy, no expression
@@ -11691,9 +11694,9 @@ static bool captureInCapturedRegion(CapturedRegionScopeInfo *RSI,
     RecordDecl *RD = RSI->TheRecordDecl;
     RecordDecl *RD = RSI->TheRecordDecl;
 
 
     FieldDecl *Field
     FieldDecl *Field
-      = FieldDecl::Create(S.Context, RD, Loc, Loc, 0, CaptureType,
+      = FieldDecl::Create(S.Context, RD, Loc, Loc, nullptr, CaptureType,
                           S.Context.getTrivialTypeSourceInfo(CaptureType, Loc),
                           S.Context.getTrivialTypeSourceInfo(CaptureType, Loc),
-                          0, false, ICIS_NoInit);
+                          nullptr, false, ICIS_NoInit);
     Field->setImplicit(true);
     Field->setImplicit(true);
     Field->setAccess(AS_private);
     Field->setAccess(AS_private);
     RD->addDecl(Field);
     RD->addDecl(Field);
@@ -11725,9 +11728,9 @@ static ExprResult addAsFieldToClosureType(Sema &S,
 
 
   // Build the non-static data member.
   // Build the non-static data member.
   FieldDecl *Field
   FieldDecl *Field
-    = FieldDecl::Create(S.Context, Lambda, Loc, Loc, 0, FieldType,
+    = FieldDecl::Create(S.Context, Lambda, Loc, Loc, nullptr, FieldType,
                         S.Context.getTrivialTypeSourceInfo(FieldType, Loc),
                         S.Context.getTrivialTypeSourceInfo(FieldType, Loc),
-                        0, false, ICIS_NoInit);
+                        nullptr, false, ICIS_NoInit);
   Field->setImplicit(true);
   Field->setImplicit(true);
   Field->setAccess(AS_private);
   Field->setAccess(AS_private);
   Lambda->addDecl(Field);
   Lambda->addDecl(Field);
@@ -11765,7 +11768,7 @@ static ExprResult addAsFieldToClosureType(Sema &S,
   while (const ConstantArrayType *Array
   while (const ConstantArrayType *Array
                         = S.Context.getAsConstantArrayType(BaseType)) {
                         = S.Context.getAsConstantArrayType(BaseType)) {
     // Create the iteration variable for this array index.
     // Create the iteration variable for this array index.
-    IdentifierInfo *IterationVarName = 0;
+    IdentifierInfo *IterationVarName = nullptr;
     {
     {
       SmallString<8> Str;
       SmallString<8> Str;
       llvm::raw_svector_ostream OS(Str);
       llvm::raw_svector_ostream OS(Str);
@@ -11913,7 +11916,7 @@ static bool captureInLambda(LambdaScopeInfo *LSI,
   }
   }
 
 
   // Capture this variable in the lambda.
   // Capture this variable in the lambda.
-  Expr *CopyExpr = 0;
+  Expr *CopyExpr = nullptr;
   if (BuildAndDiagnose) {
   if (BuildAndDiagnose) {
     ExprResult Result = addAsFieldToClosureType(S, LSI, Var, 
     ExprResult Result = addAsFieldToClosureType(S, LSI, Var, 
                                         CaptureType, DeclRefType, Loc,
                                         CaptureType, DeclRefType, Loc,
@@ -12093,7 +12096,7 @@ bool Sema::tryCaptureVariable(VarDecl *Var, SourceLocation Loc,
   QualType DeclRefType;
   QualType DeclRefType;
   return tryCaptureVariable(Var, Loc, Kind, EllipsisLoc,
   return tryCaptureVariable(Var, Loc, Kind, EllipsisLoc,
                             /*BuildAndDiagnose=*/true, CaptureType,
                             /*BuildAndDiagnose=*/true, CaptureType,
-                            DeclRefType, 0);
+                            DeclRefType, nullptr);
 }
 }
 
 
 QualType Sema::getCapturedDeclRefType(VarDecl *Var, SourceLocation Loc) {
 QualType Sema::getCapturedDeclRefType(VarDecl *Var, SourceLocation Loc) {
@@ -12103,7 +12106,7 @@ QualType Sema::getCapturedDeclRefType(VarDecl *Var, SourceLocation Loc) {
   // Determine whether we can capture this variable.
   // Determine whether we can capture this variable.
   if (tryCaptureVariable(Var, Loc, TryCapture_Implicit, SourceLocation(),
   if (tryCaptureVariable(Var, Loc, TryCapture_Implicit, SourceLocation(),
                          /*BuildAndDiagnose=*/false, CaptureType, 
                          /*BuildAndDiagnose=*/false, CaptureType, 
-                         DeclRefType, 0))
+                         DeclRefType, nullptr))
     return QualType();
     return QualType();
 
 
   return DeclRefType;
   return DeclRefType;
@@ -12120,7 +12123,7 @@ static inline bool IsVariableNonDependentAndAConstantExpression(VarDecl *Var,
  
  
   if (Var->getType()->isDependentType()) 
   if (Var->getType()->isDependentType()) 
     return false;
     return false;
-  const VarDecl *DefVD = 0;
+  const VarDecl *DefVD = nullptr;
   Var->getAnyInitializer(DefVD);
   Var->getAnyInitializer(DefVD);
   if (!DefVD) 
   if (!DefVD) 
     return false;
     return false;
@@ -12146,7 +12149,7 @@ void Sema::UpdateMarkingForLValueToRValue(Expr *E) {
   // variable. 
   // variable. 
   if (LambdaScopeInfo *LSI = getCurLambda()) {
   if (LambdaScopeInfo *LSI = getCurLambda()) {
     Expr *SansParensExpr = E->IgnoreParens();
     Expr *SansParensExpr = E->IgnoreParens();
-    VarDecl *Var = 0;
+    VarDecl *Var = nullptr;
     if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(SansParensExpr)) 
     if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(SansParensExpr)) 
       Var = dyn_cast<VarDecl>(DRE->getFoundDecl());
       Var = dyn_cast<VarDecl>(DRE->getFoundDecl());
     else if (MemberExpr *ME = dyn_cast<MemberExpr>(SansParensExpr))
     else if (MemberExpr *ME = dyn_cast<MemberExpr>(SansParensExpr))
@@ -12185,7 +12188,8 @@ void Sema::CleanupVarDeclMarking() {
       llvm_unreachable("Unexpcted expression");
       llvm_unreachable("Unexpcted expression");
     }
     }
 
 
-    MarkVarDeclODRUsed(Var, Loc, *this, /*MaxFunctionScopeIndex Pointer*/ 0);
+    MarkVarDeclODRUsed(Var, Loc, *this,
+                       /*MaxFunctionScopeIndex Pointer*/ nullptr);
   }
   }
 
 
   MaybeODRUseExprs.clear();
   MaybeODRUseExprs.clear();
@@ -12296,14 +12300,15 @@ static void DoMarkVarDeclReferenced(Sema &SemaRef, SourceLocation Loc,
     if (!Var->getType()->isReferenceType())
     if (!Var->getType()->isReferenceType())
       SemaRef.MaybeODRUseExprs.insert(E);
       SemaRef.MaybeODRUseExprs.insert(E);
   } else
   } else
-    MarkVarDeclODRUsed(Var, Loc, SemaRef, /*MaxFunctionScopeIndex ptr*/0);
+    MarkVarDeclODRUsed(Var, Loc, SemaRef,
+                       /*MaxFunctionScopeIndex ptr*/ nullptr);
 }
 }
 
 
 /// \brief Mark a variable referenced, and check whether it is odr-used
 /// \brief Mark a variable referenced, and check whether it is odr-used
 /// (C++ [basic.def.odr]p2, C99 6.9p3).  Note that this should not be
 /// (C++ [basic.def.odr]p2, C99 6.9p3).  Note that this should not be
 /// used directly for normal expressions referring to VarDecl.
 /// used directly for normal expressions referring to VarDecl.
 void Sema::MarkVariableReferenced(SourceLocation Loc, VarDecl *Var) {
 void Sema::MarkVariableReferenced(SourceLocation Loc, VarDecl *Var) {
-  DoMarkVarDeclReferenced(*this, Loc, Var, 0);
+  DoMarkVarDeclReferenced(*this, Loc, Var, nullptr);
 }
 }
 
 
 static void MarkExprReferenced(Sema &SemaRef, SourceLocation Loc,
 static void MarkExprReferenced(Sema &SemaRef, SourceLocation Loc,

+ 81 - 77
lib/Sema/SemaExprCXX.cpp

@@ -106,7 +106,7 @@ ParsedType Sema::getDestructorName(SourceLocation TildeLoc,
   // For this reason, we're currently only doing the C++03 version of this
   // For this reason, we're currently only doing the C++03 version of this
   // code; the C++0x version has to wait until we get a proper spec.
   // code; the C++0x version has to wait until we get a proper spec.
   QualType SearchType;
   QualType SearchType;
-  DeclContext *LookupCtx = 0;
+  DeclContext *LookupCtx = nullptr;
   bool isDependent = false;
   bool isDependent = false;
   bool LookInScope = false;
   bool LookInScope = false;
 
 
@@ -143,7 +143,7 @@ ParsedType Sema::getDestructorName(SourceLocation TildeLoc,
     }
     }
 
 
     // The second case from the C++03 rules quoted further above.
     // The second case from the C++03 rules quoted further above.
-    NestedNameSpecifier *Prefix = 0;
+    NestedNameSpecifier *Prefix = nullptr;
     if (AlreadySearched) {
     if (AlreadySearched) {
       // Nothing left to do.
       // Nothing left to do.
     } else if (LookAtPrefix && (Prefix = NNS->getPrefix())) {
     } else if (LookAtPrefix && (Prefix = NNS->getPrefix())) {
@@ -177,7 +177,7 @@ ParsedType Sema::getDestructorName(SourceLocation TildeLoc,
     LookInScope = true;
     LookInScope = true;
   }
   }
 
 
-  TypeDecl *NonMatchingTypeDecl = 0;
+  TypeDecl *NonMatchingTypeDecl = nullptr;
   LookupResult Found(*this, &II, NameLoc, LookupOrdinaryName);
   LookupResult Found(*this, &II, NameLoc, LookupOrdinaryName);
   for (unsigned Step = 0; Step != 2; ++Step) {
   for (unsigned Step = 0; Step != 2; ++Step) {
     // Look for the name first in the computed lookup context (if we
     // Look for the name first in the computed lookup context (if we
@@ -470,7 +470,7 @@ Sema::ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc,
 
 
   if (isType) {
   if (isType) {
     // The operand is a type; handle it as such.
     // The operand is a type; handle it as such.
-    TypeSourceInfo *TInfo = 0;
+    TypeSourceInfo *TInfo = nullptr;
     QualType T = GetTypeFromParser(ParsedType::getFromOpaquePtr(TyOrExpr),
     QualType T = GetTypeFromParser(ParsedType::getFromOpaquePtr(TyOrExpr),
                                    &TInfo);
                                    &TInfo);
     if (T.isNull())
     if (T.isNull())
@@ -546,7 +546,7 @@ Sema::ActOnCXXUuidof(SourceLocation OpLoc, SourceLocation LParenLoc,
 
 
   if (isType) {
   if (isType) {
     // The operand is a type; handle it as such.
     // The operand is a type; handle it as such.
-    TypeSourceInfo *TInfo = 0;
+    TypeSourceInfo *TInfo = nullptr;
     QualType T = GetTypeFromParser(ParsedType::getFromOpaquePtr(TyOrExpr),
     QualType T = GetTypeFromParser(ParsedType::getFromOpaquePtr(TyOrExpr),
                                    &TInfo);
                                    &TInfo);
     if (T.isNull())
     if (T.isNull())
@@ -685,13 +685,13 @@ ExprResult Sema::CheckCXXThrowOperand(SourceLocation ThrowLoc, Expr *E,
   //       operation from the operand to the exception object (15.1) can be 
   //       operation from the operand to the exception object (15.1) can be 
   //       omitted by constructing the automatic object directly into the 
   //       omitted by constructing the automatic object directly into the 
   //       exception object
   //       exception object
-  const VarDecl *NRVOVariable = 0;
+  const VarDecl *NRVOVariable = nullptr;
   if (IsThrownVarInScope)
   if (IsThrownVarInScope)
     NRVOVariable = getCopyElisionCandidate(QualType(), E, false);
     NRVOVariable = getCopyElisionCandidate(QualType(), E, false);
-  
+
   InitializedEntity Entity =
   InitializedEntity Entity =
       InitializedEntity::InitializeException(ThrowLoc, E->getType(),
       InitializedEntity::InitializeException(ThrowLoc, E->getType(),
-                                             /*NRVO=*/NRVOVariable != 0);
+                                             /*NRVO=*/NRVOVariable != nullptr);
   Res = PerformMoveOrCopyInitialization(Entity, NRVOVariable,
   Res = PerformMoveOrCopyInitialization(Entity, NRVOVariable,
                                         QualType(), E,
                                         QualType(), E,
                                         IsThrownVarInScope);
                                         IsThrownVarInScope);
@@ -748,8 +748,8 @@ Sema::CXXThisScopeRAII::CXXThisScopeRAII(Sema &S,
 {
 {
   if (!Enabled || !ContextDecl)
   if (!Enabled || !ContextDecl)
     return;
     return;
-  
-  CXXRecordDecl *Record = 0;
+
+  CXXRecordDecl *Record = nullptr;
   if (ClassTemplateDecl *Template = dyn_cast<ClassTemplateDecl>(ContextDecl))
   if (ClassTemplateDecl *Template = dyn_cast<ClassTemplateDecl>(ContextDecl))
     Record = Template->getTemplatedDecl();
     Record = Template->getTemplatedDecl();
   else
   else
@@ -772,9 +772,9 @@ Sema::CXXThisScopeRAII::~CXXThisScopeRAII() {
 static Expr *captureThis(ASTContext &Context, RecordDecl *RD,
 static Expr *captureThis(ASTContext &Context, RecordDecl *RD,
                          QualType ThisTy, SourceLocation Loc) {
                          QualType ThisTy, SourceLocation Loc) {
   FieldDecl *Field
   FieldDecl *Field
-    = FieldDecl::Create(Context, RD, Loc, Loc, 0, ThisTy,
+    = FieldDecl::Create(Context, RD, Loc, Loc, nullptr, ThisTy,
                         Context.getTrivialTypeSourceInfo(ThisTy, Loc),
                         Context.getTrivialTypeSourceInfo(ThisTy, Loc),
-                        0, false, ICIS_NoInit);
+                        nullptr, false, ICIS_NoInit);
   Field->setImplicit(true);
   Field->setImplicit(true);
   Field->setAccess(AS_private);
   Field->setAccess(AS_private);
   RD->addDecl(Field);
   RD->addDecl(Field);
@@ -829,7 +829,7 @@ bool Sema::CheckCXXThisCapture(SourceLocation Loc, bool Explicit,
   for (unsigned idx = MaxFunctionScopesIndex; NumClosures; 
   for (unsigned idx = MaxFunctionScopesIndex; NumClosures; 
       --idx, --NumClosures) {
       --idx, --NumClosures) {
     CapturingScopeInfo *CSI = cast<CapturingScopeInfo>(FunctionScopes[idx]);
     CapturingScopeInfo *CSI = cast<CapturingScopeInfo>(FunctionScopes[idx]);
-    Expr *ThisExpr = 0;
+    Expr *ThisExpr = nullptr;
     QualType ThisTy = getCurrentThisType();
     QualType ThisTy = getCurrentThisType();
     if (LambdaScopeInfo *LSI = dyn_cast<LambdaScopeInfo>(CSI))
     if (LambdaScopeInfo *LSI = dyn_cast<LambdaScopeInfo>(CSI))
       // For lambda expressions, build a field and an initializing expression.
       // For lambda expressions, build a field and an initializing expression.
@@ -958,7 +958,7 @@ Sema::BuildCXXTypeConstructExpr(TypeSourceInfo *TInfo,
     QualType ResultType = Result.get()->getType();
     QualType ResultType = Result.get()->getType();
     Result = Owned(CXXFunctionalCastExpr::Create(
     Result = Owned(CXXFunctionalCastExpr::Create(
         Context, ResultType, Expr::getValueKindForType(TInfo->getType()), TInfo,
         Context, ResultType, Expr::getValueKindForType(TInfo->getType()), TInfo,
-        CK_NoOp, Result.take(), /*Path=*/ 0, LParenLoc, RParenLoc));
+        CK_NoOp, Result.take(), /*Path=*/ nullptr, LParenLoc, RParenLoc));
   }
   }
 
 
   // FIXME: Improve AST representation?
   // FIXME: Improve AST representation?
@@ -1044,7 +1044,7 @@ Sema::ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
                   Declarator &D, Expr *Initializer) {
                   Declarator &D, Expr *Initializer) {
   bool TypeContainsAuto = D.getDeclSpec().containsPlaceholderType();
   bool TypeContainsAuto = D.getDeclSpec().containsPlaceholderType();
 
 
-  Expr *ArraySize = 0;
+  Expr *ArraySize = nullptr;
   // If the specified type is an array, unwrap it and save the expression.
   // If the specified type is an array, unwrap it and save the expression.
   if (D.getNumTypeObjects() > 0 &&
   if (D.getNumTypeObjects() > 0 &&
       D.getTypeObject(0).Kind == DeclaratorChunk::Array) {
       D.getTypeObject(0).Kind == DeclaratorChunk::Array) {
@@ -1085,7 +1085,7 @@ Sema::ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
                  .take();
                  .take();
           } else {
           } else {
             Array.NumElts
             Array.NumElts
-              = VerifyIntegerConstantExpression(NumElts, 0,
+              = VerifyIntegerConstantExpression(NumElts, nullptr,
                                                 diag::err_new_array_nonconst)
                                                 diag::err_new_array_nonconst)
                   .take();
                   .take();
           }
           }
@@ -1096,7 +1096,7 @@ Sema::ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
     }
     }
   }
   }
 
 
-  TypeSourceInfo *TInfo = GetTypeForDeclarator(D, /*Scope=*/0);
+  TypeSourceInfo *TInfo = GetTypeForDeclarator(D, /*Scope=*/nullptr);
   QualType AllocType = TInfo->getType();
   QualType AllocType = TInfo->getType();
   if (D.isInvalidType())
   if (D.isInvalidType())
     return ExprError();
     return ExprError();
@@ -1223,7 +1223,8 @@ Sema::BuildCXXNew(SourceRange Range, bool UseGlobal,
   if (CheckAllocatedType(AllocType, TypeRange.getBegin(), TypeRange))
   if (CheckAllocatedType(AllocType, TypeRange.getBegin(), TypeRange))
     return ExprError();
     return ExprError();
 
 
-  if (initStyle == CXXNewExpr::ListInit && isStdInitializerList(AllocType, 0)) {
+  if (initStyle == CXXNewExpr::ListInit &&
+      isStdInitializerList(AllocType, nullptr)) {
     Diag(AllocTypeInfo->getTypeLoc().getBeginLoc(),
     Diag(AllocTypeInfo->getTypeLoc().getBeginLoc(),
          diag::warn_dangling_std_initializer_list)
          diag::warn_dangling_std_initializer_list)
         << /*at end of FE*/0 << Inits[0]->getSourceRange();
         << /*at end of FE*/0 << Inits[0]->getSourceRange();
@@ -1387,8 +1388,8 @@ Sema::BuildCXXNew(SourceRange Range, bool UseGlobal,
     // be signed, larger than size_t, whatever.
     // be signed, larger than size_t, whatever.
   }
   }
 
 
-  FunctionDecl *OperatorNew = 0;
-  FunctionDecl *OperatorDelete = 0;
+  FunctionDecl *OperatorNew = nullptr;
+  FunctionDecl *OperatorDelete = nullptr;
 
 
   if (!AllocType->isDependentType() &&
   if (!AllocType->isDependentType() &&
       !Expr::hasAnyTypeDependentArguments(PlacementArgs) &&
       !Expr::hasAnyTypeDependentArguments(PlacementArgs) &&
@@ -1676,7 +1677,7 @@ bool Sema::FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range,
   // We don't need an operator delete if we're running under
   // We don't need an operator delete if we're running under
   // -fno-exceptions.
   // -fno-exceptions.
   if (!getLangOpts().Exceptions) {
   if (!getLangOpts().Exceptions) {
-    OperatorDelete = 0;
+    OperatorDelete = nullptr;
     return false;
     return false;
   }
   }
 
 
@@ -1747,13 +1748,14 @@ bool Sema::FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range,
     for (LookupResult::iterator D = FoundDelete.begin(),
     for (LookupResult::iterator D = FoundDelete.begin(),
                              DEnd = FoundDelete.end();
                              DEnd = FoundDelete.end();
          D != DEnd; ++D) {
          D != DEnd; ++D) {
-      FunctionDecl *Fn = 0;
+      FunctionDecl *Fn = nullptr;
       if (FunctionTemplateDecl *FnTmpl
       if (FunctionTemplateDecl *FnTmpl
             = dyn_cast<FunctionTemplateDecl>((*D)->getUnderlyingDecl())) {
             = dyn_cast<FunctionTemplateDecl>((*D)->getUnderlyingDecl())) {
         // Perform template argument deduction to try to match the
         // Perform template argument deduction to try to match the
         // expected function type.
         // expected function type.
         TemplateDeductionInfo Info(StartLoc);
         TemplateDeductionInfo Info(StartLoc);
-        if (DeduceTemplateArguments(FnTmpl, 0, ExpectedFunctionType, Fn, Info))
+        if (DeduceTemplateArguments(FnTmpl, nullptr, ExpectedFunctionType, Fn,
+                                    Info))
           continue;
           continue;
       } else
       } else
         Fn = cast<FunctionDecl>((*D)->getUnderlyingDecl());
         Fn = cast<FunctionDecl>((*D)->getUnderlyingDecl());
@@ -1867,7 +1869,7 @@ bool Sema::FindAllocationOverload(SourceLocation StartLoc, SourceRange Range,
 
 
     if (FunctionTemplateDecl *FnTemplate = dyn_cast<FunctionTemplateDecl>(D)) {
     if (FunctionTemplateDecl *FnTemplate = dyn_cast<FunctionTemplateDecl>(D)) {
       AddTemplateOverloadCandidate(FnTemplate, Alloc.getPair(),
       AddTemplateOverloadCandidate(FnTemplate, Alloc.getPair(),
-                                   /*ExplicitTemplateArgs=*/0,
+                                   /*ExplicitTemplateArgs=*/nullptr,
                                    Args, Candidates,
                                    Args, Candidates,
                                    /*SuppressUserConversions=*/false);
                                    /*SuppressUserConversions=*/false);
       continue;
       continue;
@@ -1988,7 +1990,7 @@ void Sema::DeclareGlobalNewDelete() {
                                         getOrCreateStdNamespace(),
                                         getOrCreateStdNamespace(),
                                         SourceLocation(), SourceLocation(),
                                         SourceLocation(), SourceLocation(),
                                       &PP.getIdentifierTable().get("bad_alloc"),
                                       &PP.getIdentifierTable().get("bad_alloc"),
-                                        0);
+                                        nullptr);
     getStdBadAlloc()->setImplicit(true);
     getStdBadAlloc()->setImplicit(true);
   }
   }
 
 
@@ -2086,7 +2088,7 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name,
   FunctionDecl *Alloc =
   FunctionDecl *Alloc =
     FunctionDecl::Create(Context, GlobalCtx, SourceLocation(),
     FunctionDecl::Create(Context, GlobalCtx, SourceLocation(),
                          SourceLocation(), Name,
                          SourceLocation(), Name,
-                         FnType, /*TInfo=*/0, SC_None, false, true);
+                         FnType, /*TInfo=*/nullptr, SC_None, false, true);
   Alloc->setImplicit();
   Alloc->setImplicit();
 
 
   if (AddMallocAttr)
   if (AddMallocAttr)
@@ -2095,9 +2097,9 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name,
   ParmVarDecl *ParamDecls[2];
   ParmVarDecl *ParamDecls[2];
   for (unsigned I = 0; I != NumParams; ++I) {
   for (unsigned I = 0; I != NumParams; ++I) {
     ParamDecls[I] = ParmVarDecl::Create(Context, Alloc, SourceLocation(),
     ParamDecls[I] = ParmVarDecl::Create(Context, Alloc, SourceLocation(),
-                                        SourceLocation(), 0,
-                                        Params[I], /*TInfo=*/0,
-                                        SC_None, 0);
+                                        SourceLocation(), nullptr,
+                                        Params[I], /*TInfo=*/nullptr,
+                                        SC_None, nullptr);
     ParamDecls[I]->setImplicit();
     ParamDecls[I]->setImplicit();
   }
   }
   Alloc->setParams(ArrayRef<ParmVarDecl*>(ParamDecls, NumParams));
   Alloc->setParams(ArrayRef<ParmVarDecl*>(ParamDecls, NumParams));
@@ -2221,7 +2223,7 @@ bool Sema::FindDeallocationFunction(SourceLocation StartLoc, CXXRecordDecl *RD,
     return true;
     return true;
   }
   }
 
 
-  Operator = 0;
+  Operator = nullptr;
   return false;
   return false;
 }
 }
 
 
@@ -2240,7 +2242,7 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
   // DR599 amends "pointer type" to "pointer to object type" in both cases.
   // DR599 amends "pointer type" to "pointer to object type" in both cases.
 
 
   ExprResult Ex = Owned(ExE);
   ExprResult Ex = Owned(ExE);
-  FunctionDecl *OperatorDelete = 0;
+  FunctionDecl *OperatorDelete = nullptr;
   bool ArrayFormAsWritten = ArrayForm;
   bool ArrayFormAsWritten = ArrayForm;
   bool UsualArrayDeleteWantsSize = false;
   bool UsualArrayDeleteWantsSize = false;
 
 
@@ -2322,7 +2324,7 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
                   diag::err_address_space_qualified_delete)
                   diag::err_address_space_qualified_delete)
                << Pointee.getUnqualifiedType() << AddressSpace;
                << Pointee.getUnqualifiedType() << AddressSpace;
 
 
-    CXXRecordDecl *PointeeRD = 0;
+    CXXRecordDecl *PointeeRD = nullptr;
     if (Pointee->isVoidType() && !isSFINAEContext()) {
     if (Pointee->isVoidType() && !isSFINAEContext()) {
       // The C++ standard bans deleting a pointer to a non-object type, which
       // The C++ standard bans deleting a pointer to a non-object type, which
       // effectively bans deletion of "void*". However, most compilers support
       // effectively bans deletion of "void*". However, most compilers support
@@ -2578,10 +2580,10 @@ static ExprResult BuildCXXCastArgument(Sema &S,
     Result = S.Owned(ImplicitCastExpr::Create(S.Context,
     Result = S.Owned(ImplicitCastExpr::Create(S.Context,
                                               Result.get()->getType(),
                                               Result.get()->getType(),
                                               CK_UserDefinedConversion,
                                               CK_UserDefinedConversion,
-                                              Result.get(), 0,
+                                              Result.get(), nullptr,
                                               Result.get()->getValueKind()));
                                               Result.get()->getValueKind()));
 
 
-    S.CheckMemberOperatorAccess(CastLoc, From, /*arg*/ 0, FoundDecl);
+    S.CheckMemberOperatorAccess(CastLoc, From, /*arg*/ nullptr, FoundDecl);
 
 
     return S.MaybeBindToTemporary(Result.get());
     return S.MaybeBindToTemporary(Result.get());
   }
   }
@@ -2762,13 +2764,13 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
   case ICK_Array_To_Pointer:
   case ICK_Array_To_Pointer:
     FromType = Context.getArrayDecayedType(FromType);
     FromType = Context.getArrayDecayedType(FromType);
     From = ImpCastExprToType(From, FromType, CK_ArrayToPointerDecay, 
     From = ImpCastExprToType(From, FromType, CK_ArrayToPointerDecay, 
-                             VK_RValue, /*BasePath=*/0, CCK).take();
+                             VK_RValue, /*BasePath=*/nullptr, CCK).take();
     break;
     break;
 
 
   case ICK_Function_To_Pointer:
   case ICK_Function_To_Pointer:
     FromType = Context.getPointerType(FromType);
     FromType = Context.getPointerType(FromType);
     From = ImpCastExprToType(From, FromType, CK_FunctionToPointerDecay, 
     From = ImpCastExprToType(From, FromType, CK_FunctionToPointerDecay, 
-                             VK_RValue, /*BasePath=*/0, CCK).take();
+                             VK_RValue, /*BasePath=*/nullptr, CCK).take();
     break;
     break;
 
 
   default:
   default:
@@ -2792,7 +2794,7 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
       return ExprError();
       return ExprError();
 
 
     From = ImpCastExprToType(From, ToType, CK_NoOp, 
     From = ImpCastExprToType(From, ToType, CK_NoOp, 
-                             VK_RValue, /*BasePath=*/0, CCK).take();
+                             VK_RValue, /*BasePath=*/nullptr, CCK).take();
     break;
     break;
 
 
   case ICK_Integral_Promotion:
   case ICK_Integral_Promotion:
@@ -2802,17 +2804,17 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
              SCS.Second == ICK_Integral_Promotion &&
              SCS.Second == ICK_Integral_Promotion &&
              "only enums with fixed underlying type can promote to bool");
              "only enums with fixed underlying type can promote to bool");
       From = ImpCastExprToType(From, ToType, CK_IntegralToBoolean,
       From = ImpCastExprToType(From, ToType, CK_IntegralToBoolean,
-                               VK_RValue, /*BasePath=*/0, CCK).take();
+                               VK_RValue, /*BasePath=*/nullptr, CCK).take();
     } else {
     } else {
       From = ImpCastExprToType(From, ToType, CK_IntegralCast,
       From = ImpCastExprToType(From, ToType, CK_IntegralCast,
-                               VK_RValue, /*BasePath=*/0, CCK).take();
+                               VK_RValue, /*BasePath=*/nullptr, CCK).take();
     }
     }
     break;
     break;
 
 
   case ICK_Floating_Promotion:
   case ICK_Floating_Promotion:
   case ICK_Floating_Conversion:
   case ICK_Floating_Conversion:
     From = ImpCastExprToType(From, ToType, CK_FloatingCast, 
     From = ImpCastExprToType(From, ToType, CK_FloatingCast, 
-                             VK_RValue, /*BasePath=*/0, CCK).take();
+                             VK_RValue, /*BasePath=*/nullptr, CCK).take();
     break;
     break;
 
 
   case ICK_Complex_Promotion:
   case ICK_Complex_Promotion:
@@ -2831,22 +2833,22 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
       CK = CK_IntegralComplexCast;
       CK = CK_IntegralComplexCast;
     }
     }
     From = ImpCastExprToType(From, ToType, CK, 
     From = ImpCastExprToType(From, ToType, CK, 
-                             VK_RValue, /*BasePath=*/0, CCK).take();
+                             VK_RValue, /*BasePath=*/nullptr, CCK).take();
     break;
     break;
   }
   }
 
 
   case ICK_Floating_Integral:
   case ICK_Floating_Integral:
     if (ToType->isRealFloatingType())
     if (ToType->isRealFloatingType())
       From = ImpCastExprToType(From, ToType, CK_IntegralToFloating, 
       From = ImpCastExprToType(From, ToType, CK_IntegralToFloating, 
-                               VK_RValue, /*BasePath=*/0, CCK).take();
+                               VK_RValue, /*BasePath=*/nullptr, CCK).take();
     else
     else
       From = ImpCastExprToType(From, ToType, CK_FloatingToIntegral, 
       From = ImpCastExprToType(From, ToType, CK_FloatingToIntegral, 
-                               VK_RValue, /*BasePath=*/0, CCK).take();
+                               VK_RValue, /*BasePath=*/nullptr, CCK).take();
     break;
     break;
 
 
   case ICK_Compatible_Conversion:
   case ICK_Compatible_Conversion:
       From = ImpCastExprToType(From, ToType, CK_NoOp, 
       From = ImpCastExprToType(From, ToType, CK_NoOp, 
-                               VK_RValue, /*BasePath=*/0, CCK).take();
+                               VK_RValue, /*BasePath=*/nullptr, CCK).take();
     break;
     break;
 
 
   case ICK_Writeback_Conversion:
   case ICK_Writeback_Conversion:
@@ -2921,7 +2923,7 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
 
 
     From = ImpCastExprToType(From, Context.BoolTy,
     From = ImpCastExprToType(From, Context.BoolTy,
                              ScalarTypeToBooleanCastKind(FromType), 
                              ScalarTypeToBooleanCastKind(FromType), 
-                             VK_RValue, /*BasePath=*/0, CCK).take();
+                             VK_RValue, /*BasePath=*/nullptr, CCK).take();
     break;
     break;
 
 
   case ICK_Derived_To_Base: {
   case ICK_Derived_To_Base: {
@@ -2942,12 +2944,12 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
 
 
   case ICK_Vector_Conversion:
   case ICK_Vector_Conversion:
     From = ImpCastExprToType(From, ToType, CK_BitCast, 
     From = ImpCastExprToType(From, ToType, CK_BitCast, 
-                             VK_RValue, /*BasePath=*/0, CCK).take();
+                             VK_RValue, /*BasePath=*/nullptr, CCK).take();
     break;
     break;
 
 
   case ICK_Vector_Splat:
   case ICK_Vector_Splat:
     From = ImpCastExprToType(From, ToType, CK_VectorSplat, 
     From = ImpCastExprToType(From, ToType, CK_VectorSplat, 
-                             VK_RValue, /*BasePath=*/0, CCK).take();
+                             VK_RValue, /*BasePath=*/nullptr, CCK).take();
     break;
     break;
 
 
   case ICK_Complex_Real:
   case ICK_Complex_Real:
@@ -2984,7 +2986,7 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
       From = ImpCastExprToType(From, ElType,
       From = ImpCastExprToType(From, ElType,
                    isFloatingComplex ? CK_FloatingComplexToReal
                    isFloatingComplex ? CK_FloatingComplexToReal
                                      : CK_IntegralComplexToReal, 
                                      : CK_IntegralComplexToReal, 
-                               VK_RValue, /*BasePath=*/0, CCK).take();
+                               VK_RValue, /*BasePath=*/nullptr, CCK).take();
 
 
       // x -> y
       // x -> y
       if (Context.hasSameUnqualifiedType(ElType, ToType)) {
       if (Context.hasSameUnqualifiedType(ElType, ToType)) {
@@ -2992,19 +2994,19 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
       } else if (ToType->isRealFloatingType()) {
       } else if (ToType->isRealFloatingType()) {
         From = ImpCastExprToType(From, ToType,
         From = ImpCastExprToType(From, ToType,
                    isFloatingComplex ? CK_FloatingCast : CK_IntegralToFloating, 
                    isFloatingComplex ? CK_FloatingCast : CK_IntegralToFloating, 
-                                 VK_RValue, /*BasePath=*/0, CCK).take();
+                                 VK_RValue, /*BasePath=*/nullptr, CCK).take();
       } else {
       } else {
         assert(ToType->isIntegerType());
         assert(ToType->isIntegerType());
         From = ImpCastExprToType(From, ToType,
         From = ImpCastExprToType(From, ToType,
                    isFloatingComplex ? CK_FloatingToIntegral : CK_IntegralCast, 
                    isFloatingComplex ? CK_FloatingToIntegral : CK_IntegralCast, 
-                                 VK_RValue, /*BasePath=*/0, CCK).take();
+                                 VK_RValue, /*BasePath=*/nullptr, CCK).take();
       }
       }
     }
     }
     break;
     break;
   
   
   case ICK_Block_Pointer_Conversion: {
   case ICK_Block_Pointer_Conversion: {
     From = ImpCastExprToType(From, ToType.getUnqualifiedType(), CK_BitCast,
     From = ImpCastExprToType(From, ToType.getUnqualifiedType(), CK_BitCast,
-                             VK_RValue, /*BasePath=*/0, CCK).take();
+                             VK_RValue, /*BasePath=*/nullptr, CCK).take();
     break;
     break;
   }
   }
       
       
@@ -3046,7 +3048,7 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
     ExprValueKind VK = ToType->isReferenceType() ?
     ExprValueKind VK = ToType->isReferenceType() ?
                                   From->getValueKind() : VK_RValue;
                                   From->getValueKind() : VK_RValue;
     From = ImpCastExprToType(From, ToType.getNonLValueExprType(Context),
     From = ImpCastExprToType(From, ToType.getNonLValueExprType(Context),
-                             CK_NoOp, VK, /*BasePath=*/0, CCK).take();
+                             CK_NoOp, VK, /*BasePath=*/nullptr, CCK).take();
 
 
     if (SCS.DeprecatedStringLiteralToCharPtr &&
     if (SCS.DeprecatedStringLiteralToCharPtr &&
         !getLangOpts().WritableStrings) {
         !getLangOpts().WritableStrings) {
@@ -3069,7 +3071,7 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType,
     assert(Context.hasSameType(
     assert(Context.hasSameType(
         ToAtomicType->castAs<AtomicType>()->getValueType(), From->getType()));
         ToAtomicType->castAs<AtomicType>()->getValueType(), From->getType()));
     From = ImpCastExprToType(From, ToAtomicType, CK_NonAtomicToAtomic,
     From = ImpCastExprToType(From, ToAtomicType, CK_NonAtomicToAtomic,
-                             VK_RValue, 0, CCK).take();
+                             VK_RValue, nullptr, CCK).take();
   }
   }
 
 
   return Owned(From);
   return Owned(From);
@@ -3889,7 +3891,8 @@ static bool EvaluateBinaryTypeTrait(Sema &Self, TypeTrait BTT, QualType LhsT,
     EnterExpressionEvaluationContext Unevaluated(Self, Sema::Unevaluated);
     EnterExpressionEvaluationContext Unevaluated(Self, Sema::Unevaluated);
     Sema::SFINAETrap SFINAE(Self, /*AccessCheckingSFINAE=*/true);
     Sema::SFINAETrap SFINAE(Self, /*AccessCheckingSFINAE=*/true);
     Sema::ContextRAII TUContext(Self, Self.Context.getTranslationUnitDecl());
     Sema::ContextRAII TUContext(Self, Self.Context.getTranslationUnitDecl());
-    ExprResult Result = Self.BuildBinOp(/*S=*/0, KeyLoc, BO_Assign, &Lhs, &Rhs);
+    ExprResult Result = Self.BuildBinOp(/*S=*/nullptr, KeyLoc, BO_Assign, &Lhs,
+                                        &Rhs);
     if (Result.isInvalid() || SFINAE.hasErrorOccurred())
     if (Result.isInvalid() || SFINAE.hasErrorOccurred())
       return false;
       return false;
 
 
@@ -4577,7 +4580,8 @@ QualType Sema::CXXCheckConditionalOperands(ExprResult &Cond, ExprResult &LHS,
   //      operand. The result is of the common type.
   //      operand. The result is of the common type.
   bool NonStandardCompositeType = false;
   bool NonStandardCompositeType = false;
   QualType Composite = FindCompositePointerType(QuestionLoc, LHS, RHS,
   QualType Composite = FindCompositePointerType(QuestionLoc, LHS, RHS,
-                              isSFINAEContext()? 0 : &NonStandardCompositeType);
+                                 isSFINAEContext() ? nullptr
+                                                   : &NonStandardCompositeType);
   if (!Composite.isNull()) {
   if (!Composite.isNull()) {
     if (NonStandardCompositeType)
     if (NonStandardCompositeType)
       Diag(QuestionLoc,
       Diag(QuestionLoc,
@@ -4701,7 +4705,7 @@ QualType Sema::FindCompositePointerType(SourceLocation Loc,
 
 
       QualifierUnion.push_back(
       QualifierUnion.push_back(
                  Composite1.getCVRQualifiers() | Composite2.getCVRQualifiers());
                  Composite1.getCVRQualifiers() | Composite2.getCVRQualifiers());
-      MemberOfClass.push_back(std::make_pair((const Type *)0, (const Type *)0));
+      MemberOfClass.push_back(std::make_pair(nullptr, nullptr));
       continue;
       continue;
     }
     }
 
 
@@ -4890,7 +4894,7 @@ ExprResult Sema::MaybeBindToTemporary(Expr *E) {
     // actual method.  FIXME: we should infer retention by selector in
     // actual method.  FIXME: we should infer retention by selector in
     // cases where we don't have an actual method.
     // cases where we don't have an actual method.
     } else {
     } else {
-      ObjCMethodDecl *D = 0;
+      ObjCMethodDecl *D = nullptr;
       if (ObjCMessageExpr *Send = dyn_cast<ObjCMessageExpr>(E)) {
       if (ObjCMessageExpr *Send = dyn_cast<ObjCMessageExpr>(E)) {
         D = Send->getMethodDecl();
         D = Send->getMethodDecl();
       } else if (ObjCBoxedExpr *BoxedExpr = dyn_cast<ObjCBoxedExpr>(E)) {
       } else if (ObjCBoxedExpr *BoxedExpr = dyn_cast<ObjCBoxedExpr>(E)) {
@@ -4920,7 +4924,7 @@ ExprResult Sema::MaybeBindToTemporary(Expr *E) {
 
 
     CastKind ck = (ReturnsRetained ? CK_ARCConsumeObject
     CastKind ck = (ReturnsRetained ? CK_ARCConsumeObject
                                    : CK_ARCReclaimReturnedObject);
                                    : CK_ARCReclaimReturnedObject);
-    return Owned(ImplicitCastExpr::Create(Context, E->getType(), ck, E, 0,
+    return Owned(ImplicitCastExpr::Create(Context, E->getType(), ck, E, nullptr,
                                           VK_RValue));
                                           VK_RValue));
   }
   }
 
 
@@ -4930,7 +4934,7 @@ ExprResult Sema::MaybeBindToTemporary(Expr *E) {
   // Search for the base element type (cf. ASTContext::getBaseElementType) with
   // Search for the base element type (cf. ASTContext::getBaseElementType) with
   // a fast path for the common case that the type is directly a RecordType.
   // a fast path for the common case that the type is directly a RecordType.
   const Type *T = Context.getCanonicalType(E->getType().getTypePtr());
   const Type *T = Context.getCanonicalType(E->getType().getTypePtr());
-  const RecordType *RT = 0;
+  const RecordType *RT = nullptr;
   while (!RT) {
   while (!RT) {
     switch (T->getTypeClass()) {
     switch (T->getTypeClass()) {
     case Type::Record:
     case Type::Record:
@@ -4954,7 +4958,7 @@ ExprResult Sema::MaybeBindToTemporary(Expr *E) {
     return Owned(E);
     return Owned(E);
 
 
   bool IsDecltype = ExprEvalContexts.back().IsDecltype;
   bool IsDecltype = ExprEvalContexts.back().IsDecltype;
-  CXXDestructorDecl *Destructor = IsDecltype ? 0 : LookupDestructor(RD);
+  CXXDestructorDecl *Destructor = IsDecltype ? nullptr : LookupDestructor(RD);
 
 
   if (Destructor) {
   if (Destructor) {
     MarkFunctionReferenced(E->getExprLoc(), Destructor);
     MarkFunctionReferenced(E->getExprLoc(), Destructor);
@@ -5072,11 +5076,12 @@ ExprResult Sema::ActOnDecltypeExpression(Expr *E) {
   }
   }
 
 
   CXXBindTemporaryExpr *TopBind = dyn_cast<CXXBindTemporaryExpr>(E);
   CXXBindTemporaryExpr *TopBind = dyn_cast<CXXBindTemporaryExpr>(E);
-  CallExpr *TopCall = TopBind ? dyn_cast<CallExpr>(TopBind->getSubExpr()) : 0;
+  CallExpr *TopCall = TopBind ? dyn_cast<CallExpr>(TopBind->getSubExpr())
+                              : nullptr;
   if (TopCall)
   if (TopCall)
     E = TopCall;
     E = TopCall;
   else
   else
-    TopBind = 0;
+    TopBind = nullptr;
 
 
   // Disable the special decltype handling now.
   // Disable the special decltype handling now.
   ExprEvalContexts.back().IsDecltype = false;
   ExprEvalContexts.back().IsDecltype = false;
@@ -5214,7 +5219,7 @@ Sema::ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc,
           // separate note) instead of having the error reported back to here
           // separate note) instead of having the error reported back to here
           // and giving a diagnostic with a fixit attached to the error itself.
           // and giving a diagnostic with a fixit attached to the error itself.
           (FirstIteration && CurFD && CurFD->isFunctionTemplateSpecialization())
           (FirstIteration && CurFD && CurFD->isFunctionTemplateSpecialization())
-              ? 0
+              ? nullptr
               : &NoArrowOperatorFound);
               : &NoArrowOperatorFound);
       if (Result.isInvalid()) {
       if (Result.isInvalid()) {
         if (NoArrowOperatorFound) {
         if (NoArrowOperatorFound) {
@@ -5228,7 +5233,7 @@ Sema::ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc,
           Diag(OpLoc, diag::err_typecheck_member_reference_arrow)
           Diag(OpLoc, diag::err_typecheck_member_reference_arrow)
             << BaseType << Base->getSourceRange();
             << BaseType << Base->getSourceRange();
           CallExpr *CE = dyn_cast<CallExpr>(Base);
           CallExpr *CE = dyn_cast<CallExpr>(Base);
-          if (Decl *CD = (CE ? CE->getCalleeDecl() : 0)) {
+          if (Decl *CD = (CE ? CE->getCalleeDecl() : nullptr)) {
             Diag(CD->getLocStart(),
             Diag(CD->getLocStart(),
                  diag::note_member_reference_arrow_from_operator_arrow);
                  diag::note_member_reference_arrow_from_operator_arrow);
           }
           }
@@ -5300,7 +5305,7 @@ ExprResult Sema::DiagnoseDtorReference(SourceLocation NameLoc,
     << isa<CXXPseudoDestructorExpr>(MemExpr)
     << isa<CXXPseudoDestructorExpr>(MemExpr)
     << FixItHint::CreateInsertion(ExpectedLParenLoc, "()");
     << FixItHint::CreateInsertion(ExpectedLParenLoc, "()");
 
 
-  return ActOnCallExpr(/*Scope*/ 0,
+  return ActOnCallExpr(/*Scope*/ nullptr,
                        MemExpr,
                        MemExpr,
                        /*LPLoc*/ ExpectedLParenLoc,
                        /*LPLoc*/ ExpectedLParenLoc,
                        None,
                        None,
@@ -5423,7 +5428,7 @@ ExprResult Sema::BuildPseudoDestructorExpr(Expr *Base,
         << ScopeTypeInfo->getTypeLoc().getLocalSourceRange();
         << ScopeTypeInfo->getTypeLoc().getLocalSourceRange();
 
 
       ScopeType = QualType();
       ScopeType = QualType();
-      ScopeTypeInfo = 0;
+      ScopeTypeInfo = nullptr;
     }
     }
   }
   }
 
 
@@ -5475,7 +5480,7 @@ ExprResult Sema::ActOnPseudoDestructorExpr(Scope *S, Expr *Base,
   // Convert the name of the type being destructed (following the ~) into a
   // Convert the name of the type being destructed (following the ~) into a
   // type (with source-location information).
   // type (with source-location information).
   QualType DestructedType;
   QualType DestructedType;
-  TypeSourceInfo *DestructedTypeInfo = 0;
+  TypeSourceInfo *DestructedTypeInfo = nullptr;
   PseudoDestructorTypeStorage Destructed;
   PseudoDestructorTypeStorage Destructed;
   if (SecondTypeName.getKind() == UnqualifiedId::IK_Identifier) {
   if (SecondTypeName.getKind() == UnqualifiedId::IK_Identifier) {
     ParsedType T = getTypeName(*SecondTypeName.Identifier,
     ParsedType T = getTypeName(*SecondTypeName.Identifier,
@@ -5530,7 +5535,7 @@ ExprResult Sema::ActOnPseudoDestructorExpr(Scope *S, Expr *Base,
   }
   }
 
 
   // Convert the name of the scope type (the type prior to '::') into a type.
   // Convert the name of the scope type (the type prior to '::') into a type.
-  TypeSourceInfo *ScopeTypeInfo = 0;
+  TypeSourceInfo *ScopeTypeInfo = nullptr;
   QualType ScopeType;
   QualType ScopeType;
   if (FirstTypeName.getKind() == UnqualifiedId::IK_TemplateId ||
   if (FirstTypeName.getKind() == UnqualifiedId::IK_TemplateId ||
       FirstTypeName.Identifier) {
       FirstTypeName.Identifier) {
@@ -5599,7 +5604,7 @@ ExprResult Sema::ActOnPseudoDestructorExpr(Scope *S, Expr *Base,
   PseudoDestructorTypeStorage Destructed(DestructedTypeInfo);
   PseudoDestructorTypeStorage Destructed(DestructedTypeInfo);
 
 
   return BuildPseudoDestructorExpr(Base, OpLoc, OpKind, CXXScopeSpec(),
   return BuildPseudoDestructorExpr(Base, OpLoc, OpKind, CXXScopeSpec(),
-                                   0, SourceLocation(), TildeLoc,
+                                   nullptr, SourceLocation(), TildeLoc,
                                    Destructed, HasTrailingLParen);
                                    Destructed, HasTrailingLParen);
 }
 }
 
 
@@ -5632,9 +5637,8 @@ ExprResult Sema::BuildCXXMemberCallExpr(Expr *E, NamedDecl *FoundDecl,
       return Exp;
       return Exp;
     }
     }
   }
   }
-      
 
 
-  ExprResult Exp = PerformObjectArgumentInitialization(E, /*Qualifier=*/0,
+  ExprResult Exp = PerformObjectArgumentInitialization(E, /*Qualifier=*/nullptr,
                                           FoundDecl, Method);
                                           FoundDecl, Method);
   if (Exp.isInvalid())
   if (Exp.isInvalid())
     return true;
     return true;
@@ -5799,7 +5803,7 @@ ExprResult Sema::IgnoredValueConversions(Expr *E) {
 static inline bool VariableCanNeverBeAConstantExpression(VarDecl *Var, 
 static inline bool VariableCanNeverBeAConstantExpression(VarDecl *Var, 
     ASTContext &Context) {
     ASTContext &Context) {
   if (isa<ParmVarDecl>(Var)) return true;
   if (isa<ParmVarDecl>(Var)) return true;
-  const VarDecl *DefVD = 0;
+  const VarDecl *DefVD = nullptr;
 
 
   // If there is no initializer - this can not be a constant expression.
   // If there is no initializer - this can not be a constant expression.
   if (!Var->getAnyInitializer(DefVD)) return true;
   if (!Var->getAnyInitializer(DefVD)) return true;
@@ -5845,8 +5849,8 @@ static void CheckIfAnyEnclosingLambdasMustCaptureAnyPotentialCaptures(
   const unsigned NumPotentialCaptures =
   const unsigned NumPotentialCaptures =
       CurrentLSI->getNumPotentialVariableCaptures();
       CurrentLSI->getNumPotentialVariableCaptures();
   for (unsigned I = 0; I != NumPotentialCaptures; ++I) {
   for (unsigned I = 0; I != NumPotentialCaptures; ++I) {
-    Expr *VarExpr = 0;
-    VarDecl *Var = 0;
+    Expr *VarExpr = nullptr;
+    VarDecl *Var = nullptr;
     CurrentLSI->getPotentialVariableCapture(I, Var, VarExpr);
     CurrentLSI->getPotentialVariableCapture(I, Var, VarExpr);
     // If the variable is clearly identified as non-odr-used and the full
     // If the variable is clearly identified as non-odr-used and the full
     // expression is not instantiation dependent, only then do we not 
     // expression is not instantiation dependent, only then do we not 
@@ -5886,13 +5890,13 @@ static void CheckIfAnyEnclosingLambdasMustCaptureAnyPotentialCaptures(
       if (S.tryCaptureVariable(Var, ExprLoc, S.TryCapture_Implicit,
       if (S.tryCaptureVariable(Var, ExprLoc, S.TryCapture_Implicit,
                           /*EllipsisLoc*/ SourceLocation(), 
                           /*EllipsisLoc*/ SourceLocation(), 
                           /*BuildAndDiagnose*/false, CaptureType, 
                           /*BuildAndDiagnose*/false, CaptureType, 
-                          DeclRefType, 0)) {
+                          DeclRefType, nullptr)) {
         // We will never be able to capture this variable, and we need
         // We will never be able to capture this variable, and we need
         // to be able to in any and all instantiations, so diagnose it.
         // to be able to in any and all instantiations, so diagnose it.
         S.tryCaptureVariable(Var, ExprLoc, S.TryCapture_Implicit,
         S.tryCaptureVariable(Var, ExprLoc, S.TryCapture_Implicit,
                           /*EllipsisLoc*/ SourceLocation(), 
                           /*EllipsisLoc*/ SourceLocation(), 
                           /*BuildAndDiagnose*/true, CaptureType, 
                           /*BuildAndDiagnose*/true, CaptureType, 
-                          DeclRefType, 0);
+                          DeclRefType, nullptr);
       }
       }
     }
     }
   }
   }
@@ -5903,7 +5907,7 @@ static void CheckIfAnyEnclosingLambdasMustCaptureAnyPotentialCaptures(
     // 'this' in that lambda (and all its enclosing lambdas).
     // 'this' in that lambda (and all its enclosing lambdas).
     if (const Optional<unsigned> Index =
     if (const Optional<unsigned> Index =
             getStackIndexOfNearestEnclosingCaptureCapableLambda(
             getStackIndexOfNearestEnclosingCaptureCapableLambda(
-                FunctionScopesArrayRef, /*0 is 'this'*/ 0, S)) {
+                FunctionScopesArrayRef, /*0 is 'this'*/ nullptr, S)) {
       const unsigned FunctionScopeIndexOfCapturableLambda = Index.getValue();
       const unsigned FunctionScopeIndexOfCapturableLambda = Index.getValue();
       S.CheckCXXThisCapture(CurrentLSI->PotentialThisCaptureLocation,
       S.CheckCXXThisCapture(CurrentLSI->PotentialThisCaptureLocation,
                             /*Explicit*/ false, /*BuildAndDiagnose*/ true,
                             /*Explicit*/ false, /*BuildAndDiagnose*/ true,

+ 31 - 33
lib/Sema/SemaExprMember.cpp

@@ -206,7 +206,7 @@ static void diagnoseInstanceReference(Sema &SemaRef,
 
 
   DeclContext *FunctionLevelDC = SemaRef.getFunctionLevelDeclContext();
   DeclContext *FunctionLevelDC = SemaRef.getFunctionLevelDeclContext();
   CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(FunctionLevelDC);
   CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(FunctionLevelDC);
-  CXXRecordDecl *ContextClass = Method ? Method->getParent() : 0;
+  CXXRecordDecl *ContextClass = Method ? Method->getParent() : nullptr;
   CXXRecordDecl *RepClass = dyn_cast<CXXRecordDecl>(Rep->getDeclContext());
   CXXRecordDecl *RepClass = dyn_cast<CXXRecordDecl>(Rep->getDeclContext());
 
 
   bool InStaticMethod = Method && Method->isStatic();
   bool InStaticMethod = Method && Method->isStatic();
@@ -389,7 +389,7 @@ static Decl *FindGetterSetterNameDeclFromProtocolList(const ObjCProtocolDecl*PDe
                                                            Context))
                                                            Context))
       return D;
       return D;
   }
   }
-  return 0;
+  return nullptr;
 }
 }
 
 
 static Decl *FindGetterSetterNameDecl(const ObjCObjectPointerType *QIdTy,
 static Decl *FindGetterSetterNameDecl(const ObjCObjectPointerType *QIdTy,
@@ -397,7 +397,7 @@ static Decl *FindGetterSetterNameDecl(const ObjCObjectPointerType *QIdTy,
                                       const Selector &Sel,
                                       const Selector &Sel,
                                       ASTContext &Context) {
                                       ASTContext &Context) {
   // Check protocols on qualified interfaces.
   // Check protocols on qualified interfaces.
-  Decl *GDecl = 0;
+  Decl *GDecl = nullptr;
   for (const auto *I : QIdTy->quals()) {
   for (const auto *I : QIdTy->quals()) {
     if (Member)
     if (Member)
       if (ObjCPropertyDecl *PD = I->FindPropertyDeclaration(Member)) {
       if (ObjCPropertyDecl *PD = I->FindPropertyDeclaration(Member)) {
@@ -590,7 +590,7 @@ LookupMemberExprInRecord(Sema &SemaRef, LookupResult &R,
     QualType ObjectType = SS.isSet() ? QualType() : QualType(RTy, 0);
     QualType ObjectType = SS.isSet() ? QualType() : QualType(RTy, 0);
 
 
     bool MOUS;
     bool MOUS;
-    SemaRef.LookupTemplateName(R, 0, SS, ObjectType, false, MOUS);
+    SemaRef.LookupTemplateName(R, nullptr, SS, ObjectType, false, MOUS);
     return false;
     return false;
   }
   }
 
 
@@ -626,7 +626,7 @@ LookupMemberExprInRecord(Sema &SemaRef, LookupResult &R,
   DeclarationName Name = R.getLookupName();
   DeclarationName Name = R.getLookupName();
   RecordMemberExprValidatorCCC Validator(RTy);
   RecordMemberExprValidatorCCC Validator(RTy);
   TypoCorrection Corrected = SemaRef.CorrectTypo(R.getLookupNameInfo(),
   TypoCorrection Corrected = SemaRef.CorrectTypo(R.getLookupNameInfo(),
-                                                 R.getLookupKind(), NULL,
+                                                 R.getLookupKind(), nullptr,
                                                  &SS, Validator,
                                                  &SS, Validator,
                                                  Sema::CTK_ErrorRecovery, DC);
                                                  Sema::CTK_ErrorRecovery, DC);
   R.clear();
   R.clear();
@@ -643,7 +643,7 @@ LookupMemberExprInRecord(Sema &SemaRef, LookupResult &R,
     // information to do overload resolution, so we don't know which previous
     // information to do overload resolution, so we don't know which previous
     // declaration to point to.
     // declaration to point to.
     if (Corrected.isOverloaded())
     if (Corrected.isOverloaded())
-      Corrected.setCorrectionDecl(0);
+      Corrected.setCorrectionDecl(nullptr);
     bool DroppedSpecifier =
     bool DroppedSpecifier =
         Corrected.WillReplaceSpecifier() &&
         Corrected.WillReplaceSpecifier() &&
         Name.getAsString() == Corrected.getAsString(SemaRef.getLangOpts());
         Name.getAsString() == Corrected.getAsString(SemaRef.getLangOpts());
@@ -678,7 +678,7 @@ Sema::BuildMemberReferenceExpr(Expr *Base, QualType BaseType,
     if (IsArrow) RecordTy = RecordTy->getAs<PointerType>()->getPointeeType();
     if (IsArrow) RecordTy = RecordTy->getAs<PointerType>()->getPointeeType();
     if (LookupMemberExprInRecord(*this, R, SourceRange(),
     if (LookupMemberExprInRecord(*this, R, SourceRange(),
                                  RecordTy->getAs<RecordType>(),
                                  RecordTy->getAs<RecordType>(),
-                                 OpLoc, SS, TemplateArgs != 0))
+                                 OpLoc, SS, TemplateArgs != nullptr))
       return ExprError();
       return ExprError();
 
 
   // Explicit member accesses.
   // Explicit member accesses.
@@ -686,7 +686,7 @@ Sema::BuildMemberReferenceExpr(Expr *Base, QualType BaseType,
     ExprResult BaseResult = Owned(Base);
     ExprResult BaseResult = Owned(Base);
     ExprResult Result =
     ExprResult Result =
       LookupMemberExpr(R, BaseResult, IsArrow, OpLoc,
       LookupMemberExpr(R, BaseResult, IsArrow, OpLoc,
-                       SS, /*ObjCImpDecl*/ 0, TemplateArgs != 0);
+                       SS, /*ObjCImpDecl*/ nullptr, TemplateArgs != nullptr);
 
 
     if (BaseResult.isInvalid())
     if (BaseResult.isInvalid())
       return ExprError();
       return ExprError();
@@ -842,16 +842,13 @@ BuildMSPropertyRefExpr(Sema &S, Expr *BaseExpr, bool IsArrow,
 }
 }
 
 
 /// \brief Build a MemberExpr AST node.
 /// \brief Build a MemberExpr AST node.
-static MemberExpr *BuildMemberExpr(Sema &SemaRef,
-                                   ASTContext &C, Expr *Base, bool isArrow,
-                                   const CXXScopeSpec &SS,
-                                   SourceLocation TemplateKWLoc,
-                                   ValueDecl *Member,
-                                   DeclAccessPair FoundDecl,
-                                   const DeclarationNameInfo &MemberNameInfo,
-                                   QualType Ty,
-                                   ExprValueKind VK, ExprObjectKind OK,
-                                   const TemplateArgumentListInfo *TemplateArgs = 0) {
+static MemberExpr *
+BuildMemberExpr(Sema &SemaRef, ASTContext &C, Expr *Base, bool isArrow,
+                const CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
+                ValueDecl *Member, DeclAccessPair FoundDecl,
+                const DeclarationNameInfo &MemberNameInfo, QualType Ty,
+                ExprValueKind VK, ExprObjectKind OK,
+                const TemplateArgumentListInfo *TemplateArgs = nullptr) {
   assert((!isArrow || Base->isRValue()) && "-> base must be a pointer rvalue");
   assert((!isArrow || Base->isRValue()) && "-> base must be a pointer rvalue");
   MemberExpr *E =
   MemberExpr *E =
       MemberExpr::Create(C, Base, isArrow, SS.getWithLocInContext(C),
       MemberExpr::Create(C, Base, isArrow, SS.getWithLocInContext(C),
@@ -1222,7 +1219,7 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,
 
 
     // Returning valid-but-null is how we indicate to the caller that
     // Returning valid-but-null is how we indicate to the caller that
     // the lookup result was filled in.
     // the lookup result was filled in.
-    return Owned((Expr*) 0);
+    return Owned((Expr*) nullptr);
   }
   }
 
 
   // Handle ivar access to Objective-C objects.
   // Handle ivar access to Objective-C objects.
@@ -1261,8 +1258,8 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,
     if (RequireCompleteType(OpLoc, BaseType, diag::err_typecheck_incomplete_tag,
     if (RequireCompleteType(OpLoc, BaseType, diag::err_typecheck_incomplete_tag,
                             BaseExpr.get()))
                             BaseExpr.get()))
       return ExprError();
       return ExprError();
-    
-    ObjCInterfaceDecl *ClassDeclared = 0;
+
+    ObjCInterfaceDecl *ClassDeclared = nullptr;
     ObjCIvarDecl *IV = IDecl->lookupInstanceVariable(Member, ClassDeclared);
     ObjCIvarDecl *IV = IDecl->lookupInstanceVariable(Member, ClassDeclared);
 
 
     if (!IV) {
     if (!IV) {
@@ -1270,9 +1267,9 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,
       DeclFilterCCC<ObjCIvarDecl> Validator;
       DeclFilterCCC<ObjCIvarDecl> Validator;
       Validator.IsObjCIvarLookup = IsArrow;
       Validator.IsObjCIvarLookup = IsArrow;
       if (TypoCorrection Corrected = CorrectTypo(R.getLookupNameInfo(),
       if (TypoCorrection Corrected = CorrectTypo(R.getLookupNameInfo(),
-                                                 LookupMemberName, NULL, NULL,
-                                                 Validator, CTK_ErrorRecovery,
-                                                 IDecl)) {
+                                                 LookupMemberName, nullptr,
+                                                 nullptr, Validator,
+                                                 CTK_ErrorRecovery, IDecl)) {
         IV = Corrected.getCorrectionDeclAs<ObjCIvarDecl>();
         IV = Corrected.getCorrectionDeclAs<ObjCIvarDecl>();
         diagnoseTypo(Corrected,
         diagnoseTypo(Corrected,
                      PDiag(diag::err_typecheck_member_reference_ivar_suggest)
                      PDiag(diag::err_typecheck_member_reference_ivar_suggest)
@@ -1313,7 +1310,7 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,
       return ExprError();
       return ExprError();
     if (IV->getAccessControl() != ObjCIvarDecl::Public &&
     if (IV->getAccessControl() != ObjCIvarDecl::Public &&
         IV->getAccessControl() != ObjCIvarDecl::Package) {
         IV->getAccessControl() != ObjCIvarDecl::Package) {
-      ObjCInterfaceDecl *ClassOfMethodDecl = 0;
+      ObjCInterfaceDecl *ClassOfMethodDecl = nullptr;
       if (ObjCMethodDecl *MD = getCurMethodDecl())
       if (ObjCMethodDecl *MD = getCurMethodDecl())
         ClassOfMethodDecl =  MD->getClassInterface();
         ClassOfMethodDecl =  MD->getClassInterface();
       else if (ObjCImpDecl && getCurFunctionDecl()) {
       else if (ObjCImpDecl && getCurFunctionDecl()) {
@@ -1431,8 +1428,9 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr,
             SelectorTable::constructSetterSelector(PP.getIdentifierTable(),
             SelectorTable::constructSetterSelector(PP.getIdentifierTable(),
                                                    PP.getSelectorTable(),
                                                    PP.getSelectorTable(),
                                                    Member);
                                                    Member);
-          ObjCMethodDecl *SMD = 0;
-          if (Decl *SDecl = FindGetterSetterNameDecl(OPT, /*Property id*/0, 
+          ObjCMethodDecl *SMD = nullptr;
+          if (Decl *SDecl = FindGetterSetterNameDecl(OPT,
+                                                     /*Property id*/nullptr,
                                                      SetterSel, Context))
                                                      SetterSel, Context))
             SMD = dyn_cast<ObjCMethodDecl>(SDecl);
             SMD = dyn_cast<ObjCMethodDecl>(SDecl);
           
           
@@ -1622,7 +1620,7 @@ ExprResult Sema::ActOnMemberAccessExpr(Scope *S, Expr *Base,
   bool IsArrow = (OpKind == tok::arrow);
   bool IsArrow = (OpKind == tok::arrow);
 
 
   NamedDecl *FirstQualifierInScope
   NamedDecl *FirstQualifierInScope
-    = (!SS.isSet() ? 0 : FindFirstQualifierInScope(S, SS.getScopeRep()));
+    = (!SS.isSet() ? nullptr : FindFirstQualifierInScope(S, SS.getScopeRep()));
 
 
   // This is a postfix expression, so get rid of ParenListExprs.
   // This is a postfix expression, so get rid of ParenListExprs.
   ExprResult Result = MaybeConvertParenListExprToParenExpr(S, Base);
   ExprResult Result = MaybeConvertParenListExprToParenExpr(S, Base);
@@ -1639,7 +1637,7 @@ ExprResult Sema::ActOnMemberAccessExpr(Scope *S, Expr *Base,
     LookupResult R(*this, NameInfo, LookupMemberName);
     LookupResult R(*this, NameInfo, LookupMemberName);
     ExprResult BaseResult = Owned(Base);
     ExprResult BaseResult = Owned(Base);
     Result = LookupMemberExpr(R, BaseResult, IsArrow, OpLoc,
     Result = LookupMemberExpr(R, BaseResult, IsArrow, OpLoc,
-                              SS, ObjCImpDecl, TemplateArgs != 0);
+                              SS, ObjCImpDecl, TemplateArgs != nullptr);
     if (BaseResult.isInvalid())
     if (BaseResult.isInvalid())
       return ExprError();
       return ExprError();
     Base = BaseResult.take();
     Base = BaseResult.take();
@@ -1752,8 +1750,8 @@ Sema::BuildImplicitMemberExpr(const CXXScopeSpec &SS,
   // 'this' expression now.
   // 'this' expression now.
   QualType ThisTy = getCurrentThisType();
   QualType ThisTy = getCurrentThisType();
   assert(!ThisTy.isNull() && "didn't correctly pre-flight capture of 'this'");
   assert(!ThisTy.isNull() && "didn't correctly pre-flight capture of 'this'");
-  
-  Expr *baseExpr = 0; // null signifies implicit access
+
+  Expr *baseExpr = nullptr; // null signifies implicit access
   if (IsKnownInstance) {
   if (IsKnownInstance) {
     SourceLocation Loc = R.getNameLoc();
     SourceLocation Loc = R.getNameLoc();
     if (SS.getRange().isValid())
     if (SS.getRange().isValid())
@@ -1761,11 +1759,11 @@ Sema::BuildImplicitMemberExpr(const CXXScopeSpec &SS,
     CheckCXXThisCapture(Loc);
     CheckCXXThisCapture(Loc);
     baseExpr = new (Context) CXXThisExpr(loc, ThisTy, /*isImplicit=*/true);
     baseExpr = new (Context) CXXThisExpr(loc, ThisTy, /*isImplicit=*/true);
   }
   }
-  
+
   return BuildMemberReferenceExpr(baseExpr, ThisTy,
   return BuildMemberReferenceExpr(baseExpr, ThisTy,
                                   /*OpLoc*/ SourceLocation(),
                                   /*OpLoc*/ SourceLocation(),
                                   /*IsArrow*/ true,
                                   /*IsArrow*/ true,
                                   SS, TemplateKWLoc,
                                   SS, TemplateKWLoc,
-                                  /*FirstQualifierInScope*/ 0,
+                                  /*FirstQualifierInScope*/ nullptr,
                                   R, TemplateArgs);
                                   R, TemplateArgs);
 }
 }

+ 90 - 81
lib/Sema/SemaExprObjC.cpp

@@ -93,7 +93,7 @@ ExprResult Sema::BuildObjCStringLiteral(SourceLocation AtLoc, StringLiteral *S){
   if (!Ty.isNull()) {
   if (!Ty.isNull()) {
     Ty = Context.getObjCObjectPointerType(Ty);
     Ty = Context.getObjCObjectPointerType(Ty);
   } else if (getLangOpts().NoConstantCFStrings) {
   } else if (getLangOpts().NoConstantCFStrings) {
-    IdentifierInfo *NSIdent=0;
+    IdentifierInfo *NSIdent=nullptr;
     std::string StringClass(getLangOpts().ObjCConstantStringClass);
     std::string StringClass(getLangOpts().ObjCConstantStringClass);
     
     
     if (StringClass.empty())
     if (StringClass.empty())
@@ -133,7 +133,7 @@ ExprResult Sema::BuildObjCStringLiteral(SourceLocation AtLoc, StringLiteral *S){
           ObjCInterfaceDecl::Create (Context, 
           ObjCInterfaceDecl::Create (Context, 
                                      Context.getTranslationUnitDecl(), 
                                      Context.getTranslationUnitDecl(), 
                                      SourceLocation(), NSIdent, 
                                      SourceLocation(), NSIdent, 
-                                     0, SourceLocation());
+                                     nullptr, SourceLocation());
         Ty = Context.getObjCInterfaceType(NSStringIDecl);
         Ty = Context.getObjCInterfaceType(NSStringIDecl);
         Context.setObjCNSStringType(Ty);
         Context.setObjCNSStringType(Ty);
       }
       }
@@ -182,7 +182,7 @@ static ObjCMethodDecl *getNSNumberFactoryMethod(Sema &S, SourceLocation Loc,
       S.Diag(Loc, diag::err_invalid_nsnumber_type)
       S.Diag(Loc, diag::err_invalid_nsnumber_type)
         << NumberType << R;
         << NumberType << R;
     }
     }
-    return 0;
+    return nullptr;
   }
   }
   
   
   // If we already looked up this method, we're done.
   // If we already looked up this method, we're done.
@@ -208,15 +208,15 @@ static ObjCMethodDecl *getNSNumberFactoryMethod(Sema &S, SourceLocation Loc,
         S.NSNumberDecl = ObjCInterfaceDecl::Create(CX,
         S.NSNumberDecl = ObjCInterfaceDecl::Create(CX,
                                                    CX.getTranslationUnitDecl(),
                                                    CX.getTranslationUnitDecl(),
                                                    SourceLocation(), NSNumberId,
                                                    SourceLocation(), NSNumberId,
-                                                   0, SourceLocation());
+                                                   nullptr, SourceLocation());
       } else {
       } else {
         // Otherwise, require a declaration of NSNumber.
         // Otherwise, require a declaration of NSNumber.
         S.Diag(Loc, diag::err_undeclared_nsnumber);
         S.Diag(Loc, diag::err_undeclared_nsnumber);
-        return 0;
+        return nullptr;
       }
       }
     } else if (!S.NSNumberDecl->hasDefinition()) {
     } else if (!S.NSNumberDecl->hasDefinition()) {
       S.Diag(Loc, diag::err_undeclared_nsnumber);
       S.Diag(Loc, diag::err_undeclared_nsnumber);
-      return 0;
+      return nullptr;
     }
     }
     
     
     // generate the pointer to NSNumber type.
     // generate the pointer to NSNumber type.
@@ -228,7 +228,7 @@ static ObjCMethodDecl *getNSNumberFactoryMethod(Sema &S, SourceLocation Loc,
   ObjCMethodDecl *Method = S.NSNumberDecl->lookupClassMethod(Sel);
   ObjCMethodDecl *Method = S.NSNumberDecl->lookupClassMethod(Sel);
   if (!Method && S.getLangOpts().DebuggerObjCLiteral) {
   if (!Method && S.getLangOpts().DebuggerObjCLiteral) {
     // create a stub definition this NSNumber factory method.
     // create a stub definition this NSNumber factory method.
-    TypeSourceInfo *ReturnTInfo = 0;
+    TypeSourceInfo *ReturnTInfo = nullptr;
     Method =
     Method =
         ObjCMethodDecl::Create(CX, SourceLocation(), SourceLocation(), Sel,
         ObjCMethodDecl::Create(CX, SourceLocation(), SourceLocation(), Sel,
                                S.NSNumberPointer, ReturnTInfo, S.NSNumberDecl,
                                S.NSNumberPointer, ReturnTInfo, S.NSNumberDecl,
@@ -240,13 +240,13 @@ static ObjCMethodDecl *getNSNumberFactoryMethod(Sema &S, SourceLocation Loc,
     ParmVarDecl *value = ParmVarDecl::Create(S.Context, Method,
     ParmVarDecl *value = ParmVarDecl::Create(S.Context, Method,
                                              SourceLocation(), SourceLocation(),
                                              SourceLocation(), SourceLocation(),
                                              &CX.Idents.get("value"),
                                              &CX.Idents.get("value"),
-                                             NumberType, /*TInfo=*/0, SC_None,
-                                             0);
+                                             NumberType, /*TInfo=*/nullptr,
+                                             SC_None, nullptr);
     Method->setMethodParams(S.Context, value, None);
     Method->setMethodParams(S.Context, value, None);
   }
   }
 
 
   if (!validateBoxingMethod(S, Loc, S.NSNumberDecl, Sel, Method))
   if (!validateBoxingMethod(S, Loc, S.NSNumberDecl, Sel, Method))
-    return 0;
+    return nullptr;
 
 
   // Note: if the parameter type is out-of-line, we'll catch it later in the
   // Note: if the parameter type is out-of-line, we'll catch it later in the
   // implicit conversion.
   // implicit conversion.
@@ -444,10 +444,10 @@ static ExprResult CheckObjCCollectionLiteralElement(Sema &S, Expr *Element,
 ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
 ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
   if (ValueExpr->isTypeDependent()) {
   if (ValueExpr->isTypeDependent()) {
     ObjCBoxedExpr *BoxedExpr = 
     ObjCBoxedExpr *BoxedExpr = 
-      new (Context) ObjCBoxedExpr(ValueExpr, Context.DependentTy, NULL, SR);
+      new (Context) ObjCBoxedExpr(ValueExpr, Context.DependentTy, nullptr, SR);
     return Owned(BoxedExpr);
     return Owned(BoxedExpr);
   }
   }
-  ObjCMethodDecl *BoxingMethod = NULL;
+  ObjCMethodDecl *BoxingMethod = nullptr;
   QualType BoxedType;
   QualType BoxedType;
   // Convert the expression to an RValue, so we can check for pointer types...
   // Convert the expression to an RValue, so we can check for pointer types...
   ExprResult RValue = DefaultFunctionArrayLvalueConversion(ValueExpr);
   ExprResult RValue = DefaultFunctionArrayLvalueConversion(ValueExpr);
@@ -473,7 +473,7 @@ ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
             NSStringDecl = ObjCInterfaceDecl::Create(Context, TU,
             NSStringDecl = ObjCInterfaceDecl::Create(Context, TU,
                                                      SourceLocation(),
                                                      SourceLocation(),
                                                      NSStringId,
                                                      NSStringId,
-                                                     0, SourceLocation());
+                                                     nullptr, SourceLocation());
           } else {
           } else {
             Diag(SR.getBegin(), diag::err_undeclared_nsstring);
             Diag(SR.getBegin(), diag::err_undeclared_nsstring);
             return ExprError();
             return ExprError();
@@ -495,7 +495,7 @@ ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
         BoxingMethod = NSStringDecl->lookupClassMethod(stringWithUTF8String);
         BoxingMethod = NSStringDecl->lookupClassMethod(stringWithUTF8String);
         if (!BoxingMethod && getLangOpts().DebuggerObjCLiteral) {
         if (!BoxingMethod && getLangOpts().DebuggerObjCLiteral) {
           // Debugger needs to work even if NSString hasn't been defined.
           // Debugger needs to work even if NSString hasn't been defined.
-          TypeSourceInfo *ReturnTInfo = 0;
+          TypeSourceInfo *ReturnTInfo = nullptr;
           ObjCMethodDecl *M = ObjCMethodDecl::Create(
           ObjCMethodDecl *M = ObjCMethodDecl::Create(
               Context, SourceLocation(), SourceLocation(), stringWithUTF8String,
               Context, SourceLocation(), SourceLocation(), stringWithUTF8String,
               NSStringPointer, ReturnTInfo, NSStringDecl,
               NSStringPointer, ReturnTInfo, NSStringDecl,
@@ -510,8 +510,8 @@ ExprResult Sema::BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr) {
                                 SourceLocation(), SourceLocation(),
                                 SourceLocation(), SourceLocation(),
                                 &Context.Idents.get("value"),
                                 &Context.Idents.get("value"),
                                 Context.getPointerType(ConstCharType),
                                 Context.getPointerType(ConstCharType),
-                                /*TInfo=*/0,
-                                SC_None, 0);
+                                /*TInfo=*/nullptr,
+                                SC_None, nullptr);
           M->setMethodParams(Context, value, None);
           M->setMethodParams(Context, value, None);
           BoxingMethod = M;
           BoxingMethod = M;
         }
         }
@@ -646,7 +646,7 @@ ExprResult Sema::BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements) {
                             Context.getTranslationUnitDecl(),
                             Context.getTranslationUnitDecl(),
                             SourceLocation(),
                             SourceLocation(),
                             NSAPIObj->getNSClassId(NSAPI::ClassId_NSArray),
                             NSAPIObj->getNSClassId(NSAPI::ClassId_NSArray),
-                            0, SourceLocation());
+                            nullptr, SourceLocation());
 
 
     if (!NSArrayDecl) {
     if (!NSArrayDecl) {
       Diag(SR.getBegin(), diag::err_undeclared_nsarray);
       Diag(SR.getBegin(), diag::err_undeclared_nsarray);
@@ -661,7 +661,7 @@ ExprResult Sema::BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements) {
       Sel = NSAPIObj->getNSArraySelector(NSAPI::NSArr_arrayWithObjectsCount);
       Sel = NSAPIObj->getNSArraySelector(NSAPI::NSArr_arrayWithObjectsCount);
     ObjCMethodDecl *Method = NSArrayDecl->lookupClassMethod(Sel);
     ObjCMethodDecl *Method = NSArrayDecl->lookupClassMethod(Sel);
     if (!Method && getLangOpts().DebuggerObjCLiteral) {
     if (!Method && getLangOpts().DebuggerObjCLiteral) {
-      TypeSourceInfo *ReturnTInfo = 0;
+      TypeSourceInfo *ReturnTInfo = nullptr;
       Method = ObjCMethodDecl::Create(
       Method = ObjCMethodDecl::Create(
           Context, SourceLocation(), SourceLocation(), Sel, IdT, ReturnTInfo,
           Context, SourceLocation(), SourceLocation(), Sel, IdT, ReturnTInfo,
           Context.getTranslationUnitDecl(), false /*Instance*/,
           Context.getTranslationUnitDecl(), false /*Instance*/,
@@ -675,14 +675,16 @@ ExprResult Sema::BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements) {
                                                  SourceLocation(),
                                                  SourceLocation(),
                                                  &Context.Idents.get("objects"),
                                                  &Context.Idents.get("objects"),
                                                  Context.getPointerType(IdT),
                                                  Context.getPointerType(IdT),
-                                                 /*TInfo=*/0, SC_None, 0);
+                                                 /*TInfo=*/nullptr,
+                                                 SC_None, nullptr);
       Params.push_back(objects);
       Params.push_back(objects);
       ParmVarDecl *cnt = ParmVarDecl::Create(Context, Method,
       ParmVarDecl *cnt = ParmVarDecl::Create(Context, Method,
                                              SourceLocation(),
                                              SourceLocation(),
                                              SourceLocation(),
                                              SourceLocation(),
                                              &Context.Idents.get("cnt"),
                                              &Context.Idents.get("cnt"),
                                              Context.UnsignedLongTy,
                                              Context.UnsignedLongTy,
-                                             /*TInfo=*/0, SC_None, 0);
+                                             /*TInfo=*/nullptr, SC_None,
+                                             nullptr);
       Params.push_back(cnt);
       Params.push_back(cnt);
       Method->setMethodParams(Context, Params, None);
       Method->setMethodParams(Context, Params, None);
     }
     }
@@ -759,7 +761,7 @@ ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR,
                             Context.getTranslationUnitDecl(),
                             Context.getTranslationUnitDecl(),
                             SourceLocation(),
                             SourceLocation(),
                             NSAPIObj->getNSClassId(NSAPI::ClassId_NSDictionary),
                             NSAPIObj->getNSClassId(NSAPI::ClassId_NSDictionary),
-                            0, SourceLocation());
+                            nullptr, SourceLocation());
 
 
     if (!NSDictionaryDecl) {
     if (!NSDictionaryDecl) {
       Diag(SR.getBegin(), diag::err_undeclared_nsdictionary);
       Diag(SR.getBegin(), diag::err_undeclared_nsdictionary);
@@ -778,7 +780,7 @@ ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR,
       Method = ObjCMethodDecl::Create(Context,  
       Method = ObjCMethodDecl::Create(Context,  
                            SourceLocation(), SourceLocation(), Sel,
                            SourceLocation(), SourceLocation(), Sel,
                            IdT,
                            IdT,
-                           0 /*TypeSourceInfo */,
+                           nullptr /*TypeSourceInfo */,
                            Context.getTranslationUnitDecl(),
                            Context.getTranslationUnitDecl(),
                            false /*Instance*/, false/*isVariadic*/,
                            false /*Instance*/, false/*isVariadic*/,
                            /*isPropertyAccessor=*/false,
                            /*isPropertyAccessor=*/false,
@@ -791,21 +793,24 @@ ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR,
                                                  SourceLocation(),
                                                  SourceLocation(),
                                                  &Context.Idents.get("objects"),
                                                  &Context.Idents.get("objects"),
                                                  Context.getPointerType(IdT),
                                                  Context.getPointerType(IdT),
-                                                 /*TInfo=*/0, SC_None, 0);
+                                                 /*TInfo=*/nullptr, SC_None,
+                                                 nullptr);
       Params.push_back(objects);
       Params.push_back(objects);
       ParmVarDecl *keys = ParmVarDecl::Create(Context, Method,
       ParmVarDecl *keys = ParmVarDecl::Create(Context, Method,
                                               SourceLocation(),
                                               SourceLocation(),
                                               SourceLocation(),
                                               SourceLocation(),
                                               &Context.Idents.get("keys"),
                                               &Context.Idents.get("keys"),
                                               Context.getPointerType(IdT),
                                               Context.getPointerType(IdT),
-                                              /*TInfo=*/0, SC_None, 0);
+                                              /*TInfo=*/nullptr, SC_None,
+                                              nullptr);
       Params.push_back(keys);
       Params.push_back(keys);
       ParmVarDecl *cnt = ParmVarDecl::Create(Context, Method,
       ParmVarDecl *cnt = ParmVarDecl::Create(Context, Method,
                                              SourceLocation(),
                                              SourceLocation(),
                                              SourceLocation(),
                                              SourceLocation(),
                                              &Context.Idents.get("cnt"),
                                              &Context.Idents.get("cnt"),
                                              Context.UnsignedLongTy,
                                              Context.UnsignedLongTy,
-                                             /*TInfo=*/0, SC_None, 0);
+                                             /*TInfo=*/nullptr, SC_None,
+                                             nullptr);
       Params.push_back(cnt);
       Params.push_back(cnt);
       Method->setMethodParams(Context, Params, None);
       Method->setMethodParams(Context, Params, None);
     }
     }
@@ -1115,7 +1120,7 @@ ObjCMethodDecl *Sema::tryCaptureObjCSelf(SourceLocation Loc) {
   // still have a 'self', and we really do still need to capture it!
   // still have a 'self', and we really do still need to capture it!
   ObjCMethodDecl *method = dyn_cast<ObjCMethodDecl>(DC);
   ObjCMethodDecl *method = dyn_cast<ObjCMethodDecl>(DC);
   if (!method)
   if (!method)
-    return 0;
+    return nullptr;
 
 
   tryCaptureVariable(method->getSelfDecl(), Loc);
   tryCaptureVariable(method->getSelfDecl(), Loc);
 
 
@@ -1200,7 +1205,7 @@ findExplicitInstancetypeDeclarer(const ObjCMethodDecl *MD,
       return result;
       return result;
   }
   }
 
 
-  return 0;
+  return nullptr;
 }
 }
 
 
 void Sema::EmitRelatedResultTypeNoteForReturn(QualType destType) {
 void Sema::EmitRelatedResultTypeNoteForReturn(QualType destType) {
@@ -1407,7 +1412,7 @@ bool Sema::CheckMessageArgumentTypes(QualType ReceiverType,
         continue;
         continue;
 
 
       ExprResult Arg = DefaultVariadicArgumentPromotion(Args[i], VariadicMethod,
       ExprResult Arg = DefaultVariadicArgumentPromotion(Args[i], VariadicMethod,
-                                                        0);
+                                                        nullptr);
       IsError |= Arg.isInvalid();
       IsError |= Arg.isInvalid();
       Args[i] = Arg.take();
       Args[i] = Arg.take();
     }
     }
@@ -1469,7 +1474,7 @@ ObjCMethodDecl *Sema::LookupMethodInObjectType(Selector sel, QualType type,
     if (ObjCMethodDecl *method = I->lookupMethod(sel, isInstance))
     if (ObjCMethodDecl *method = I->lookupMethod(sel, isInstance))
       return method;
       return method;
 
 
-  return 0;
+  return nullptr;
 }
 }
 
 
 /// LookupMethodInQualifiedType - Lookups up a method in protocol qualifier 
 /// LookupMethodInQualifiedType - Lookups up a method in protocol qualifier 
@@ -1478,13 +1483,13 @@ ObjCMethodDecl *Sema::LookupMethodInQualifiedType(Selector Sel,
                                               const ObjCObjectPointerType *OPT,
                                               const ObjCObjectPointerType *OPT,
                                               bool Instance)
                                               bool Instance)
 {
 {
-  ObjCMethodDecl *MD = 0;
+  ObjCMethodDecl *MD = nullptr;
   for (const auto *PROTO : OPT->quals()) {
   for (const auto *PROTO : OPT->quals()) {
     if ((MD = PROTO->lookupMethod(Sel, Instance))) {
     if ((MD = PROTO->lookupMethod(Sel, Instance))) {
       return MD;
       return MD;
     }
     }
   }
   }
-  return 0;
+  return nullptr;
 }
 }
 
 
 static void DiagnoseARCUseOfWeakReceiver(Sema &S, Expr *Receiver) {
 static void DiagnoseARCUseOfWeakReceiver(Sema &S, Expr *Receiver) {
@@ -1497,8 +1502,8 @@ static void DiagnoseARCUseOfWeakReceiver(Sema &S, Expr *Receiver) {
   Expr *RExpr = Receiver->IgnoreParenImpCasts();
   Expr *RExpr = Receiver->IgnoreParenImpCasts();
   SourceLocation Loc = RExpr->getLocStart();
   SourceLocation Loc = RExpr->getLocStart();
   QualType T = RExpr->getType();
   QualType T = RExpr->getType();
-  const ObjCPropertyDecl *PDecl = 0;
-  const ObjCMethodDecl *GDecl = 0;
+  const ObjCPropertyDecl *PDecl = nullptr;
+  const ObjCMethodDecl *GDecl = nullptr;
   if (PseudoObjectExpr *POE = dyn_cast<PseudoObjectExpr>(RExpr)) {
   if (PseudoObjectExpr *POE = dyn_cast<PseudoObjectExpr>(RExpr)) {
     RExpr = POE->getSyntacticForm();
     RExpr = POE->getSyntacticForm();
     if (ObjCPropertyRefExpr *PRE = dyn_cast<ObjCPropertyRefExpr>(RExpr)) {
     if (ObjCPropertyRefExpr *PRE = dyn_cast<ObjCPropertyRefExpr>(RExpr)) {
@@ -1669,8 +1674,8 @@ HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT,
   // Attempt to correct for typos in property names.
   // Attempt to correct for typos in property names.
   DeclFilterCCC<ObjCPropertyDecl> Validator;
   DeclFilterCCC<ObjCPropertyDecl> Validator;
   if (TypoCorrection Corrected = CorrectTypo(
   if (TypoCorrection Corrected = CorrectTypo(
-          DeclarationNameInfo(MemberName, MemberLoc), LookupOrdinaryName, NULL,
-          NULL, Validator, CTK_ErrorRecovery, IFace, false, OPT)) {
+          DeclarationNameInfo(MemberName, MemberLoc), LookupOrdinaryName,
+          nullptr, nullptr, Validator, CTK_ErrorRecovery, IFace, false, OPT)) {
     diagnoseTypo(Corrected, PDiag(diag::err_property_not_found_suggest)
     diagnoseTypo(Corrected, PDiag(diag::err_property_not_found_suggest)
                               << MemberName << QualType(OPT, 0));
                               << MemberName << QualType(OPT, 0));
     DeclarationName TypoResult = Corrected.getCorrection();
     DeclarationName TypoResult = Corrected.getCorrection();
@@ -1717,7 +1722,7 @@ ActOnClassPropertyRefExpr(IdentifierInfo &receiverName,
                                                   receiverNameLoc);
                                                   receiverNameLoc);
 
 
   bool IsSuper = false;
   bool IsSuper = false;
-  if (IFace == 0) {
+  if (!IFace) {
     // If the "receiver" is 'super' in a method, handle it as an expression-like
     // If the "receiver" is 'super' in a method, handle it as an expression-like
     // property reference.
     // property reference.
     if (receiverNamePtr->isStr("super")) {
     if (receiverNamePtr->isStr("super")) {
@@ -1735,9 +1740,9 @@ ActOnClassPropertyRefExpr(IdentifierInfo &receiverName,
           }
           }
           QualType T = Context.getObjCInterfaceType(Super);
           QualType T = Context.getObjCInterfaceType(Super);
           T = Context.getObjCObjectPointerType(T);
           T = Context.getObjCObjectPointerType(T);
-        
+
           return HandleExprPropertyRefExpr(T->getAsObjCInterfacePointerType(),
           return HandleExprPropertyRefExpr(T->getAsObjCInterfacePointerType(),
-                                           /*BaseExpr*/0, 
+                                           /*BaseExpr*/nullptr,
                                            SourceLocation()/*OpLoc*/, 
                                            SourceLocation()/*OpLoc*/, 
                                            &propertyName,
                                            &propertyName,
                                            propertyNameLoc,
                                            propertyNameLoc,
@@ -1749,8 +1754,8 @@ ActOnClassPropertyRefExpr(IdentifierInfo &receiverName,
         IFace = CurMethod->getClassInterface()->getSuperClass();
         IFace = CurMethod->getClassInterface()->getSuperClass();
       }
       }
     }
     }
-    
-    if (IFace == 0) {
+
+    if (!IFace) {
       Diag(receiverNameLoc, diag::err_expected_either) << tok::identifier
       Diag(receiverNameLoc, diag::err_expected_either) << tok::identifier
                                                        << tok::l_paren;
                                                        << tok::l_paren;
       return ExprError();
       return ExprError();
@@ -1902,8 +1907,8 @@ Sema::ObjCMessageKind Sema::getObjCMessageKind(Scope *S,
   ObjCInterfaceOrSuperCCC Validator(getCurMethodDecl());
   ObjCInterfaceOrSuperCCC Validator(getCurMethodDecl());
   if (TypoCorrection Corrected =
   if (TypoCorrection Corrected =
           CorrectTypo(Result.getLookupNameInfo(), Result.getLookupKind(), S,
           CorrectTypo(Result.getLookupNameInfo(), Result.getLookupKind(), S,
-                      NULL, Validator, CTK_ErrorRecovery, NULL, false, NULL,
-                      false)) {
+                      nullptr, Validator, CTK_ErrorRecovery, nullptr, false,
+                      nullptr, false)) {
     if (Corrected.isKeyword()) {
     if (Corrected.isKeyword()) {
       // If we've found the keyword "super" (the only keyword that would be
       // If we've found the keyword "super" (the only keyword that would be
       // returned by CorrectTypo), this is a send to super.
       // returned by CorrectTypo), this is a send to super.
@@ -1966,16 +1971,16 @@ ExprResult Sema::ActOnSuperMessage(Scope *S,
     // message to the superclass instance.
     // message to the superclass instance.
     QualType SuperTy = Context.getObjCInterfaceType(Super);
     QualType SuperTy = Context.getObjCInterfaceType(Super);
     SuperTy = Context.getObjCObjectPointerType(SuperTy);
     SuperTy = Context.getObjCObjectPointerType(SuperTy);
-    return BuildInstanceMessage(0, SuperTy, SuperLoc,
-                                Sel, /*Method=*/0,
+    return BuildInstanceMessage(nullptr, SuperTy, SuperLoc,
+                                Sel, /*Method=*/nullptr,
                                 LBracLoc, SelectorLocs, RBracLoc, Args);
                                 LBracLoc, SelectorLocs, RBracLoc, Args);
   }
   }
   
   
   // Since we are in a class method, this is a class message to
   // Since we are in a class method, this is a class message to
   // the superclass.
   // the superclass.
-  return BuildClassMessage(/*ReceiverTypeInfo=*/0,
+  return BuildClassMessage(/*ReceiverTypeInfo=*/nullptr,
                            Context.getObjCInterfaceType(Super),
                            Context.getObjCInterfaceType(Super),
-                           SuperLoc, Sel, /*Method=*/0,
+                           SuperLoc, Sel, /*Method=*/nullptr,
                            LBracLoc, SelectorLocs, RBracLoc, Args);
                            LBracLoc, SelectorLocs, RBracLoc, Args);
 }
 }
 
 
@@ -1986,7 +1991,7 @@ ExprResult Sema::BuildClassMessageImplicit(QualType ReceiverType,
                                            Selector Sel,
                                            Selector Sel,
                                            ObjCMethodDecl *Method,
                                            ObjCMethodDecl *Method,
                                            MultiExprArg Args) {
                                            MultiExprArg Args) {
-  TypeSourceInfo *receiverTypeInfo = 0;
+  TypeSourceInfo *receiverTypeInfo = nullptr;
   if (!ReceiverType.isNull())
   if (!ReceiverType.isNull())
     receiverTypeInfo = Context.getTrivialTypeSourceInfo(ReceiverType);
     receiverTypeInfo = Context.getTrivialTypeSourceInfo(ReceiverType);
 
 
@@ -2100,13 +2105,13 @@ ExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo,
     assert(SuperLoc.isInvalid() && "Message to super with dependent type");
     assert(SuperLoc.isInvalid() && "Message to super with dependent type");
     return Owned(ObjCMessageExpr::Create(Context, ReceiverType,
     return Owned(ObjCMessageExpr::Create(Context, ReceiverType,
                                          VK_RValue, LBracLoc, ReceiverTypeInfo,
                                          VK_RValue, LBracLoc, ReceiverTypeInfo,
-                                         Sel, SelectorLocs, /*Method=*/0,
+                                         Sel, SelectorLocs, /*Method=*/nullptr,
                                          makeArrayRef(Args, NumArgs),RBracLoc,
                                          makeArrayRef(Args, NumArgs),RBracLoc,
                                          isImplicit));
                                          isImplicit));
   }
   }
   
   
   // Find the class to which we are sending this message.
   // Find the class to which we are sending this message.
-  ObjCInterfaceDecl *Class = 0;
+  ObjCInterfaceDecl *Class = nullptr;
   const ObjCObjectType *ClassType = ReceiverType->getAs<ObjCObjectType>();
   const ObjCObjectType *ClassType = ReceiverType->getAs<ObjCObjectType>();
   if (!ClassType || !(Class = ClassType->getInterface())) {
   if (!ClassType || !(Class = ClassType->getInterface())) {
     Diag(Loc, diag::err_invalid_receiver_class_message)
     Diag(Loc, diag::err_invalid_receiver_class_message)
@@ -2202,8 +2207,9 @@ ExprResult Sema::ActOnClassMessage(Scope *S,
     ReceiverTypeInfo = Context.getTrivialTypeSourceInfo(ReceiverType, LBracLoc);
     ReceiverTypeInfo = Context.getTrivialTypeSourceInfo(ReceiverType, LBracLoc);
 
 
   return BuildClassMessage(ReceiverTypeInfo, ReceiverType, 
   return BuildClassMessage(ReceiverTypeInfo, ReceiverType, 
-                           /*SuperLoc=*/SourceLocation(), Sel, /*Method=*/0,
-                           LBracLoc, SelectorLocs, RBracLoc, Args);
+                           /*SuperLoc=*/SourceLocation(), Sel,
+                           /*Method=*/nullptr, LBracLoc, SelectorLocs, RBracLoc,
+                           Args);
 }
 }
 
 
 ExprResult Sema::BuildInstanceMessageImplicit(Expr *Receiver,
 ExprResult Sema::BuildInstanceMessageImplicit(Expr *Receiver,
@@ -2293,7 +2299,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
       assert(SuperLoc.isInvalid() && "Message to super with dependent type");
       assert(SuperLoc.isInvalid() && "Message to super with dependent type");
       return Owned(ObjCMessageExpr::Create(Context, Context.DependentTy,
       return Owned(ObjCMessageExpr::Create(Context, Context.DependentTy,
                                            VK_RValue, LBracLoc, Receiver, Sel, 
                                            VK_RValue, LBracLoc, Receiver, Sel, 
-                                           SelectorLocs, /*Method=*/0,
+                                           SelectorLocs, /*Method=*/nullptr,
                                            makeArrayRef(Args, NumArgs),
                                            makeArrayRef(Args, NumArgs),
                                            RBracLoc, isImplicit));
                                            RBracLoc, isImplicit));
     }
     }
@@ -2417,7 +2423,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
         }
         }
       }
       }
     } else {
     } else {
-      ObjCInterfaceDecl* ClassDecl = 0;
+      ObjCInterfaceDecl *ClassDecl = nullptr;
 
 
       // We allow sending a message to a qualified ID ("id<foo>"), which is ok as
       // We allow sending a message to a qualified ID ("id<foo>"), which is ok as
       // long as one of the protocols implements the selector (if not, warn).
       // long as one of the protocols implements the selector (if not, warn).
@@ -2437,7 +2443,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
 
 
         // Try to complete the type. Under ARC, this is a hard error from which
         // Try to complete the type. Under ARC, this is a hard error from which
         // we don't try to recover.
         // we don't try to recover.
-        const ObjCInterfaceDecl *forwardClass = 0;
+        const ObjCInterfaceDecl *forwardClass = nullptr;
         if (RequireCompleteType(Loc, OCIType->getPointeeType(),
         if (RequireCompleteType(Loc, OCIType->getPointeeType(),
               getLangOpts().ObjCAutoRefCount
               getLangOpts().ObjCAutoRefCount
                 ? diag::err_arc_receiver_forward_instance
                 ? diag::err_arc_receiver_forward_instance
@@ -2450,7 +2456,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
           forwardClass = OCIType->getInterfaceDecl();
           forwardClass = OCIType->getInterfaceDecl();
           Diag(Receiver ? Receiver->getLocStart() 
           Diag(Receiver ? Receiver->getLocStart() 
                         : SuperLoc, diag::note_receiver_is_id);
                         : SuperLoc, diag::note_receiver_is_id);
-          Method = 0;
+          Method = nullptr;
         } else {
         } else {
           Method = ClassDecl->lookupInstanceMethod(Sel);
           Method = ClassDecl->lookupInstanceMethod(Sel);
         }
         }
@@ -2497,8 +2503,8 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
 
 
   FunctionScopeInfo *DIFunctionScopeInfo =
   FunctionScopeInfo *DIFunctionScopeInfo =
     (Method && Method->getMethodFamily() == OMF_init)
     (Method && Method->getMethodFamily() == OMF_init)
-      ? getEnclosingFunction() : 0;
-  
+      ? getEnclosingFunction() : nullptr;
+
   if (DIFunctionScopeInfo &&
   if (DIFunctionScopeInfo &&
       DIFunctionScopeInfo->ObjCIsDesignatedInit &&
       DIFunctionScopeInfo->ObjCIsDesignatedInit &&
       (SuperLoc.isValid() || isSelfExpr(Receiver))) {
       (SuperLoc.isValid() || isSelfExpr(Receiver))) {
@@ -2518,7 +2524,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
       }
       }
     }
     }
     if (!isDesignatedInitChain) {
     if (!isDesignatedInitChain) {
-      const ObjCMethodDecl *InitMethod = 0;
+      const ObjCMethodDecl *InitMethod = nullptr;
       bool isDesignated =
       bool isDesignated =
         getCurMethodDecl()->isDesignatedInitializerForTheInterface(&InitMethod);
         getCurMethodDecl()->isDesignatedInitializerForTheInterface(&InitMethod);
       assert(isDesignated && InitMethod);
       assert(isDesignated && InitMethod);
@@ -2736,10 +2742,11 @@ ExprResult Sema::ActOnInstanceMessage(Scope *S,
   }
   }
   if (Sel == RespondsToSelectorSel)
   if (Sel == RespondsToSelectorSel)
     RemoveSelectorFromWarningCache(*this, Args[0]);
     RemoveSelectorFromWarningCache(*this, Args[0]);
-    
+
   return BuildInstanceMessage(Receiver, Receiver->getType(),
   return BuildInstanceMessage(Receiver, Receiver->getType(),
-                              /*SuperLoc=*/SourceLocation(), Sel, /*Method=*/0, 
-                              LBracLoc, SelectorLocs, RBracLoc, Args);
+                              /*SuperLoc=*/SourceLocation(), Sel,
+                              /*Method=*/nullptr, LBracLoc, SelectorLocs,
+                              RBracLoc, Args);
 }
 }
 
 
 enum ARCConversionTypeClass {
 enum ARCConversionTypeClass {
@@ -3149,7 +3156,7 @@ static inline T *getObjCBridgeAttr(const TypedefType *TD) {
       if (RecordDecl *RD = RT->getDecl())
       if (RecordDecl *RD = RT->getDecl())
         return RD->getAttr<T>();
         return RD->getAttr<T>();
   }
   }
-  return 0;
+  return nullptr;
 }
 }
 
 
 static ObjCBridgeRelatedAttr *ObjCBridgeRelatedAttrFromType(QualType T,
 static ObjCBridgeRelatedAttr *ObjCBridgeRelatedAttrFromType(QualType T,
@@ -3161,7 +3168,7 @@ static ObjCBridgeRelatedAttr *ObjCBridgeRelatedAttrFromType(QualType T,
       return ObjCBAttr;
       return ObjCBAttr;
     T = TDNDecl->getUnderlyingType();
     T = TDNDecl->getUnderlyingType();
   }
   }
-  return 0;
+  return nullptr;
 }
 }
 
 
 static void
 static void
@@ -3178,7 +3185,7 @@ diagnoseObjCARCConversion(Sema &S, SourceRange castRange,
     return;
     return;
 
 
   QualType castExprType = castExpr->getType();
   QualType castExprType = castExpr->getType();
-  TypedefNameDecl *TDNDecl = 0;
+  TypedefNameDecl *TDNDecl = nullptr;
   if ((castACTC == ACTC_coreFoundation &&  exprACTC == ACTC_retainable &&
   if ((castACTC == ACTC_coreFoundation &&  exprACTC == ACTC_retainable &&
        ObjCBridgeRelatedAttrFromType(castType, TDNDecl)) ||
        ObjCBridgeRelatedAttrFromType(castType, TDNDecl)) ||
       (exprACTC == ACTC_coreFoundation && castACTC == ACTC_retainable &&
       (exprACTC == ACTC_coreFoundation && castACTC == ACTC_retainable &&
@@ -3224,9 +3231,10 @@ diagnoseObjCARCConversion(Sema &S, SourceRange castRange,
       DiagnosticBuilder DiagB = 
       DiagnosticBuilder DiagB = 
         (CCK != Sema::CCK_OtherCast) ? S.Diag(noteLoc, diag::note_arc_bridge)
         (CCK != Sema::CCK_OtherCast) ? S.Diag(noteLoc, diag::note_arc_bridge)
                               : S.Diag(noteLoc, diag::note_arc_cstyle_bridge);
                               : S.Diag(noteLoc, diag::note_arc_cstyle_bridge);
-      
+
       addFixitForObjCARCConversion(S, DiagB, CCK, afterLParen,
       addFixitForObjCARCConversion(S, DiagB, CCK, afterLParen,
-                                   castType, castExpr, realCast, "__bridge ", 0);
+                                   castType, castExpr, realCast, "__bridge ",
+                                   nullptr);
     }
     }
     if (CreateRule != ACC_plusZero)
     if (CreateRule != ACC_plusZero)
     {
     {
@@ -3236,10 +3244,10 @@ diagnoseObjCARCConversion(Sema &S, SourceRange castRange,
           S.Diag(br ? castExpr->getExprLoc() : noteLoc,
           S.Diag(br ? castExpr->getExprLoc() : noteLoc,
                  diag::note_arc_bridge_transfer)
                  diag::note_arc_bridge_transfer)
             << castExprType << br;
             << castExprType << br;
-      
+
       addFixitForObjCARCConversion(S, DiagB, CCK, afterLParen,
       addFixitForObjCARCConversion(S, DiagB, CCK, afterLParen,
                                    castType, castExpr, realCast, "__bridge_transfer ",
                                    castType, castExpr, realCast, "__bridge_transfer ",
-                                   br ? "CFBridgingRelease" : 0);
+                                   br ? "CFBridgingRelease" : nullptr);
     }
     }
 
 
     return;
     return;
@@ -3265,7 +3273,8 @@ diagnoseObjCARCConversion(Sema &S, SourceRange castRange,
       (CCK != Sema::CCK_OtherCast) ? S.Diag(noteLoc, diag::note_arc_bridge)
       (CCK != Sema::CCK_OtherCast) ? S.Diag(noteLoc, diag::note_arc_bridge)
                                : S.Diag(noteLoc, diag::note_arc_cstyle_bridge);
                                : S.Diag(noteLoc, diag::note_arc_cstyle_bridge);
       addFixitForObjCARCConversion(S, DiagB, CCK, afterLParen,
       addFixitForObjCARCConversion(S, DiagB, CCK, afterLParen,
-                                   castType, castExpr, realCast, "__bridge ", 0);
+                                   castType, castExpr, realCast, "__bridge ",
+                                   nullptr);
     }
     }
     if (CreateRule != ACC_plusZero)
     if (CreateRule != ACC_plusZero)
     {
     {
@@ -3275,10 +3284,10 @@ diagnoseObjCARCConversion(Sema &S, SourceRange castRange,
           S.Diag(br ? castExpr->getExprLoc() : noteLoc,
           S.Diag(br ? castExpr->getExprLoc() : noteLoc,
                  diag::note_arc_bridge_retained)
                  diag::note_arc_bridge_retained)
             << castType << br;
             << castType << br;
-      
+
       addFixitForObjCARCConversion(S, DiagB, CCK, afterLParen,
       addFixitForObjCARCConversion(S, DiagB, CCK, afterLParen,
                                    castType, castExpr, realCast, "__bridge_retained ",
                                    castType, castExpr, realCast, "__bridge_retained ",
-                                   br ? "CFBridgingRetain" : 0);
+                                   br ? "CFBridgingRetain" : nullptr);
     }
     }
 
 
     return;
     return;
@@ -3297,7 +3306,7 @@ static void CheckObjCBridgeNSCast(Sema &S, QualType castType, Expr *castExpr) {
     TypedefNameDecl *TDNDecl = TD->getDecl();
     TypedefNameDecl *TDNDecl = TD->getDecl();
     if (TB *ObjCBAttr = getObjCBridgeAttr<TB>(TD)) {
     if (TB *ObjCBAttr = getObjCBridgeAttr<TB>(TD)) {
       if (IdentifierInfo *Parm = ObjCBAttr->getBridgedType()) {
       if (IdentifierInfo *Parm = ObjCBAttr->getBridgedType()) {
-        NamedDecl *Target = 0;
+        NamedDecl *Target = nullptr;
         // Check for an existing type with this name.
         // Check for an existing type with this name.
         LookupResult R(S, DeclarationName(Parm), SourceLocation(),
         LookupResult R(S, DeclarationName(Parm), SourceLocation(),
                        Sema::LookupOrdinaryName);
                        Sema::LookupOrdinaryName);
@@ -3350,7 +3359,7 @@ static void CheckObjCBridgeCFCast(Sema &S, QualType castType, Expr *castExpr) {
     TypedefNameDecl *TDNDecl = TD->getDecl();
     TypedefNameDecl *TDNDecl = TD->getDecl();
     if (TB *ObjCBAttr = getObjCBridgeAttr<TB>(TD)) {
     if (TB *ObjCBAttr = getObjCBridgeAttr<TB>(TD)) {
       if (IdentifierInfo *Parm = ObjCBAttr->getBridgedType()) {
       if (IdentifierInfo *Parm = ObjCBAttr->getBridgedType()) {
-        NamedDecl *Target = 0;
+        NamedDecl *Target = nullptr;
         // Check for an existing type with this name.
         // Check for an existing type with this name.
         LookupResult R(S, DeclarationName(Parm), SourceLocation(),
         LookupResult R(S, DeclarationName(Parm), SourceLocation(),
                        Sema::LookupOrdinaryName);
                        Sema::LookupOrdinaryName);
@@ -3447,7 +3456,7 @@ bool Sema::checkObjCBridgeRelatedComponents(SourceLocation Loc,
   IdentifierInfo *IMId = ObjCBAttr->getInstanceMethod();
   IdentifierInfo *IMId = ObjCBAttr->getInstanceMethod();
   if (!RCId)
   if (!RCId)
     return false;
     return false;
-  NamedDecl *Target = 0;
+  NamedDecl *Target = nullptr;
   // Check for an existing type with this name.
   // Check for an existing type with this name.
   LookupResult R(*this, DeclarationName(RCId), SourceLocation(),
   LookupResult R(*this, DeclarationName(RCId), SourceLocation(),
                  Sema::LookupOrdinaryName);
                  Sema::LookupOrdinaryName);
@@ -3507,9 +3516,9 @@ Sema::CheckObjCBridgeRelatedConversions(SourceLocation Loc,
     return false;
     return false;
   
   
   ObjCInterfaceDecl *RelatedClass;
   ObjCInterfaceDecl *RelatedClass;
-  ObjCMethodDecl *ClassMethod = 0;
-  ObjCMethodDecl *InstanceMethod = 0;
-  TypedefNameDecl *TDNDecl = 0;
+  ObjCMethodDecl *ClassMethod = nullptr;
+  ObjCMethodDecl *InstanceMethod = nullptr;
+  TypedefNameDecl *TDNDecl = nullptr;
   if (!checkObjCBridgeRelatedComponents(Loc, DestType, SrcType, RelatedClass,
   if (!checkObjCBridgeRelatedComponents(Loc, DestType, SrcType, RelatedClass,
                                         ClassMethod, InstanceMethod, TDNDecl, CfToNs))
                                         ClassMethod, InstanceMethod, TDNDecl, CfToNs))
     return false;
     return false;
@@ -3654,7 +3663,7 @@ Sema::CheckObjCARCConversion(SourceRange castRange, QualType castType,
   case ACC_plusOne:
   case ACC_plusOne:
     castExpr = ImplicitCastExpr::Create(Context, castExpr->getType(),
     castExpr = ImplicitCastExpr::Create(Context, castExpr->getType(),
                                         CK_ARCConsumeObject, castExpr,
                                         CK_ARCConsumeObject, castExpr,
-                                        0, VK_RValue);
+                                        nullptr, VK_RValue);
     ExprNeedsCleanups = true;
     ExprNeedsCleanups = true;
     return ACR_okay;
     return ACR_okay;
   }
   }
@@ -3856,7 +3865,7 @@ ExprResult Sema::BuildObjCBridgedCast(SourceLocation LParenLoc,
       // Produce the object before casting it.
       // Produce the object before casting it.
       SubExpr = ImplicitCastExpr::Create(Context, FromType,
       SubExpr = ImplicitCastExpr::Create(Context, FromType,
                                          CK_ARCProduceObject,
                                          CK_ARCProduceObject,
-                                         SubExpr, 0, VK_RValue);
+                                         SubExpr, nullptr, VK_RValue);
       break;
       break;
       
       
     case OBC_BridgeTransfer: {
     case OBC_BridgeTransfer: {
@@ -3895,7 +3904,7 @@ ExprResult Sema::BuildObjCBridgedCast(SourceLocation LParenLoc,
   if (MustConsume) {
   if (MustConsume) {
     ExprNeedsCleanups = true;
     ExprNeedsCleanups = true;
     Result = ImplicitCastExpr::Create(Context, T, CK_ARCConsumeObject, Result, 
     Result = ImplicitCastExpr::Create(Context, T, CK_ARCConsumeObject, Result, 
-                                      0, VK_RValue);    
+                                      nullptr, VK_RValue);
   }
   }
   
   
   return Result;
   return Result;
@@ -3908,7 +3917,7 @@ ExprResult Sema::ActOnObjCBridgedCast(Scope *S,
                                       ParsedType Type,
                                       ParsedType Type,
                                       SourceLocation RParenLoc,
                                       SourceLocation RParenLoc,
                                       Expr *SubExpr) {
                                       Expr *SubExpr) {
-  TypeSourceInfo *TSInfo = 0;
+  TypeSourceInfo *TSInfo = nullptr;
   QualType T = GetTypeFromParser(Type, &TSInfo);
   QualType T = GetTypeFromParser(Type, &TSInfo);
   if (Kind == OBC_Bridge)
   if (Kind == OBC_Bridge)
     CheckTollFreeBridgeCast(T, SubExpr);
     CheckTollFreeBridgeCast(T, SubExpr);

+ 53 - 50
lib/Sema/SemaInit.cpp

@@ -69,7 +69,7 @@ static StringInitFailureKind IsStringInit(Expr *Init, const ArrayType *AT,
 
 
   // Otherwise we can only handle string literals.
   // Otherwise we can only handle string literals.
   StringLiteral *SL = dyn_cast<StringLiteral>(Init);
   StringLiteral *SL = dyn_cast<StringLiteral>(Init);
-  if (SL == 0)
+  if (!SL)
     return SIF_Other;
     return SIF_Other;
 
 
   const QualType ElemTy =
   const QualType ElemTy =
@@ -498,7 +498,7 @@ InitListChecker::FillInValueInitializations(const InitializedEntity &Entity,
         ElementEntity.getKind() == InitializedEntity::EK_VectorElement)
         ElementEntity.getKind() == InitializedEntity::EK_VectorElement)
       ElementEntity.setElementIndex(Init);
       ElementEntity.setElementIndex(Init);
 
 
-    Expr *InitExpr = (Init < NumInits ? ILE->getInit(Init) : 0);
+    Expr *InitExpr = (Init < NumInits ? ILE->getInit(Init) : nullptr);
     if (!InitExpr && !ILE->hasArrayFiller()) {
     if (!InitExpr && !ILE->hasArrayFiller()) {
       InitializationKind Kind = InitializationKind::CreateValue(Loc, Loc, Loc,
       InitializationKind Kind = InitializationKind::CreateValue(Loc, Loc, Loc,
                                                                 true);
                                                                 true);
@@ -556,7 +556,7 @@ InitListChecker::InitListChecker(Sema &S, const InitializedEntity &Entity,
   hadError = false;
   hadError = false;
 
 
   FullyStructuredList =
   FullyStructuredList =
-      getStructuredSubobjectInit(IL, 0, T, 0, 0, IL->getSourceRange());
+      getStructuredSubobjectInit(IL, 0, T, nullptr, 0, IL->getSourceRange());
   CheckExplicitInitList(Entity, IL, T, FullyStructuredList,
   CheckExplicitInitList(Entity, IL, T, FullyStructuredList,
                         /*TopLevelObject=*/true);
                         /*TopLevelObject=*/true);
 
 
@@ -1030,7 +1030,7 @@ void InitListChecker::CheckScalarType(const InitializedEntity &Entity,
                                       SemaRef.Owned(expr),
                                       SemaRef.Owned(expr),
                                       /*TopLevelOfInitList=*/true);
                                       /*TopLevelOfInitList=*/true);
 
 
-  Expr *ResultExpr = 0;
+  Expr *ResultExpr = nullptr;
 
 
   if (Result.isInvalid())
   if (Result.isInvalid())
     hadError = true; // types weren't compatible.
     hadError = true; // types weren't compatible.
@@ -1141,7 +1141,7 @@ void InitListChecker::CheckVectorType(const InitializedEntity &Entity,
                                           SemaRef.Owned(Init),
                                           SemaRef.Owned(Init),
                                           /*TopLevelOfInitList=*/true);
                                           /*TopLevelOfInitList=*/true);
 
 
-      Expr *ResultExpr = 0;
+      Expr *ResultExpr = nullptr;
       if (Result.isInvalid())
       if (Result.isInvalid())
         hadError = true; // types weren't compatible.
         hadError = true; // types weren't compatible.
       else {
       else {
@@ -1287,7 +1287,7 @@ void InitListChecker::CheckArrayType(const InitializedEntity &Entity,
       // Handle this designated initializer. elementIndex will be
       // Handle this designated initializer. elementIndex will be
       // updated to be the next array element we'll initialize.
       // updated to be the next array element we'll initialize.
       if (CheckDesignatedInitializer(Entity, IList, DIE, 0,
       if (CheckDesignatedInitializer(Entity, IList, DIE, 0,
-                                     DeclType, 0, &elementIndex, Index,
+                                     DeclType, nullptr, &elementIndex, Index,
                                      StructuredList, StructuredIndex, true,
                                      StructuredList, StructuredIndex, true,
                                      false)) {
                                      false)) {
         hadError = true;
         hadError = true;
@@ -1462,7 +1462,7 @@ void InitListChecker::CheckStructUnionTypes(const InitializedEntity &Entity,
       // Handle this designated initializer. Field will be updated to
       // Handle this designated initializer. Field will be updated to
       // the next field that we'll be initializing.
       // the next field that we'll be initializing.
       if (CheckDesignatedInitializer(Entity, IList, DIE, 0,
       if (CheckDesignatedInitializer(Entity, IList, DIE, 0,
-                                     DeclType, &Field, 0, Index,
+                                     DeclType, &Field, nullptr, Index,
                                      StructuredList, StructuredIndex,
                                      StructuredList, StructuredIndex,
                                      true, TopLevelObject))
                                      true, TopLevelObject))
         hadError = true;
         hadError = true;
@@ -1586,12 +1586,12 @@ static void ExpandAnonymousFieldDesignator(Sema &SemaRef,
   for (IndirectFieldDecl::chain_iterator PI = IndirectField->chain_begin(),
   for (IndirectFieldDecl::chain_iterator PI = IndirectField->chain_begin(),
        PE = IndirectField->chain_end(); PI != PE; ++PI) {
        PE = IndirectField->chain_end(); PI != PE; ++PI) {
     if (PI + 1 == PE)
     if (PI + 1 == PE)
-      Replacements.push_back(Designator((IdentifierInfo *)0,
+      Replacements.push_back(Designator((IdentifierInfo *)nullptr,
                                     DIE->getDesignator(DesigIdx)->getDotLoc(),
                                     DIE->getDesignator(DesigIdx)->getDotLoc(),
                                 DIE->getDesignator(DesigIdx)->getFieldLoc()));
                                 DIE->getDesignator(DesigIdx)->getFieldLoc()));
     else
     else
-      Replacements.push_back(Designator((IdentifierInfo *)0, SourceLocation(),
-                                        SourceLocation()));
+      Replacements.push_back(Designator((IdentifierInfo *)nullptr,
+                                        SourceLocation(), SourceLocation()));
     assert(isa<FieldDecl>(*PI));
     assert(isa<FieldDecl>(*PI));
     Replacements.back().setField(cast<FieldDecl>(*PI));
     Replacements.back().setField(cast<FieldDecl>(*PI));
   }
   }
@@ -1608,7 +1608,7 @@ static void ExpandAnonymousFieldDesignator(Sema &SemaRef,
 static IndirectFieldDecl *FindIndirectFieldDesignator(FieldDecl *AnonField,
 static IndirectFieldDecl *FindIndirectFieldDesignator(FieldDecl *AnonField,
                                                  IdentifierInfo *FieldName) {
                                                  IdentifierInfo *FieldName) {
   if (!FieldName)
   if (!FieldName)
-    return 0;
+    return nullptr;
 
 
   assert(AnonField->isAnonymousStructOrUnion());
   assert(AnonField->isAnonymousStructOrUnion());
   Decl *NextDecl = AnonField->getNextDeclInContext();
   Decl *NextDecl = AnonField->getNextDeclInContext();
@@ -1618,7 +1618,7 @@ static IndirectFieldDecl *FindIndirectFieldDesignator(FieldDecl *AnonField,
       return IF;
       return IF;
     NextDecl = NextDecl->getNextDeclInContext();
     NextDecl = NextDecl->getNextDeclInContext();
   }
   }
-  return 0;
+  return nullptr;
 }
 }
 
 
 static DesignatedInitExpr *CloneDesignatedInitExpr(Sema &SemaRef,
 static DesignatedInitExpr *CloneDesignatedInitExpr(Sema &SemaRef,
@@ -1807,15 +1807,15 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity,
       // may find nothing, or may find a member of an anonymous
       // may find nothing, or may find a member of an anonymous
       // struct/union.
       // struct/union.
       DeclContext::lookup_result Lookup = RT->getDecl()->lookup(FieldName);
       DeclContext::lookup_result Lookup = RT->getDecl()->lookup(FieldName);
-      FieldDecl *ReplacementField = 0;
+      FieldDecl *ReplacementField = nullptr;
       if (Lookup.empty()) {
       if (Lookup.empty()) {
         // Name lookup didn't find anything. Determine whether this
         // Name lookup didn't find anything. Determine whether this
         // was a typo for another field name.
         // was a typo for another field name.
         FieldInitializerValidatorCCC Validator(RT->getDecl());
         FieldInitializerValidatorCCC Validator(RT->getDecl());
         if (TypoCorrection Corrected = SemaRef.CorrectTypo(
         if (TypoCorrection Corrected = SemaRef.CorrectTypo(
                 DeclarationNameInfo(FieldName, D->getFieldLoc()),
                 DeclarationNameInfo(FieldName, D->getFieldLoc()),
-                Sema::LookupMemberName, /*Scope=*/ 0, /*SS=*/ 0, Validator,
-                Sema::CTK_ErrorRecovery, RT->getDecl())) {
+                Sema::LookupMemberName, /*Scope=*/ nullptr, /*SS=*/ nullptr,
+                Validator, Sema::CTK_ErrorRecovery, RT->getDecl())) {
           SemaRef.diagnoseTypo(
           SemaRef.diagnoseTypo(
               Corrected,
               Corrected,
               SemaRef.PDiag(diag::err_field_designator_unknown_suggest)
               SemaRef.PDiag(diag::err_field_designator_unknown_suggest)
@@ -1880,7 +1880,7 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity,
 
 
           // remove existing initializer
           // remove existing initializer
           StructuredList->resizeInits(SemaRef.Context, 0);
           StructuredList->resizeInits(SemaRef.Context, 0);
-          StructuredList->setInitializedFieldInUnion(0);
+          StructuredList->setInitializedFieldInUnion(nullptr);
         }
         }
 
 
         StructuredList->setInitializedFieldInUnion(*Field);
         StructuredList->setInitializedFieldInUnion(*Field);
@@ -1978,7 +1978,7 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity,
       InitializedEntity MemberEntity =
       InitializedEntity MemberEntity =
         InitializedEntity::InitializeMember(*Field, &Entity);
         InitializedEntity::InitializeMember(*Field, &Entity);
       if (CheckDesignatedInitializer(MemberEntity, IList, DIE, DesigIdx + 1,
       if (CheckDesignatedInitializer(MemberEntity, IList, DIE, DesigIdx + 1,
-                                     FieldType, 0, 0, Index,
+                                     FieldType, nullptr, nullptr, Index,
                                      StructuredList, newStructuredIndex,
                                      StructuredList, newStructuredIndex,
                                      true, false))
                                      true, false))
         return true;
         return true;
@@ -2037,7 +2037,7 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity,
     return true;
     return true;
   }
   }
 
 
-  Expr *IndexExpr = 0;
+  Expr *IndexExpr = nullptr;
   llvm::APSInt DesignatedStartIndex, DesignatedEndIndex;
   llvm::APSInt DesignatedStartIndex, DesignatedEndIndex;
   if (D->isArrayDesignator()) {
   if (D->isArrayDesignator()) {
     IndexExpr = DIE->getArrayIndex(*D);
     IndexExpr = DIE->getArrayIndex(*D);
@@ -2122,7 +2122,7 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity,
             Context, CodeUnit, PromotedCharTy, SubExpr->getExprLoc());
             Context, CodeUnit, PromotedCharTy, SubExpr->getExprLoc());
         if (CharTy != PromotedCharTy)
         if (CharTy != PromotedCharTy)
           Init = ImplicitCastExpr::Create(Context, CharTy, CK_IntegralCast,
           Init = ImplicitCastExpr::Create(Context, CharTy, CK_IntegralCast,
-                                          Init, 0, VK_RValue);
+                                          Init, nullptr, VK_RValue);
         StructuredList->updateInit(Context, i, Init);
         StructuredList->updateInit(Context, i, Init);
       }
       }
     } else {
     } else {
@@ -2144,7 +2144,7 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity,
             Context, CodeUnit, PromotedCharTy, SubExpr->getExprLoc());
             Context, CodeUnit, PromotedCharTy, SubExpr->getExprLoc());
         if (CharTy != PromotedCharTy)
         if (CharTy != PromotedCharTy)
           Init = ImplicitCastExpr::Create(Context, CharTy, CK_IntegralCast,
           Init = ImplicitCastExpr::Create(Context, CharTy, CK_IntegralCast,
-                                          Init, 0, VK_RValue);
+                                          Init, nullptr, VK_RValue);
         StructuredList->updateInit(Context, i, Init);
         StructuredList->updateInit(Context, i, Init);
       }
       }
     }
     }
@@ -2174,7 +2174,7 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity,
 
 
     ElementEntity.setElementIndex(ElementIndex);
     ElementEntity.setElementIndex(ElementIndex);
     if (CheckDesignatedInitializer(ElementEntity, IList, DIE, DesigIdx + 1,
     if (CheckDesignatedInitializer(ElementEntity, IList, DIE, DesigIdx + 1,
-                                   ElementType, 0, 0, Index,
+                                   ElementType, nullptr, nullptr, Index,
                                    StructuredList, ElementIndex,
                                    StructuredList, ElementIndex,
                                    (DesignatedStartIndex == DesignatedEndIndex),
                                    (DesignatedStartIndex == DesignatedEndIndex),
                                    false))
                                    false))
@@ -2214,8 +2214,8 @@ InitListChecker::getStructuredSubobjectInit(InitListExpr *IList, unsigned Index,
                                             unsigned StructuredIndex,
                                             unsigned StructuredIndex,
                                             SourceRange InitRange) {
                                             SourceRange InitRange) {
   if (VerifyOnly)
   if (VerifyOnly)
-    return 0; // No structured list in verification-only mode.
-  Expr *ExistingInit = 0;
+    return nullptr; // No structured list in verification-only mode.
+  Expr *ExistingInit = nullptr;
   if (!StructuredList)
   if (!StructuredList)
     ExistingInit = SyntacticToSemantic.lookup(IList);
     ExistingInit = SyntacticToSemantic.lookup(IList);
   else if (StructuredIndex < StructuredList->getNumInits())
   else if (StructuredIndex < StructuredList->getNumInits())
@@ -2477,7 +2477,7 @@ InitializedEntity::InitializeBase(ASTContext &Context,
                                   bool IsInheritedVirtualBase) {
                                   bool IsInheritedVirtualBase) {
   InitializedEntity Result;
   InitializedEntity Result;
   Result.Kind = EK_Base;
   Result.Kind = EK_Base;
-  Result.Parent = 0;
+  Result.Parent = nullptr;
   Result.Base = reinterpret_cast<uintptr_t>(Base);
   Result.Base = reinterpret_cast<uintptr_t>(Base);
   if (IsInheritedVirtualBase)
   if (IsInheritedVirtualBase)
     Result.Base |= 0x01;
     Result.Base |= 0x01;
@@ -2542,7 +2542,7 @@ DeclaratorDecl *InitializedEntity::getDecl() const {
   case EK_LambdaCapture:
   case EK_LambdaCapture:
   case EK_CompoundLiteralInit:
   case EK_CompoundLiteralInit:
   case EK_RelatedResult:
   case EK_RelatedResult:
-    return 0;
+    return nullptr;
   }
   }
 
 
   llvm_unreachable("Invalid EntityKind!");
   llvm_unreachable("Invalid EntityKind!");
@@ -3019,7 +3019,7 @@ ResolveConstructorOverload(Sema &S, SourceLocation DeclLoc,
     bool SuppressUserConversions = false;
     bool SuppressUserConversions = false;
 
 
     // Find the constructor (which may be a template).
     // Find the constructor (which may be a template).
-    CXXConstructorDecl *Constructor = 0;
+    CXXConstructorDecl *Constructor = nullptr;
     FunctionTemplateDecl *ConstructorTmpl = dyn_cast<FunctionTemplateDecl>(D);
     FunctionTemplateDecl *ConstructorTmpl = dyn_cast<FunctionTemplateDecl>(D);
     if (ConstructorTmpl)
     if (ConstructorTmpl)
       Constructor = cast<CXXConstructorDecl>(
       Constructor = cast<CXXConstructorDecl>(
@@ -3050,7 +3050,7 @@ ResolveConstructorOverload(Sema &S, SourceLocation DeclLoc,
         (!OnlyListConstructors || S.isInitListConstructor(Constructor))) {
         (!OnlyListConstructors || S.isInitListConstructor(Constructor))) {
       if (ConstructorTmpl)
       if (ConstructorTmpl)
         S.AddTemplateOverloadCandidate(ConstructorTmpl, FoundDecl,
         S.AddTemplateOverloadCandidate(ConstructorTmpl, FoundDecl,
-                                       /*ExplicitArgs*/ 0, Args,
+                                       /*ExplicitArgs*/ nullptr, Args,
                                        CandidateSet, SuppressUserConversions);
                                        CandidateSet, SuppressUserConversions);
       else {
       else {
         // C++ [over.match.copy]p1:
         // C++ [over.match.copy]p1:
@@ -3236,7 +3236,7 @@ static void TryValueInitialization(Sema &S,
                                    const InitializedEntity &Entity,
                                    const InitializedEntity &Entity,
                                    const InitializationKind &Kind,
                                    const InitializationKind &Kind,
                                    InitializationSequence &Sequence,
                                    InitializationSequence &Sequence,
-                                   InitListExpr *InitList = 0);
+                                   InitListExpr *InitList = nullptr);
 
 
 /// \brief Attempt list initialization of a reference.
 /// \brief Attempt list initialization of a reference.
 static void TryReferenceListInitialization(Sema &S,
 static void TryReferenceListInitialization(Sema &S,
@@ -3435,7 +3435,7 @@ static OverloadingResult TryRefInitWithConversionFunction(Sema &S,
   bool AllowExplicit = Kind.AllowExplicit();
   bool AllowExplicit = Kind.AllowExplicit();
   bool AllowExplicitConvs = Kind.allowExplicitConversionFunctionsInRefBinding();
   bool AllowExplicitConvs = Kind.allowExplicitConversionFunctionsInRefBinding();
 
 
-  const RecordType *T1RecordType = 0;
+  const RecordType *T1RecordType = nullptr;
   if (AllowRValues && (T1RecordType = T1->getAs<RecordType>()) &&
   if (AllowRValues && (T1RecordType = T1->getAs<RecordType>()) &&
       !S.RequireCompleteType(Kind.getLocation(), T1, 0)) {
       !S.RequireCompleteType(Kind.getLocation(), T1, 0)) {
     // The type we're converting to is a class type. Enumerate its constructors
     // The type we're converting to is a class type. Enumerate its constructors
@@ -3453,7 +3453,7 @@ static OverloadingResult TryRefInitWithConversionFunction(Sema &S,
       DeclAccessPair FoundDecl = DeclAccessPair::make(D, D->getAccess());
       DeclAccessPair FoundDecl = DeclAccessPair::make(D, D->getAccess());
 
 
       // Find the constructor (which may be a template).
       // Find the constructor (which may be a template).
-      CXXConstructorDecl *Constructor = 0;
+      CXXConstructorDecl *Constructor = nullptr;
       FunctionTemplateDecl *ConstructorTmpl = dyn_cast<FunctionTemplateDecl>(D);
       FunctionTemplateDecl *ConstructorTmpl = dyn_cast<FunctionTemplateDecl>(D);
       if (ConstructorTmpl)
       if (ConstructorTmpl)
         Constructor = cast<CXXConstructorDecl>(
         Constructor = cast<CXXConstructorDecl>(
@@ -3465,7 +3465,7 @@ static OverloadingResult TryRefInitWithConversionFunction(Sema &S,
           Constructor->isConvertingConstructor(AllowExplicit)) {
           Constructor->isConvertingConstructor(AllowExplicit)) {
         if (ConstructorTmpl)
         if (ConstructorTmpl)
           S.AddTemplateOverloadCandidate(ConstructorTmpl, FoundDecl,
           S.AddTemplateOverloadCandidate(ConstructorTmpl, FoundDecl,
-                                         /*ExplicitArgs*/ 0,
+                                         /*ExplicitArgs*/ nullptr,
                                          Initializer, CandidateSet,
                                          Initializer, CandidateSet,
                                          /*SuppressUserConversions=*/true);
                                          /*SuppressUserConversions=*/true);
         else
         else
@@ -3478,7 +3478,7 @@ static OverloadingResult TryRefInitWithConversionFunction(Sema &S,
   if (T1RecordType && T1RecordType->getDecl()->isInvalidDecl())
   if (T1RecordType && T1RecordType->getDecl()->isInvalidDecl())
     return OR_No_Viable_Function;
     return OR_No_Viable_Function;
 
 
-  const RecordType *T2RecordType = 0;
+  const RecordType *T2RecordType = nullptr;
   if ((T2RecordType = T2->getAs<RecordType>()) &&
   if ((T2RecordType = T2->getAs<RecordType>()) &&
       !S.RequireCompleteType(Kind.getLocation(), T2, 0)) {
       !S.RequireCompleteType(Kind.getLocation(), T2, 0)) {
     // The type we're converting from is a class type, enumerate its conversion
     // The type we're converting from is a class type, enumerate its conversion
@@ -4081,7 +4081,7 @@ static void TryUserDefinedConversion(Sema &S,
         DeclAccessPair FoundDecl = DeclAccessPair::make(D, D->getAccess());
         DeclAccessPair FoundDecl = DeclAccessPair::make(D, D->getAccess());
 
 
         // Find the constructor (which may be a template).
         // Find the constructor (which may be a template).
-        CXXConstructorDecl *Constructor = 0;
+        CXXConstructorDecl *Constructor = nullptr;
         FunctionTemplateDecl *ConstructorTmpl
         FunctionTemplateDecl *ConstructorTmpl
           = dyn_cast<FunctionTemplateDecl>(D);
           = dyn_cast<FunctionTemplateDecl>(D);
         if (ConstructorTmpl)
         if (ConstructorTmpl)
@@ -4094,7 +4094,7 @@ static void TryUserDefinedConversion(Sema &S,
             Constructor->isConvertingConstructor(AllowExplicit)) {
             Constructor->isConvertingConstructor(AllowExplicit)) {
           if (ConstructorTmpl)
           if (ConstructorTmpl)
             S.AddTemplateOverloadCandidate(ConstructorTmpl, FoundDecl,
             S.AddTemplateOverloadCandidate(ConstructorTmpl, FoundDecl,
-                                           /*ExplicitArgs*/ 0,
+                                           /*ExplicitArgs*/ nullptr,
                                            Initializer, CandidateSet,
                                            Initializer, CandidateSet,
                                            /*SuppressUserConversions=*/true);
                                            /*SuppressUserConversions=*/true);
           else
           else
@@ -4454,7 +4454,7 @@ void InitializationSequence::InitializeFrom(Sema &S,
   setSequenceKind(NormalSequence);
   setSequenceKind(NormalSequence);
 
 
   QualType SourceType;
   QualType SourceType;
-  Expr *Initializer = 0;
+  Expr *Initializer = nullptr;
   if (Args.size() == 1) {
   if (Args.size() == 1) {
     Initializer = Args[0];
     Initializer = Args[0];
     if (S.getLangOpts().ObjC1) {
     if (S.getLangOpts().ObjC1) {
@@ -4816,7 +4816,7 @@ static void LookupCopyAndMoveConstructors(Sema &S,
   for (SmallVectorImpl<NamedDecl *>::iterator
   for (SmallVectorImpl<NamedDecl *>::iterator
          CI = Ctors.begin(), CE = Ctors.end(); CI != CE; ++CI) {
          CI = Ctors.begin(), CE = Ctors.end(); CI != CE; ++CI) {
     NamedDecl *D = *CI;
     NamedDecl *D = *CI;
-    CXXConstructorDecl *Constructor = 0;
+    CXXConstructorDecl *Constructor = nullptr;
 
 
     if ((Constructor = dyn_cast<CXXConstructorDecl>(D))) {
     if ((Constructor = dyn_cast<CXXConstructorDecl>(D))) {
       // Handle copy/moveconstructors, only.
       // Handle copy/moveconstructors, only.
@@ -4846,7 +4846,7 @@ static void LookupCopyAndMoveConstructors(Sema &S,
     // candidates?
     // candidates?
     DeclAccessPair FoundDecl
     DeclAccessPair FoundDecl
       = DeclAccessPair::make(ConstructorTmpl, ConstructorTmpl->getAccess());
       = DeclAccessPair::make(ConstructorTmpl, ConstructorTmpl->getAccess());
-    S.AddTemplateOverloadCandidate(ConstructorTmpl, FoundDecl, 0,
+    S.AddTemplateOverloadCandidate(ConstructorTmpl, FoundDecl, nullptr,
                                    CurInitExpr, CandidateSet, true);
                                    CurInitExpr, CandidateSet, true);
   }
   }
 }
 }
@@ -4912,7 +4912,7 @@ static ExprResult CopyObject(Sema &S,
                              bool IsExtraneousCopy) {
                              bool IsExtraneousCopy) {
   // Determine which class type we're copying to.
   // Determine which class type we're copying to.
   Expr *CurInitExpr = (Expr *)CurInit.get();
   Expr *CurInitExpr = (Expr *)CurInit.get();
-  CXXRecordDecl *Class = 0;
+  CXXRecordDecl *Class = nullptr;
   if (const RecordType *Record = T->getAs<RecordType>())
   if (const RecordType *Record = T->getAs<RecordType>())
     Class = cast<CXXRecordDecl>(Record->getDecl());
     Class = cast<CXXRecordDecl>(Record->getDecl());
   if (!Class)
   if (!Class)
@@ -5169,7 +5169,7 @@ PerformConstructorInitialization(Sema &S,
       S.DefineImplicitDefaultConstructor(Loc, Constructor);
       S.DefineImplicitDefaultConstructor(Loc, Constructor);
   }
   }
 
 
-  ExprResult CurInit = S.Owned((Expr *)0);
+  ExprResult CurInit = S.Owned((Expr *)nullptr);
 
 
   // C++ [over.match.copy]p1:
   // C++ [over.match.copy]p1:
   //   - When initializing a temporary to be bound to the first parameter 
   //   - When initializing a temporary to be bound to the first parameter 
@@ -5312,7 +5312,7 @@ InitializedEntityOutlivesFullExpression(const InitializedEntity &Entity) {
 /// the initialization of \p Entity.
 /// the initialization of \p Entity.
 static const InitializedEntity *getEntityForTemporaryLifetimeExtension(
 static const InitializedEntity *getEntityForTemporaryLifetimeExtension(
     const InitializedEntity *Entity,
     const InitializedEntity *Entity,
-    const InitializedEntity *FallbackDecl = 0) {
+    const InitializedEntity *FallbackDecl = nullptr) {
   // C++11 [class.temporary]p5:
   // C++11 [class.temporary]p5:
   switch (Entity->getKind()) {
   switch (Entity->getKind()) {
   case InitializedEntity::EK_Variable:
   case InitializedEntity::EK_Variable:
@@ -5566,7 +5566,7 @@ InitializationSequence::Perform(Sema &S,
 
 
           *ResultType
           *ResultType
             = S.Context.getDependentSizedArrayType(ArrayT->getElementType(),
             = S.Context.getDependentSizedArrayType(ArrayT->getElementType(),
-                                                   /*NumElts=*/0,
+                                                   /*NumElts=*/nullptr,
                                                    ArrayT->getSizeModifier(),
                                                    ArrayT->getSizeModifier(),
                                        ArrayT->getIndexTypeCVRQualifiers(),
                                        ArrayT->getIndexTypeCVRQualifiers(),
                                                    Brackets);
                                                    Brackets);
@@ -5589,7 +5589,7 @@ InitializationSequence::Perform(Sema &S,
 
 
   // No steps means no initialization.
   // No steps means no initialization.
   if (Steps.empty())
   if (Steps.empty())
-    return S.Owned((Expr *)0);
+    return S.Owned((Expr *)nullptr);
 
 
   if (S.getLangOpts().CPlusPlus11 && Entity.getType()->isReferenceType() &&
   if (S.getLangOpts().CPlusPlus11 && Entity.getType()->isReferenceType() &&
       Args.size() == 1 && isa<InitListExpr>(Args[0]) &&
       Args.size() == 1 && isa<InitListExpr>(Args[0]) &&
@@ -5622,7 +5622,7 @@ InitializationSequence::Perform(Sema &S,
     *ResultType = Entity.getDecl() ? Entity.getDecl()->getType() :
     *ResultType = Entity.getDecl() ? Entity.getDecl()->getType() :
                                      Entity.getType();
                                      Entity.getType();
 
 
-  ExprResult CurInit = S.Owned((Expr *)0);
+  ExprResult CurInit = S.Owned((Expr *)nullptr);
 
 
   // For initialization steps that start with a single initializer,
   // For initialization steps that start with a single initializer,
   // grab the only argument out the Args and place it into the "current"
   // grab the only argument out the Args and place it into the "current"
@@ -5737,7 +5737,7 @@ InitializationSequence::Perform(Sema &S,
         S.Diag(Kind.getLocation(), diag::err_reference_bind_to_bitfield)
         S.Diag(Kind.getLocation(), diag::err_reference_bind_to_bitfield)
           << Entity.getType().isVolatileQualified()
           << Entity.getType().isVolatileQualified()
           << (BitField ? BitField->getDeclName() : DeclarationName())
           << (BitField ? BitField->getDeclName() : DeclarationName())
-          << (BitField != NULL)
+          << (BitField != nullptr)
           << CurInit.get()->getSourceRange();
           << CurInit.get()->getSourceRange();
         if (BitField)
         if (BitField)
           S.Diag(BitField->getLocation(), diag::note_bitfield_decl);
           S.Diag(BitField->getLocation(), diag::note_bitfield_decl);
@@ -5861,7 +5861,7 @@ InitializationSequence::Perform(Sema &S,
       } else {
       } else {
         // Build a call to the conversion function.
         // Build a call to the conversion function.
         CXXConversionDecl *Conversion = cast<CXXConversionDecl>(Fn);
         CXXConversionDecl *Conversion = cast<CXXConversionDecl>(Fn);
-        S.CheckMemberOperatorAccess(Kind.getLocation(), CurInit.get(), 0,
+        S.CheckMemberOperatorAccess(Kind.getLocation(), CurInit.get(), nullptr,
                                     FoundFn);
                                     FoundFn);
         if (S.DiagnoseUseOfDecl(FoundFn, Kind.getLocation()))
         if (S.DiagnoseUseOfDecl(FoundFn, Kind.getLocation()))
           return ExprError();
           return ExprError();
@@ -5870,7 +5870,8 @@ InitializationSequence::Perform(Sema &S,
         // derived-to-base conversion? I believe the answer is "no", because
         // derived-to-base conversion? I believe the answer is "no", because
         // we don't want to turn off access control here for c-style casts.
         // we don't want to turn off access control here for c-style casts.
         ExprResult CurInitExprRes =
         ExprResult CurInitExprRes =
-          S.PerformObjectArgumentInitialization(CurInit.take(), /*Qualifier=*/0,
+          S.PerformObjectArgumentInitialization(CurInit.take(),
+                                                /*Qualifier=*/nullptr,
                                                 FoundFn, Conversion);
                                                 FoundFn, Conversion);
         if(CurInitExprRes.isInvalid())
         if(CurInitExprRes.isInvalid())
           return ExprError();
           return ExprError();
@@ -5905,7 +5906,8 @@ InitializationSequence::Perform(Sema &S,
 
 
       CurInit = S.Owned(ImplicitCastExpr::Create(S.Context,
       CurInit = S.Owned(ImplicitCastExpr::Create(S.Context,
                                                  CurInit.get()->getType(),
                                                  CurInit.get()->getType(),
-                                                 CastKind, CurInit.get(), 0,
+                                                 CastKind, CurInit.get(),
+                                                 nullptr,
                                                 CurInit.get()->getValueKind()));
                                                 CurInit.get()->getValueKind()));
       if (MaybeBindToTemp)
       if (MaybeBindToTemp)
         CurInit = S.MaybeBindToTemporary(CurInit.takeAs<Expr>());
         CurInit = S.MaybeBindToTemporary(CurInit.takeAs<Expr>());
@@ -5934,7 +5936,7 @@ InitializationSequence::Perform(Sema &S,
       CurInit = S.Owned(ImplicitCastExpr::Create(S.Context, Step->Type,
       CurInit = S.Owned(ImplicitCastExpr::Create(S.Context, Step->Type,
                                                  CK_LValueToRValue,
                                                  CK_LValueToRValue,
                                                  CurInit.take(),
                                                  CurInit.take(),
-                                                 /*BasePath=*/0,
+                                                 /*BasePath=*/nullptr,
                                                  VK_RValue));
                                                  VK_RValue));
       break;
       break;
     }
     }
@@ -6171,7 +6173,8 @@ InitializationSequence::Perform(Sema &S,
     case SK_ProduceObjCObject:
     case SK_ProduceObjCObject:
       CurInit = S.Owned(ImplicitCastExpr::Create(S.Context, Step->Type,
       CurInit = S.Owned(ImplicitCastExpr::Create(S.Context, Step->Type,
                                                  CK_ARCProduceObject,
                                                  CK_ARCProduceObject,
-                                                 CurInit.take(), 0, VK_RValue));
+                                                 CurInit.take(), nullptr,
+                                                 VK_RValue));
       break;
       break;
 
 
     case SK_StdInitializerList: {
     case SK_StdInitializerList: {
@@ -6977,7 +6980,7 @@ static void DiagnoseNarrowingInInitList(Sema &S,
                                         QualType PreNarrowingType,
                                         QualType PreNarrowingType,
                                         QualType EntityType,
                                         QualType EntityType,
                                         const Expr *PostInit) {
                                         const Expr *PostInit) {
-  const StandardConversionSequence *SCS = 0;
+  const StandardConversionSequence *SCS = nullptr;
   switch (ICS.getKind()) {
   switch (ICS.getKind()) {
   case ImplicitConversionSequence::StandardConversion:
   case ImplicitConversionSequence::StandardConversion:
     SCS = &ICS.Standard;
     SCS = &ICS.Standard;

+ 27 - 26
lib/Sema/SemaLambda.cpp

@@ -316,18 +316,18 @@ Sema::getCurrentMangleNumberContext(const DeclContext *DC,
     if ((IsInNonspecializedTemplate &&
     if ((IsInNonspecializedTemplate &&
          !(ManglingContextDecl && isa<ParmVarDecl>(ManglingContextDecl))) ||
          !(ManglingContextDecl && isa<ParmVarDecl>(ManglingContextDecl))) ||
         isInInlineFunction(CurContext)) {
         isInInlineFunction(CurContext)) {
-      ManglingContextDecl = 0;
+      ManglingContextDecl = nullptr;
       return &Context.getManglingNumberContext(DC);
       return &Context.getManglingNumberContext(DC);
     }
     }
 
 
-    ManglingContextDecl = 0;
-    return 0;
+    ManglingContextDecl = nullptr;
+    return nullptr;
 
 
   case StaticDataMember:
   case StaticDataMember:
     //  -- the initializers of nonspecialized static members of template classes
     //  -- the initializers of nonspecialized static members of template classes
     if (!IsInNonspecializedTemplate) {
     if (!IsInNonspecializedTemplate) {
-      ManglingContextDecl = 0;
-      return 0;
+      ManglingContextDecl = nullptr;
+      return nullptr;
     }
     }
     // Fall through to get the current context.
     // Fall through to get the current context.
 
 
@@ -403,7 +403,7 @@ CXXMethodDecl *Sema::startLambdaDefinition(CXXRecordDecl *Class,
             FunctionTemplateDecl::Create(Context, Class,
             FunctionTemplateDecl::Create(Context, Class,
                                          Method->getLocation(), MethodName, 
                                          Method->getLocation(), MethodName, 
                                          TemplateParams,
                                          TemplateParams,
-                                         Method) : 0;
+                                         Method) : nullptr;
   if (TemplateMethod) {
   if (TemplateMethod) {
     TemplateMethod->setLexicalDeclContext(CurContext);
     TemplateMethod->setLexicalDeclContext(CurContext);
     TemplateMethod->setAccess(AS_public);
     TemplateMethod->setAccess(AS_public);
@@ -504,7 +504,7 @@ static EnumDecl *findEnumForBlockReturn(Expr *E) {
           = dyn_cast<EnumConstantDecl>(DRE->getDecl())) {
           = dyn_cast<EnumConstantDecl>(DRE->getDecl())) {
       return cast<EnumDecl>(D->getDeclContext());
       return cast<EnumDecl>(D->getDeclContext());
     }
     }
-    return 0;
+    return nullptr;
   }
   }
 
 
   //  - it is a comma expression whose RHS is an enumerator-like
   //  - it is a comma expression whose RHS is an enumerator-like
@@ -512,7 +512,7 @@ static EnumDecl *findEnumForBlockReturn(Expr *E) {
   if (BinaryOperator *BO = dyn_cast<BinaryOperator>(E)) {
   if (BinaryOperator *BO = dyn_cast<BinaryOperator>(E)) {
     if (BO->getOpcode() == BO_Comma)
     if (BO->getOpcode() == BO_Comma)
       return findEnumForBlockReturn(BO->getRHS());
       return findEnumForBlockReturn(BO->getRHS());
-    return 0;
+    return nullptr;
   }
   }
 
 
   //  - it is a statement-expression whose value expression is an
   //  - it is a statement-expression whose value expression is an
@@ -520,7 +520,7 @@ static EnumDecl *findEnumForBlockReturn(Expr *E) {
   if (StmtExpr *SE = dyn_cast<StmtExpr>(E)) {
   if (StmtExpr *SE = dyn_cast<StmtExpr>(E)) {
     if (Expr *last = dyn_cast_or_null<Expr>(SE->getSubStmt()->body_back()))
     if (Expr *last = dyn_cast_or_null<Expr>(SE->getSubStmt()->body_back()))
       return findEnumForBlockReturn(last);
       return findEnumForBlockReturn(last);
-    return 0;
+    return nullptr;
   }
   }
 
 
   //   - it is a ternary conditional operator (not the GNU ?:
   //   - it is a ternary conditional operator (not the GNU ?:
@@ -530,7 +530,7 @@ static EnumDecl *findEnumForBlockReturn(Expr *E) {
     if (EnumDecl *ED = findEnumForBlockReturn(CO->getTrueExpr()))
     if (EnumDecl *ED = findEnumForBlockReturn(CO->getTrueExpr()))
       if (ED == findEnumForBlockReturn(CO->getFalseExpr()))
       if (ED == findEnumForBlockReturn(CO->getFalseExpr()))
         return ED;
         return ED;
-    return 0;
+    return nullptr;
   }
   }
 
 
   // (implicitly:)
   // (implicitly:)
@@ -551,7 +551,7 @@ static EnumDecl *findEnumForBlockReturn(Expr *E) {
   }
   }
 
 
   // Otherwise, nope.
   // Otherwise, nope.
-  return 0;
+  return nullptr;
 }
 }
 
 
 /// Attempt to find a type T for which the returned expression of the
 /// Attempt to find a type T for which the returned expression of the
@@ -559,7 +559,7 @@ static EnumDecl *findEnumForBlockReturn(Expr *E) {
 static EnumDecl *findEnumForBlockReturn(ReturnStmt *ret) {
 static EnumDecl *findEnumForBlockReturn(ReturnStmt *ret) {
   if (Expr *retValue = ret->getRetValue())
   if (Expr *retValue = ret->getRetValue())
     return findEnumForBlockReturn(retValue);
     return findEnumForBlockReturn(retValue);
-  return 0;
+  return nullptr;
 }
 }
 
 
 /// Attempt to find a common type T for which all of the returned
 /// Attempt to find a common type T for which all of the returned
@@ -570,16 +570,16 @@ static EnumDecl *findCommonEnumForBlockReturns(ArrayRef<ReturnStmt*> returns) {
 
 
   // Try to find one for the first return.
   // Try to find one for the first return.
   EnumDecl *ED = findEnumForBlockReturn(*i);
   EnumDecl *ED = findEnumForBlockReturn(*i);
-  if (!ED) return 0;
+  if (!ED) return nullptr;
 
 
   // Check that the rest of the returns have the same enum.
   // Check that the rest of the returns have the same enum.
   for (++i; i != e; ++i) {
   for (++i; i != e; ++i) {
     if (findEnumForBlockReturn(*i) != ED)
     if (findEnumForBlockReturn(*i) != ED)
-      return 0;
+      return nullptr;
   }
   }
 
 
   // Never infer an anonymous enum type.
   // Never infer an anonymous enum type.
-  if (!ED->hasNameForLinkage()) return 0;
+  if (!ED->hasNameForLinkage()) return nullptr;
 
 
   return ED;
   return ED;
 }
 }
@@ -603,7 +603,7 @@ static void adjustBlockReturnsToEnum(Sema &S, ArrayRef<ReturnStmt*> returns,
 
 
     Expr *E = (cleanups ? cleanups->getSubExpr() : retValue);
     Expr *E = (cleanups ? cleanups->getSubExpr() : retValue);
     E = ImplicitCastExpr::Create(S.Context, returnType, CK_IntegralCast,
     E = ImplicitCastExpr::Create(S.Context, returnType, CK_IntegralCast,
-                                 E, /*base path*/ 0, VK_RValue);
+                                 E, /*base path*/ nullptr, VK_RValue);
     if (cleanups) {
     if (cleanups) {
       cleanups->setSubExpr(E);
       cleanups->setSubExpr(E);
     } else {
     } else {
@@ -819,7 +819,8 @@ VarDecl *Sema::createLambdaInitCaptureVarDecl(SourceLocation Loc,
 FieldDecl *Sema::buildInitCaptureField(LambdaScopeInfo *LSI, VarDecl *Var) {
 FieldDecl *Sema::buildInitCaptureField(LambdaScopeInfo *LSI, VarDecl *Var) {
   FieldDecl *Field = FieldDecl::Create(
   FieldDecl *Field = FieldDecl::Create(
       Context, LSI->Lambda, Var->getLocation(), Var->getLocation(),
       Context, LSI->Lambda, Var->getLocation(), Var->getLocation(),
-      0, Var->getType(), Var->getTypeSourceInfo(), 0, false, ICIS_NoInit);
+      nullptr, Var->getType(), Var->getTypeSourceInfo(), nullptr, false,
+      ICIS_NoInit);
   Field->setImplicit(true);
   Field->setImplicit(true);
   Field->setAccess(AS_private);
   Field->setAccess(AS_private);
   LSI->Lambda->addDecl(Field);
   LSI->Lambda->addDecl(Field);
@@ -845,7 +846,7 @@ void Sema::ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro,
     // has template params, only then are we in a dependent scope.
     // has template params, only then are we in a dependent scope.
     if (TemplateParams)  {
     if (TemplateParams)  {
       TmplScope = TmplScope->getParent();
       TmplScope = TmplScope->getParent();
-      TmplScope = TmplScope ? TmplScope->getTemplateParamParent() : 0;
+      TmplScope = TmplScope ? TmplScope->getTemplateParamParent() : nullptr;
     }
     }
     if (TmplScope && !TmplScope->decl_empty())
     if (TmplScope && !TmplScope->decl_empty())
       KnownDependent = true;
       KnownDependent = true;
@@ -996,7 +997,7 @@ void Sema::ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro,
     if (C->Init.isInvalid())
     if (C->Init.isInvalid())
       continue;
       continue;
 
 
-    VarDecl *Var = 0;
+    VarDecl *Var = nullptr;
     if (C->Init.isUsable()) {
     if (C->Init.isUsable()) {
       Diag(C->Loc, getLangOpts().CPlusPlus1y
       Diag(C->Loc, getLangOpts().CPlusPlus1y
                        ? diag::warn_cxx11_compat_init_capture
                        ? diag::warn_cxx11_compat_init_capture
@@ -1145,8 +1146,8 @@ void Sema::ActOnLambdaError(SourceLocation StartLoc, Scope *CurScope,
   CXXRecordDecl *Class = LSI->Lambda;
   CXXRecordDecl *Class = LSI->Lambda;
   Class->setInvalidDecl();
   Class->setInvalidDecl();
   SmallVector<Decl*, 4> Fields(Class->fields());
   SmallVector<Decl*, 4> Fields(Class->fields());
-  ActOnFields(0, Class->getLocation(), Class, Fields, SourceLocation(),
-              SourceLocation(), 0);
+  ActOnFields(nullptr, Class->getLocation(), Class, Fields, SourceLocation(),
+              SourceLocation(), nullptr);
   CheckCompletedCXXClass(Class);
   CheckCompletedCXXClass(Class);
 
 
   PopFunctionScopeInfo();
   PopFunctionScopeInfo();
@@ -1253,7 +1254,7 @@ static void addFunctionPointerConversion(Sema &S,
                                              From->getType(),
                                              From->getType(),
                                              From->getTypeSourceInfo(),
                                              From->getTypeSourceInfo(),
                                              From->getStorageClass(),
                                              From->getStorageClass(),
-                                             /*DefaultArg=*/0));
+                                             /*DefaultArg=*/nullptr));
     CallOpConvTL.setParam(I, From);
     CallOpConvTL.setParam(I, From);
     CallOpConvNameTL.setParam(I, From);
     CallOpConvNameTL.setParam(I, From);
   }
   }
@@ -1504,8 +1505,8 @@ ExprResult Sema::ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body,
     
     
     // Finalize the lambda class.
     // Finalize the lambda class.
     SmallVector<Decl*, 4> Fields(Class->fields());
     SmallVector<Decl*, 4> Fields(Class->fields());
-    ActOnFields(0, Class->getLocation(), Class, Fields, SourceLocation(),
-                SourceLocation(), 0);
+    ActOnFields(nullptr, Class->getLocation(), Class, Fields, SourceLocation(),
+                SourceLocation(), nullptr);
     CheckCompletedCXXClass(Class);
     CheckCompletedCXXClass(Class);
   }
   }
 
 
@@ -1595,7 +1596,7 @@ ExprResult Sema::BuildBlockForLambdaConversion(SourceLocation CurrentLocation,
                                               From->getType(),
                                               From->getType(),
                                               From->getTypeSourceInfo(),
                                               From->getTypeSourceInfo(),
                                               From->getStorageClass(),
                                               From->getStorageClass(),
-                                              /*DefaultArg=*/0));
+                                              /*DefaultArg=*/nullptr));
   }
   }
   Block->setParams(BlockParams);
   Block->setParams(BlockParams);
 
 
@@ -1607,7 +1608,7 @@ ExprResult Sema::BuildBlockForLambdaConversion(SourceLocation CurrentLocation,
   TypeSourceInfo *CapVarTSI =
   TypeSourceInfo *CapVarTSI =
       Context.getTrivialTypeSourceInfo(Src->getType());
       Context.getTrivialTypeSourceInfo(Src->getType());
   VarDecl *CapVar = VarDecl::Create(Context, Block, ConvLocation,
   VarDecl *CapVar = VarDecl::Create(Context, Block, ConvLocation,
-                                    ConvLocation, 0,
+                                    ConvLocation, nullptr,
                                     Src->getType(), CapVarTSI,
                                     Src->getType(), CapVarTSI,
                                     SC_None);
                                     SC_None);
   BlockDecl::Capture Capture(/*Variable=*/CapVar, /*ByRef=*/false,
   BlockDecl::Capture Capture(/*Variable=*/CapVar, /*ByRef=*/false,

+ 45 - 44
lib/Sema/SemaLookup.cpp

@@ -324,9 +324,9 @@ bool LookupResult::sanity() const {
   assert(ResultKind != Ambiguous || Decls.size() > 1 ||
   assert(ResultKind != Ambiguous || Decls.size() > 1 ||
          (Decls.size() == 1 && (Ambiguity == AmbiguousBaseSubobjects ||
          (Decls.size() == 1 && (Ambiguity == AmbiguousBaseSubobjects ||
                                 Ambiguity == AmbiguousBaseSubobjectTypes)));
                                 Ambiguity == AmbiguousBaseSubobjectTypes)));
-  assert((Paths != NULL) == (ResultKind == Ambiguous &&
-                             (Ambiguity == AmbiguousBaseSubobjectTypes ||
-                              Ambiguity == AmbiguousBaseSubobjects)));
+  assert((Paths != nullptr) == (ResultKind == Ambiguous &&
+                                (Ambiguity == AmbiguousBaseSubobjectTypes ||
+                                 Ambiguity == AmbiguousBaseSubobjects)));
   return true;
   return true;
 }
 }
 
 
@@ -724,7 +724,7 @@ static bool LookupDirect(Sema &S, LookupResult &R, const DeclContext *DC) {
     // specialization into the result set. We do this to avoid forcing all
     // specialization into the result set. We do this to avoid forcing all
     // callers to perform special deduction for conversion functions.
     // callers to perform special deduction for conversion functions.
     TemplateDeductionInfo Info(R.getNameLoc());
     TemplateDeductionInfo Info(R.getNameLoc());
-    FunctionDecl *Specialization = 0;
+    FunctionDecl *Specialization = nullptr;
 
 
     const FunctionProtoType *ConvProto
     const FunctionProtoType *ConvProto
       = ConvTemplate->getTemplatedDecl()->getType()->getAs<FunctionProtoType>();
       = ConvTemplate->getTemplatedDecl()->getType()->getAs<FunctionProtoType>();
@@ -743,7 +743,7 @@ static bool LookupDirect(Sema &S, LookupResult &R, const DeclContext *DC) {
 
 
     // Perform template argument deduction against the type that we would
     // Perform template argument deduction against the type that we would
     // expect the function to have.
     // expect the function to have.
-    if (R.getSema().DeduceTemplateArguments(ConvTemplate, 0, ExpectedType,
+    if (R.getSema().DeduceTemplateArguments(ConvTemplate, nullptr, ExpectedType,
                                             Specialization, Info)
                                             Specialization, Info)
           == Sema::TDK_Success) {
           == Sema::TDK_Success) {
       R.addDecl(Specialization);
       R.addDecl(Specialization);
@@ -793,7 +793,7 @@ static bool isNamespaceOrTranslationUnitScope(Scope *S) {
 // it leaves the current template parameter scope.
 // it leaves the current template parameter scope.
 static std::pair<DeclContext *, bool> findOuterContext(Scope *S) {
 static std::pair<DeclContext *, bool> findOuterContext(Scope *S) {
   DeclContext *DC = S->getEntity();
   DeclContext *DC = S->getEntity();
-  DeclContext *Lexical = 0;
+  DeclContext *Lexical = nullptr;
   for (Scope *OuterS = S->getParent(); OuterS;
   for (Scope *OuterS = S->getParent(); OuterS;
        OuterS = OuterS->getParent()) {
        OuterS = OuterS->getParent()) {
     if (OuterS->getEntity()) {
     if (OuterS->getEntity()) {
@@ -916,7 +916,7 @@ bool Sema::CppLookupName(LookupResult &R, Scope *S) {
   UnqualUsingDirectiveSet UDirs;
   UnqualUsingDirectiveSet UDirs;
   bool VisitedUsingDirectives = false;
   bool VisitedUsingDirectives = false;
   bool LeftStartingScope = false;
   bool LeftStartingScope = false;
-  DeclContext *OutsideOfTemplateParamDC = 0;
+  DeclContext *OutsideOfTemplateParamDC = nullptr;
 
 
   // When performing a scope lookup, we want to find local extern decls.
   // When performing a scope lookup, we want to find local extern decls.
   FindLocalExternScope FindLocals(R);
   FindLocalExternScope FindLocals(R);
@@ -973,7 +973,7 @@ bool Sema::CppLookupName(LookupResult &R, Scope *S) {
       // findOuterContext(). This implements the name lookup behavior
       // findOuterContext(). This implements the name lookup behavior
       // of C++ [temp.local]p8.
       // of C++ [temp.local]p8.
       Ctx = OutsideOfTemplateParamDC;
       Ctx = OutsideOfTemplateParamDC;
-      OutsideOfTemplateParamDC = 0;
+      OutsideOfTemplateParamDC = nullptr;
     }
     }
 
 
     if (Ctx) {
     if (Ctx) {
@@ -1116,7 +1116,7 @@ bool Sema::CppLookupName(LookupResult &R, Scope *S) {
       // findOuterContext(). This implements the name lookup behavior
       // findOuterContext(). This implements the name lookup behavior
       // of C++ [temp.local]p8.
       // of C++ [temp.local]p8.
       Ctx = OutsideOfTemplateParamDC;
       Ctx = OutsideOfTemplateParamDC;
-      OutsideOfTemplateParamDC = 0;
+      OutsideOfTemplateParamDC = nullptr;
     }
     }
 
 
     if (Ctx) {
     if (Ctx) {
@@ -1214,7 +1214,7 @@ llvm::DenseSet<Module*> &Sema::getLookupModules() {
        I != N; ++I) {
        I != N; ++I) {
     Module *M = getDefiningModule(ActiveTemplateInstantiations[I].Entity);
     Module *M = getDefiningModule(ActiveTemplateInstantiations[I].Entity);
     if (M && !LookupModulesCache.insert(M).second)
     if (M && !LookupModulesCache.insert(M).second)
-      M = 0;
+      M = nullptr;
     ActiveTemplateInstantiationLookupModules.push_back(M);
     ActiveTemplateInstantiationLookupModules.push_back(M);
   }
   }
   return LookupModulesCache;
   return LookupModulesCache;
@@ -1275,7 +1275,7 @@ static NamedDecl *findAcceptableDecl(Sema &SemaRef, NamedDecl *D) {
     }
     }
   }
   }
 
 
-  return 0;
+  return nullptr;
 }
 }
 
 
 NamedDecl *LookupResult::getAcceptableDeclSlow(NamedDecl *D) const {
 NamedDecl *LookupResult::getAcceptableDeclSlow(NamedDecl *D) const {
@@ -1370,10 +1370,10 @@ bool Sema::LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation) {
           // then we'll need to perform our checks based on the matching
           // then we'll need to perform our checks based on the matching
           // DeclContexts rather than matching scopes.
           // DeclContexts rather than matching scopes.
           if (S && isNamespaceOrTranslationUnitScope(S))
           if (S && isNamespaceOrTranslationUnitScope(S))
-            S = 0;
+            S = nullptr;
 
 
           // Compute the DeclContext, if we need it.
           // Compute the DeclContext, if we need it.
-          DeclContext *DC = 0;
+          DeclContext *DC = nullptr;
           if (!S)
           if (!S)
             DC = (*I)->getDeclContext()->getRedeclContext();
             DC = (*I)->getDeclContext()->getRedeclContext();
             
             
@@ -1654,7 +1654,7 @@ bool Sema::LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
   Paths.setOrigin(LookupRec);
   Paths.setOrigin(LookupRec);
 
 
   // Look for this member in our base classes
   // Look for this member in our base classes
-  CXXRecordDecl::BaseMatchesCallback *BaseCallback = 0;
+  CXXRecordDecl::BaseMatchesCallback *BaseCallback = nullptr;
   switch (R.getLookupKind()) {
   switch (R.getLookupKind()) {
     case LookupObjCImplicitSelfParam:
     case LookupObjCImplicitSelfParam:
     case LookupOrdinaryName:
     case LookupOrdinaryName:
@@ -2401,7 +2401,7 @@ Sema::SpecialMemberOverloadResult *Sema::LookupSpecialMember(CXXRecordDecl *RD,
   // if necessary and make sure that implicit functions are declared.
   // if necessary and make sure that implicit functions are declared.
   CanQualType CanTy = Context.getCanonicalType(Context.getTagDeclType(RD));
   CanQualType CanTy = Context.getCanonicalType(Context.getTagDeclType(RD));
   DeclarationName Name;
   DeclarationName Name;
-  Expr *Arg = 0;
+  Expr *Arg = nullptr;
   unsigned NumArgs;
   unsigned NumArgs;
 
 
   QualType ArgType = CanTy;
   QualType ArgType = CanTy;
@@ -2505,12 +2505,12 @@ Sema::SpecialMemberOverloadResult *Sema::LookupSpecialMember(CXXRecordDecl *RD,
                  dyn_cast<FunctionTemplateDecl>(Cand)) {
                  dyn_cast<FunctionTemplateDecl>(Cand)) {
       if (SM == CXXCopyAssignment || SM == CXXMoveAssignment)
       if (SM == CXXCopyAssignment || SM == CXXMoveAssignment)
         AddMethodTemplateCandidate(Tmpl, DeclAccessPair::make(Tmpl, AS_public),
         AddMethodTemplateCandidate(Tmpl, DeclAccessPair::make(Tmpl, AS_public),
-                                   RD, 0, ThisTy, Classification,
+                                   RD, nullptr, ThisTy, Classification,
                                    llvm::makeArrayRef(&Arg, NumArgs),
                                    llvm::makeArrayRef(&Arg, NumArgs),
                                    OCS, true);
                                    OCS, true);
       else
       else
         AddTemplateOverloadCandidate(Tmpl, DeclAccessPair::make(Tmpl, AS_public),
         AddTemplateOverloadCandidate(Tmpl, DeclAccessPair::make(Tmpl, AS_public),
-                                     0, llvm::makeArrayRef(&Arg, NumArgs),
+                                     nullptr, llvm::makeArrayRef(&Arg, NumArgs),
                                      OCS, true);
                                      OCS, true);
     } else {
     } else {
       assert(isa<UsingDecl>(Cand) && "illegal Kind of operator = Decl");
       assert(isa<UsingDecl>(Cand) && "illegal Kind of operator = Decl");
@@ -2530,12 +2530,12 @@ Sema::SpecialMemberOverloadResult *Sema::LookupSpecialMember(CXXRecordDecl *RD,
       break;
       break;
 
 
     case OR_Ambiguous:
     case OR_Ambiguous:
-      Result->setMethod(0);
+      Result->setMethod(nullptr);
       Result->setKind(SpecialMemberOverloadResult::Ambiguous);
       Result->setKind(SpecialMemberOverloadResult::Ambiguous);
       break;
       break;
 
 
     case OR_No_Viable_Function:
     case OR_No_Viable_Function:
-      Result->setMethod(0);
+      Result->setMethod(nullptr);
       Result->setKind(SpecialMemberOverloadResult::NoMemberOrDeleted);
       Result->setKind(SpecialMemberOverloadResult::NoMemberOrDeleted);
       break;
       break;
   }
   }
@@ -2759,7 +2759,7 @@ void ADLResult::insert(NamedDecl *New) {
 
 
   // If we haven't yet seen a decl for this key, or the last decl
   // If we haven't yet seen a decl for this key, or the last decl
   // was exactly this one, we're done.
   // was exactly this one, we're done.
-  if (Old == 0 || Old == New) {
+  if (Old == nullptr || Old == New) {
     Old = New;
     Old = New;
     return;
     return;
   }
   }
@@ -2968,7 +2968,7 @@ NamedDecl *VisibleDeclsRecord::checkHidden(NamedDecl *ND) {
     }
     }
   }
   }
 
 
-  return 0;
+  return nullptr;
 }
 }
 
 
 static void LookupVisibleDecls(DeclContext *Ctx, LookupResult &Result,
 static void LookupVisibleDecls(DeclContext *Ctx, LookupResult &Result,
@@ -3118,14 +3118,14 @@ static void LookupVisibleDecls(Scope *S, LookupResult &Result,
     for (auto *D : S->decls()) {
     for (auto *D : S->decls()) {
       if (NamedDecl *ND = dyn_cast<NamedDecl>(D))
       if (NamedDecl *ND = dyn_cast<NamedDecl>(D))
         if ((ND = Result.getAcceptableDecl(ND))) {
         if ((ND = Result.getAcceptableDecl(ND))) {
-          Consumer.FoundDecl(ND, Visited.checkHidden(ND), 0, false);
+          Consumer.FoundDecl(ND, Visited.checkHidden(ND), nullptr, false);
           Visited.add(ND);
           Visited.add(ND);
         }
         }
     }
     }
   }
   }
 
 
   // FIXME: C++ [temp.local]p8
   // FIXME: C++ [temp.local]p8
-  DeclContext *Entity = 0;
+  DeclContext *Entity = nullptr;
   if (S->getEntity()) {
   if (S->getEntity()) {
     // Look into this scope's declaration context, along with any of its
     // Look into this scope's declaration context, along with any of its
     // parent lookup contexts (e.g., enclosing classes), up to the point
     // parent lookup contexts (e.g., enclosing classes), up to the point
@@ -3235,7 +3235,7 @@ void Sema::LookupVisibleDecls(DeclContext *Ctx, LookupNameKind Kind,
 LabelDecl *Sema::LookupOrCreateLabel(IdentifierInfo *II, SourceLocation Loc,
 LabelDecl *Sema::LookupOrCreateLabel(IdentifierInfo *II, SourceLocation Loc,
                                      SourceLocation GnuLabelLoc) {
                                      SourceLocation GnuLabelLoc) {
   // Do a lookup to see if we have a label with this name already.
   // Do a lookup to see if we have a label with this name already.
-  NamedDecl *Res = 0;
+  NamedDecl *Res = nullptr;
 
 
   if (GnuLabelLoc.isValid()) {
   if (GnuLabelLoc.isValid()) {
     // Local label definitions always shadow existing labels.
     // Local label definitions always shadow existing labels.
@@ -3250,8 +3250,8 @@ LabelDecl *Sema::LookupOrCreateLabel(IdentifierInfo *II, SourceLocation Loc,
   // If we found a label, check to see if it is in the same context as us.
   // If we found a label, check to see if it is in the same context as us.
   // When in a Block, we don't want to reuse a label in an enclosing function.
   // When in a Block, we don't want to reuse a label in an enclosing function.
   if (Res && Res->getDeclContext() != CurContext)
   if (Res && Res->getDeclContext() != CurContext)
-    Res = 0;
-  if (Res == 0) {
+    Res = nullptr;
+  if (!Res) {
     // If not forward referenced or defined already, create the backing decl.
     // If not forward referenced or defined already, create the backing decl.
     Res = LabelDecl::Create(Context, CurContext, Loc, II);
     Res = LabelDecl::Create(Context, CurContext, Loc, II);
     Scope *S = CurScope->getFnParent();
     Scope *S = CurScope->getFnParent();
@@ -3297,8 +3297,8 @@ public:
                  bool InBaseClass) override;
                  bool InBaseClass) override;
   void FoundName(StringRef Name);
   void FoundName(StringRef Name);
   void addKeywordResult(StringRef Keyword);
   void addKeywordResult(StringRef Keyword);
-  void addName(StringRef Name, NamedDecl *ND, NestedNameSpecifier *NNS = NULL,
-               bool isKeyword = false);
+  void addName(StringRef Name, NamedDecl *ND,
+               NestedNameSpecifier *NNS = nullptr, bool isKeyword = false);
   void addCorrection(TypoCorrection Correction);
   void addCorrection(TypoCorrection Correction);
 
 
   typedef TypoResultsMap::iterator result_iterator;
   typedef TypoResultsMap::iterator result_iterator;
@@ -3354,13 +3354,13 @@ void TypoCorrectionConsumer::FoundDecl(NamedDecl *ND, NamedDecl *Hiding,
 void TypoCorrectionConsumer::FoundName(StringRef Name) {
 void TypoCorrectionConsumer::FoundName(StringRef Name) {
   // Compute the edit distance between the typo and the name of this
   // Compute the edit distance between the typo and the name of this
   // entity, and add the identifier to the list of results.
   // entity, and add the identifier to the list of results.
-  addName(Name, NULL);
+  addName(Name, nullptr);
 }
 }
 
 
 void TypoCorrectionConsumer::addKeywordResult(StringRef Keyword) {
 void TypoCorrectionConsumer::addKeywordResult(StringRef Keyword) {
   // Compute the edit distance between the typo and this keyword,
   // Compute the edit distance between the typo and this keyword,
   // and add the keyword to the list of results.
   // and add the keyword to the list of results.
-  addName(Keyword, NULL, NULL, true);
+  addName(Keyword, nullptr, nullptr, true);
 }
 }
 
 
 void TypoCorrectionConsumer::addName(StringRef Name, NamedDecl *ND,
 void TypoCorrectionConsumer::addName(StringRef Name, NamedDecl *ND,
@@ -3422,7 +3422,7 @@ static void getNestedNameSpecifierIdentifiers(
   else
   else
     Identifiers.clear();
     Identifiers.clear();
 
 
-  const IdentifierInfo *II = NULL;
+  const IdentifierInfo *II = nullptr;
 
 
   switch (NNS->getKind()) {
   switch (NNS->getKind()) {
   case NestedNameSpecifier::Identifier:
   case NestedNameSpecifier::Identifier:
@@ -3491,7 +3491,7 @@ class NamespaceSpecifierSet {
       : Context(Context), CurContextChain(BuildContextChain(CurContext)),
       : Context(Context), CurContextChain(BuildContextChain(CurContext)),
         isSorted(false) {
         isSorted(false) {
     if (NestedNameSpecifier *NNS =
     if (NestedNameSpecifier *NNS =
-            CurScopeSpec ? CurScopeSpec->getScopeRep() : 0) {
+            CurScopeSpec ? CurScopeSpec->getScopeRep() : nullptr) {
       llvm::raw_string_ostream SpecifierOStream(CurNameSpecifier);
       llvm::raw_string_ostream SpecifierOStream(CurNameSpecifier);
       NNS->print(SpecifierOStream, Context.getPrintingPolicy());
       NNS->print(SpecifierOStream, Context.getPrintingPolicy());
 
 
@@ -3531,7 +3531,7 @@ class NamespaceSpecifierSet {
 DeclContextList NamespaceSpecifierSet::BuildContextChain(DeclContext *Start) {
 DeclContextList NamespaceSpecifierSet::BuildContextChain(DeclContext *Start) {
   assert(Start && "Building a context chain from a null context");
   assert(Start && "Building a context chain from a null context");
   DeclContextList Chain;
   DeclContextList Chain;
-  for (DeclContext *DC = Start->getPrimaryContext(); DC != NULL;
+  for (DeclContext *DC = Start->getPrimaryContext(); DC != nullptr;
        DC = DC->getLookupParent()) {
        DC = DC->getLookupParent()) {
     NamespaceDecl *ND = dyn_cast_or_null<NamespaceDecl>(DC);
     NamespaceDecl *ND = dyn_cast_or_null<NamespaceDecl>(DC);
     if (!DC->isInlineNamespace() && !DC->isTransparentContext() &&
     if (!DC->isInlineNamespace() && !DC->isTransparentContext() &&
@@ -3579,7 +3579,7 @@ static unsigned BuildNestedNameSpecifier(ASTContext &Context,
 }
 }
 
 
 void NamespaceSpecifierSet::AddNameSpecifier(DeclContext *Ctx) {
 void NamespaceSpecifierSet::AddNameSpecifier(DeclContext *Ctx) {
-  NestedNameSpecifier *NNS = NULL;
+  NestedNameSpecifier *NNS = nullptr;
   unsigned NumSpecifiers = 0;
   unsigned NumSpecifiers = 0;
   DeclContextList NamespaceDeclChain(BuildContextChain(Ctx));
   DeclContextList NamespaceDeclChain(BuildContextChain(Ctx));
   DeclContextList FullNamespaceDeclChain(NamespaceDeclChain);
   DeclContextList FullNamespaceDeclChain(NamespaceDeclChain);
@@ -4121,7 +4121,7 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName,
 
 
     bool SSIsTemplate = false;
     bool SSIsTemplate = false;
     if (NestedNameSpecifier *NNS =
     if (NestedNameSpecifier *NNS =
-            (SS && SS->isValid()) ? SS->getScopeRep() : 0) {
+            (SS && SS->isValid()) ? SS->getScopeRep() : nullptr) {
       if (const Type *T = NNS->getAsType())
       if (const Type *T = NNS->getAsType())
         SSIsTemplate = T->getTypeClass() == Type::TemplateSpecialization;
         SSIsTemplate = T->getTypeClass() == Type::TemplateSpecialization;
     }
     }
@@ -4203,14 +4203,14 @@ retry_lookup:
       case LookupResult::FoundUnresolvedValue:
       case LookupResult::FoundUnresolvedValue:
         if (TempSS) {
         if (TempSS) {
           // Immediately retry the lookup without the given CXXScopeSpec
           // Immediately retry the lookup without the given CXXScopeSpec
-          TempSS = NULL;
+          TempSS = nullptr;
           Candidate.WillReplaceSpecifier(true);
           Candidate.WillReplaceSpecifier(true);
           goto retry_lookup;
           goto retry_lookup;
         }
         }
         if (TempMemberContext) {
         if (TempMemberContext) {
           if (SS && !TempSS)
           if (SS && !TempSS)
             TempSS = SS;
             TempSS = SS;
-          TempMemberContext = NULL;
+          TempMemberContext = nullptr;
           goto retry_lookup;
           goto retry_lookup;
         }
         }
         QualifiedResults.push_back(Candidate);
         QualifiedResults.push_back(Candidate);
@@ -4274,7 +4274,7 @@ retry_lookup:
           // it as it is unlikely a qualified version of the class' constructor
           // it as it is unlikely a qualified version of the class' constructor
           // is an appropriate correction.
           // is an appropriate correction.
           if (CXXRecordDecl *NSDecl =
           if (CXXRecordDecl *NSDecl =
-                  NSType ? NSType->getAsCXXRecordDecl() : 0) {
+                  NSType ? NSType->getAsCXXRecordDecl() : nullptr) {
             if (NSDecl->getIdentifier() == QR.getCorrectionAsIdentifierInfo())
             if (NSDecl->getIdentifier() == QR.getCorrectionAsIdentifierInfo())
               continue;
               continue;
           }
           }
@@ -4318,7 +4318,8 @@ retry_lookup:
                                      TRDEnd = TmpRes.end();
                                      TRDEnd = TmpRes.end();
                  TRD != TRDEnd; ++TRD) {
                  TRD != TRDEnd; ++TRD) {
               if (CheckMemberAccess(TC.getCorrectionRange().getBegin(),
               if (CheckMemberAccess(TC.getCorrectionRange().getBegin(),
-                                    NSType ? NSType->getAsCXXRecordDecl() : 0,
+                                    NSType ? NSType->getAsCXXRecordDecl()
+                                           : nullptr,
                                     TRD.getPair()) == AR_accessible)
                                     TRD.getPair()) == AR_accessible)
                 TC.addCorrectionDecl(*TRD);
                 TC.addCorrectionDecl(*TRD);
             }
             }
@@ -4465,7 +4466,7 @@ bool FunctionCallFilterCCC::ValidateCandidate(const TypoCorrection &candidate) {
   for (TypoCorrection::const_decl_iterator DI = candidate.begin(),
   for (TypoCorrection::const_decl_iterator DI = candidate.begin(),
                                            DIEnd = candidate.end();
                                            DIEnd = candidate.end();
        DI != DIEnd; ++DI) {
        DI != DIEnd; ++DI) {
-    FunctionDecl *FD = 0;
+    FunctionDecl *FD = nullptr;
     NamedDecl *ND = (*DI)->getUnderlyingDecl();
     NamedDecl *ND = (*DI)->getUnderlyingDecl();
     if (FunctionTemplateDecl *FTD = dyn_cast<FunctionTemplateDecl>(ND))
     if (FunctionTemplateDecl *FTD = dyn_cast<FunctionTemplateDecl>(ND))
       FD = FTD->getTemplatedDecl();
       FD = FTD->getTemplatedDecl();
@@ -4500,7 +4501,7 @@ bool FunctionCallFilterCCC::ValidateCandidate(const TypoCorrection &candidate) {
                 ? dyn_cast_or_null<CXXMethodDecl>(MemberFn->getMemberDecl())
                 ? dyn_cast_or_null<CXXMethodDecl>(MemberFn->getMemberDecl())
                 : dyn_cast_or_null<CXXMethodDecl>(CurContext);
                 : dyn_cast_or_null<CXXMethodDecl>(CurContext);
         CXXRecordDecl *CurRD =
         CXXRecordDecl *CurRD =
-            CurMD ? CurMD->getParent()->getCanonicalDecl() : 0;
+            CurMD ? CurMD->getParent()->getCanonicalDecl() : nullptr;
         CXXRecordDecl *RD = MD->getParent()->getCanonicalDecl();
         CXXRecordDecl *RD = MD->getParent()->getCanonicalDecl();
         if (!CurRD || (CurRD != RD && !CurRD->isDerivedFrom(RD)))
         if (!CurRD || (CurRD != RD && !CurRD->isDerivedFrom(RD)))
           continue;
           continue;
@@ -4524,7 +4525,7 @@ static const NamedDecl *getDefinitionToImport(const NamedDecl *D) {
   if (const VarDecl *VD = dyn_cast<VarDecl>(D))
   if (const VarDecl *VD = dyn_cast<VarDecl>(D))
     return VD->getDefinition();
     return VD->getDefinition();
   if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D))
   if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D))
-    return FD->isDefined(FD) ? FD : 0;
+    return FD->isDefined(FD) ? FD : nullptr;
   if (const TagDecl *TD = dyn_cast<TagDecl>(D))
   if (const TagDecl *TD = dyn_cast<TagDecl>(D))
     return TD->getDefinition();
     return TD->getDefinition();
   if (const ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(D))
   if (const ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(D))
@@ -4533,7 +4534,7 @@ static const NamedDecl *getDefinitionToImport(const NamedDecl *D) {
     return PD->getDefinition();
     return PD->getDefinition();
   if (const TemplateDecl *TD = dyn_cast<TemplateDecl>(D))
   if (const TemplateDecl *TD = dyn_cast<TemplateDecl>(D))
     return getDefinitionToImport(TD->getTemplatedDecl());
     return getDefinitionToImport(TD->getTemplatedDecl());
-  return 0;
+  return nullptr;
 }
 }
 
 
 /// \brief Diagnose a successfully-corrected typo. Separated from the correction
 /// \brief Diagnose a successfully-corrected typo. Separated from the correction
@@ -4586,7 +4587,7 @@ void Sema::diagnoseTypo(const TypoCorrection &Correction,
     << CorrectedQuotedStr << (ErrorRecovery ? FixTypo : FixItHint());
     << CorrectedQuotedStr << (ErrorRecovery ? FixTypo : FixItHint());
 
 
   NamedDecl *ChosenDecl =
   NamedDecl *ChosenDecl =
-      Correction.isKeyword() ? 0 : Correction.getCorrectionDecl();
+      Correction.isKeyword() ? nullptr : Correction.getCorrectionDecl();
   if (PrevNote.getDiagID() && ChosenDecl)
   if (PrevNote.getDiagID() && ChosenDecl)
     Diag(ChosenDecl->getLocation(), PrevNote)
     Diag(ChosenDecl->getLocation(), PrevNote)
       << CorrectedQuotedStr << (ErrorRecovery ? FixItHint() : FixTypo);
       << CorrectedQuotedStr << (ErrorRecovery ? FixItHint() : FixTypo);

+ 49 - 43
lib/Sema/SemaObjCProperty.cpp

@@ -164,7 +164,7 @@ Decl *Sema::ActOnProperty(Scope *S, SourceLocation AtLoc,
 
 
   // Proceed with constructing the ObjCPropertyDecls.
   // Proceed with constructing the ObjCPropertyDecls.
   ObjCContainerDecl *ClassDecl = cast<ObjCContainerDecl>(CurContext);
   ObjCContainerDecl *ClassDecl = cast<ObjCContainerDecl>(CurContext);
-  ObjCPropertyDecl *Res = 0;
+  ObjCPropertyDecl *Res = nullptr;
   if (ObjCCategoryDecl *CDecl = dyn_cast<ObjCCategoryDecl>(ClassDecl)) {
   if (ObjCCategoryDecl *CDecl = dyn_cast<ObjCCategoryDecl>(ClassDecl)) {
     if (CDecl->IsClassExtension()) {
     if (CDecl->IsClassExtension()) {
       Res = HandlePropertyInClassExtension(S, AtLoc, LParenLoc,
       Res = HandlePropertyInClassExtension(S, AtLoc, LParenLoc,
@@ -175,7 +175,7 @@ Decl *Sema::ActOnProperty(Scope *S, SourceLocation AtLoc,
                                            isOverridingProperty, TSI,
                                            isOverridingProperty, TSI,
                                            MethodImplKind);
                                            MethodImplKind);
       if (!Res)
       if (!Res)
-        return 0;
+        return nullptr;
     }
     }
   }
   }
 
 
@@ -337,7 +337,7 @@ Sema::HandlePropertyInClassExtension(Scope *S,
             = ObjCPropertyDecl::findPropertyDecl(Ext, PropertyId)) {
             = ObjCPropertyDecl::findPropertyDecl(Ext, PropertyId)) {
         Diag(AtLoc, diag::err_duplicate_property);
         Diag(AtLoc, diag::err_duplicate_property);
         Diag(prevDecl->getLocation(), diag::note_property_declare);
         Diag(prevDecl->getLocation(), diag::note_property_declare);
-        return 0;
+        return nullptr;
       }
       }
     }
     }
   }
   }
@@ -369,7 +369,7 @@ Sema::HandlePropertyInClassExtension(Scope *S,
   if (!CCPrimary) {
   if (!CCPrimary) {
     Diag(CDecl->getLocation(), diag::err_continuation_class);
     Diag(CDecl->getLocation(), diag::err_continuation_class);
     *isOverridingProperty = true;
     *isOverridingProperty = true;
-    return 0;
+    return nullptr;
   }
   }
 
 
   // Find the property in continuation class's primary class only.
   // Find the property in continuation class's primary class only.
@@ -387,12 +387,14 @@ Sema::HandlePropertyInClassExtension(Scope *S,
     // A case of continuation class adding a new property in the class. This
     // A case of continuation class adding a new property in the class. This
     // is not what it was meant for. However, gcc supports it and so should we.
     // is not what it was meant for. However, gcc supports it and so should we.
     // Make sure setter/getters are declared here.
     // Make sure setter/getters are declared here.
-    ProcessPropertyDecl(PrimaryPDecl, CCPrimary, /* redeclaredProperty = */ 0,
+    ProcessPropertyDecl(PrimaryPDecl, CCPrimary,
+                        /* redeclaredProperty = */ nullptr,
                         /* lexicalDC = */ CDecl);
                         /* lexicalDC = */ CDecl);
     PDecl->setGetterMethodDecl(PrimaryPDecl->getGetterMethodDecl());
     PDecl->setGetterMethodDecl(PrimaryPDecl->getGetterMethodDecl());
     PDecl->setSetterMethodDecl(PrimaryPDecl->getSetterMethodDecl());
     PDecl->setSetterMethodDecl(PrimaryPDecl->getSetterMethodDecl());
     if (ASTMutationListener *L = Context.getASTMutationListener())
     if (ASTMutationListener *L = Context.getASTMutationListener())
-      L->AddedObjCPropertyInClassExtension(PrimaryPDecl, /*OrigProp=*/0, CDecl);
+      L->AddedObjCPropertyInClassExtension(PrimaryPDecl, /*OrigProp=*/nullptr,
+                                           CDecl);
     return PrimaryPDecl;
     return PrimaryPDecl;
   }
   }
   if (!Context.hasSameType(PIDecl->getType(), PDecl->getType())) {
   if (!Context.hasSameType(PIDecl->getType(), PDecl->getType())) {
@@ -412,7 +414,7 @@ Sema::HandlePropertyInClassExtension(Scope *S,
       Diag(AtLoc, 
       Diag(AtLoc, 
           diag::err_type_mismatch_continuation_class) << PDecl->getType();
           diag::err_type_mismatch_continuation_class) << PDecl->getType();
       Diag(PIDecl->getLocation(), diag::note_property_declare);
       Diag(PIDecl->getLocation(), diag::note_property_declare);
-      return 0;
+      return nullptr;
     }
     }
   }
   }
     
     
@@ -503,7 +505,7 @@ Sema::HandlePropertyInClassExtension(Scope *S,
     Diag(AtLoc, diag)
     Diag(AtLoc, diag)
       << CCPrimary->getDeclName();
       << CCPrimary->getDeclName();
     Diag(PIDecl->getLocation(), diag::note_property_declare);
     Diag(PIDecl->getLocation(), diag::note_property_declare);
-    return 0;
+    return nullptr;
   }
   }
   *isOverridingProperty = true;
   *isOverridingProperty = true;
   // Make sure setter decl is synthesized, and added to primary class's list.
   // Make sure setter decl is synthesized, and added to primary class's list.
@@ -803,19 +805,19 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
   // Make sure we have a context for the property implementation declaration.
   // Make sure we have a context for the property implementation declaration.
   if (!ClassImpDecl) {
   if (!ClassImpDecl) {
     Diag(AtLoc, diag::error_missing_property_context);
     Diag(AtLoc, diag::error_missing_property_context);
-    return 0;
+    return nullptr;
   }
   }
   if (PropertyIvarLoc.isInvalid())
   if (PropertyIvarLoc.isInvalid())
     PropertyIvarLoc = PropertyLoc;
     PropertyIvarLoc = PropertyLoc;
   SourceLocation PropertyDiagLoc = PropertyLoc;
   SourceLocation PropertyDiagLoc = PropertyLoc;
   if (PropertyDiagLoc.isInvalid())
   if (PropertyDiagLoc.isInvalid())
     PropertyDiagLoc = ClassImpDecl->getLocStart();
     PropertyDiagLoc = ClassImpDecl->getLocStart();
-  ObjCPropertyDecl *property = 0;
-  ObjCInterfaceDecl* IDecl = 0;
+  ObjCPropertyDecl *property = nullptr;
+  ObjCInterfaceDecl *IDecl = nullptr;
   // Find the class or category class where this property must have
   // Find the class or category class where this property must have
   // a declaration.
   // a declaration.
-  ObjCImplementationDecl *IC = 0;
-  ObjCCategoryImplDecl* CatImplClass = 0;
+  ObjCImplementationDecl *IC = nullptr;
+  ObjCCategoryImplDecl *CatImplClass = nullptr;
   if ((IC = dyn_cast<ObjCImplementationDecl>(ClassImpDecl))) {
   if ((IC = dyn_cast<ObjCImplementationDecl>(ClassImpDecl))) {
     IDecl = IC->getClassInterface();
     IDecl = IC->getClassInterface();
     // We always synthesize an interface for an implementation
     // We always synthesize an interface for an implementation
@@ -827,7 +829,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
     property = IDecl->FindPropertyDeclaration(PropertyId);
     property = IDecl->FindPropertyDeclaration(PropertyId);
     if (!property) {
     if (!property) {
       Diag(PropertyLoc, diag::error_bad_property_decl) << IDecl->getDeclName();
       Diag(PropertyLoc, diag::error_bad_property_decl) << IDecl->getDeclName();
-      return 0;
+      return nullptr;
     }
     }
     unsigned PIkind = property->getPropertyAttributesAsWritten();
     unsigned PIkind = property->getPropertyAttributesAsWritten();
     if ((PIkind & (ObjCPropertyDecl::OBJC_PR_atomic |
     if ((PIkind & (ObjCPropertyDecl::OBJC_PR_atomic |
@@ -844,7 +846,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
       if (!CD->IsClassExtension()) {
       if (!CD->IsClassExtension()) {
         Diag(PropertyLoc, diag::error_category_property) << CD->getDeclName();
         Diag(PropertyLoc, diag::error_category_property) << CD->getDeclName();
         Diag(property->getLocation(), diag::note_property_declare);
         Diag(property->getLocation(), diag::note_property_declare);
-        return 0;
+        return nullptr;
       }
       }
     }
     }
     if (Synthesize&&
     if (Synthesize&&
@@ -887,12 +889,12 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
   } else if ((CatImplClass = dyn_cast<ObjCCategoryImplDecl>(ClassImpDecl))) {
   } else if ((CatImplClass = dyn_cast<ObjCCategoryImplDecl>(ClassImpDecl))) {
     if (Synthesize) {
     if (Synthesize) {
       Diag(AtLoc, diag::error_synthesize_category_decl);
       Diag(AtLoc, diag::error_synthesize_category_decl);
-      return 0;
+      return nullptr;
     }
     }
     IDecl = CatImplClass->getClassInterface();
     IDecl = CatImplClass->getClassInterface();
     if (!IDecl) {
     if (!IDecl) {
       Diag(AtLoc, diag::error_missing_property_interface);
       Diag(AtLoc, diag::error_missing_property_interface);
-      return 0;
+      return nullptr;
     }
     }
     ObjCCategoryDecl *Category =
     ObjCCategoryDecl *Category =
     IDecl->FindCategoryDeclaration(CatImplClass->getIdentifier());
     IDecl->FindCategoryDeclaration(CatImplClass->getIdentifier());
@@ -900,19 +902,19 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
     // If category for this implementation not found, it is an error which
     // If category for this implementation not found, it is an error which
     // has already been reported eralier.
     // has already been reported eralier.
     if (!Category)
     if (!Category)
-      return 0;
+      return nullptr;
     // Look for this property declaration in @implementation's category
     // Look for this property declaration in @implementation's category
     property = Category->FindPropertyDeclaration(PropertyId);
     property = Category->FindPropertyDeclaration(PropertyId);
     if (!property) {
     if (!property) {
       Diag(PropertyLoc, diag::error_bad_category_property_decl)
       Diag(PropertyLoc, diag::error_bad_category_property_decl)
       << Category->getDeclName();
       << Category->getDeclName();
-      return 0;
+      return nullptr;
     }
     }
   } else {
   } else {
     Diag(AtLoc, diag::error_bad_property_context);
     Diag(AtLoc, diag::error_bad_property_context);
-    return 0;
+    return nullptr;
   }
   }
-  ObjCIvarDecl *Ivar = 0;
+  ObjCIvarDecl *Ivar = nullptr;
   bool CompleteTypeErr = false;
   bool CompleteTypeErr = false;
   bool compat = true;
   bool compat = true;
   // Check that we have a valid, previously declared ivar for @synthesize
   // Check that we have a valid, previously declared ivar for @synthesize
@@ -960,14 +962,14 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
       // an ivar matching property name and issue warning; since this
       // an ivar matching property name and issue warning; since this
       // is the most common case of not using an ivar used for backing
       // is the most common case of not using an ivar used for backing
       // property in non-default synthesis case.
       // property in non-default synthesis case.
-      ObjCInterfaceDecl *ClassDeclared=0;
+      ObjCInterfaceDecl *ClassDeclared=nullptr;
       ObjCIvarDecl *originalIvar = 
       ObjCIvarDecl *originalIvar = 
       IDecl->lookupInstanceVariable(property->getIdentifier(), 
       IDecl->lookupInstanceVariable(property->getIdentifier(), 
                                     ClassDeclared);
                                     ClassDeclared);
       if (originalIvar) {
       if (originalIvar) {
         Diag(PropertyDiagLoc, 
         Diag(PropertyDiagLoc, 
              diag::warn_autosynthesis_property_ivar_match)
              diag::warn_autosynthesis_property_ivar_match)
-        << PropertyId << (Ivar == 0) << PropertyIvar 
+        << PropertyId << (Ivar == nullptr) << PropertyIvar
         << originalIvar->getIdentifier();
         << originalIvar->getIdentifier();
         Diag(property->getLocation(), diag::note_property_declare);
         Diag(property->getLocation(), diag::note_property_declare);
         Diag(originalIvar->getLocation(), diag::note_ivar_decl);
         Diag(originalIvar->getLocation(), diag::note_ivar_decl);
@@ -1026,9 +1028,9 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
 
 
       Ivar = ObjCIvarDecl::Create(Context, ClassImpDecl,
       Ivar = ObjCIvarDecl::Create(Context, ClassImpDecl,
                                   PropertyIvarLoc,PropertyIvarLoc, PropertyIvar,
                                   PropertyIvarLoc,PropertyIvarLoc, PropertyIvar,
-                                  PropertyIvarType, /*Dinfo=*/0,
+                                  PropertyIvarType, /*Dinfo=*/nullptr,
                                   ObjCIvarDecl::Private,
                                   ObjCIvarDecl::Private,
-                                  (Expr *)0, true);
+                                  (Expr *)nullptr, true);
       if (RequireNonAbstractType(PropertyIvarLoc,
       if (RequireNonAbstractType(PropertyIvarLoc,
                                  PropertyIvarType,
                                  PropertyIvarType,
                                  diag::err_abstract_type_in_decl,
                                  diag::err_abstract_type_in_decl,
@@ -1144,7 +1146,8 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
       MarkDeclRefReferenced(SelfExpr);
       MarkDeclRefReferenced(SelfExpr);
       Expr *LoadSelfExpr =
       Expr *LoadSelfExpr =
         ImplicitCastExpr::Create(Context, SelfDecl->getType(),
         ImplicitCastExpr::Create(Context, SelfDecl->getType(),
-                                 CK_LValueToRValue, SelfExpr, 0, VK_RValue);
+                                 CK_LValueToRValue, SelfExpr, nullptr,
+                                 VK_RValue);
       Expr *IvarRefExpr =
       Expr *IvarRefExpr =
         new (Context) ObjCIvarRefExpr(Ivar, Ivar->getType(), PropertyDiagLoc,
         new (Context) ObjCIvarRefExpr(Ivar, Ivar->getType(), PropertyDiagLoc,
                                       Ivar->getLocation(),
                                       Ivar->getLocation(),
@@ -1193,7 +1196,8 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
       MarkDeclRefReferenced(SelfExpr);
       MarkDeclRefReferenced(SelfExpr);
       Expr *LoadSelfExpr =
       Expr *LoadSelfExpr =
         ImplicitCastExpr::Create(Context, SelfDecl->getType(),
         ImplicitCastExpr::Create(Context, SelfDecl->getType(),
-                                 CK_LValueToRValue, SelfExpr, 0, VK_RValue);
+                                 CK_LValueToRValue, SelfExpr, nullptr,
+                                 VK_RValue);
       Expr *lhs =
       Expr *lhs =
         new (Context) ObjCIvarRefExpr(Ivar, Ivar->getType(), PropertyDiagLoc,
         new (Context) ObjCIvarRefExpr(Ivar, Ivar->getType(), PropertyDiagLoc,
                                       Ivar->getLocation(),
                                       Ivar->getLocation(),
@@ -1239,7 +1243,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
         = IC->FindPropertyImplDecl(PropertyId)) {
         = IC->FindPropertyImplDecl(PropertyId)) {
       Diag(PropertyLoc, diag::error_property_implemented) << PropertyId;
       Diag(PropertyLoc, diag::error_property_implemented) << PropertyId;
       Diag(PPIDecl->getLocation(), diag::note_previous_declaration);
       Diag(PPIDecl->getLocation(), diag::note_previous_declaration);
-      return 0;
+      return nullptr;
     }
     }
     IC->addPropertyImplementation(PIDecl);
     IC->addPropertyImplementation(PIDecl);
     if (getLangOpts().ObjCDefaultSynthProperties &&
     if (getLangOpts().ObjCDefaultSynthProperties &&
@@ -1248,8 +1252,8 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
       // Diagnose if an ivar was lazily synthesdized due to a previous
       // Diagnose if an ivar was lazily synthesdized due to a previous
       // use and if 1) property is @dynamic or 2) property is synthesized
       // use and if 1) property is @dynamic or 2) property is synthesized
       // but it requires an ivar of different name.
       // but it requires an ivar of different name.
-      ObjCInterfaceDecl *ClassDeclared=0;
-      ObjCIvarDecl *Ivar = 0;
+      ObjCInterfaceDecl *ClassDeclared=nullptr;
+      ObjCIvarDecl *Ivar = nullptr;
       if (!Synthesize)
       if (!Synthesize)
         Ivar = IDecl->lookupInstanceVariable(PropertyId, ClassDeclared);
         Ivar = IDecl->lookupInstanceVariable(PropertyId, ClassDeclared);
       else {
       else {
@@ -1278,7 +1282,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
         CatImplClass->FindPropertyImplDecl(PropertyId)) {
         CatImplClass->FindPropertyImplDecl(PropertyId)) {
       Diag(PropertyDiagLoc, diag::error_property_implemented) << PropertyId;
       Diag(PropertyDiagLoc, diag::error_property_implemented) << PropertyId;
       Diag(PPIDecl->getLocation(), diag::note_previous_declaration);
       Diag(PPIDecl->getLocation(), diag::note_previous_declaration);
-      return 0;
+      return nullptr;
     }
     }
     CatImplClass->addPropertyImplementation(PIDecl);
     CatImplClass->addPropertyImplementation(PIDecl);
   }
   }
@@ -1622,7 +1626,7 @@ static void DiagnoseUnimplementedAccessor(Sema &S,
   // class's protocol, or one of it super classes. This is because,
   // class's protocol, or one of it super classes. This is because,
   // the class is going to implement them.
   // the class is going to implement them.
   if (!SMap.count(Method) &&
   if (!SMap.count(Method) &&
-      (PrimaryClass == 0 ||
+      (PrimaryClass == nullptr ||
        !PrimaryClass->lookupPropertyAccessor(Method, C))) {
        !PrimaryClass->lookupPropertyAccessor(Method, C))) {
         S.Diag(IMPDecl->getLocation(),
         S.Diag(IMPDecl->getLocation(),
                isa<ObjCCategoryDecl>(CDecl) ?
                isa<ObjCCategoryDecl>(CDecl) ?
@@ -1710,7 +1714,7 @@ void Sema::DiagnoseUnimplementedProperties(Scope *S, ObjCImplDecl* IMPDecl,
     InsMap.insert(I->getSelector());
     InsMap.insert(I->getSelector());
   
   
   ObjCCategoryDecl *C = dyn_cast<ObjCCategoryDecl>(CDecl);
   ObjCCategoryDecl *C = dyn_cast<ObjCCategoryDecl>(CDecl);
-  ObjCInterfaceDecl *PrimaryClass = 0;
+  ObjCInterfaceDecl *PrimaryClass = nullptr;
   if (C && !C->IsClassExtension())
   if (C && !C->IsClassExtension())
     if ((PrimaryClass = C->getClassInterface()))
     if ((PrimaryClass = C->getClassInterface()))
       // Report unimplemented properties in the category as well.
       // Report unimplemented properties in the category as well.
@@ -1749,8 +1753,8 @@ Sema::AtomicPropertySetterGetterRules (ObjCImplDecl* IMPDecl,
   if (getLangOpts().getGC() != LangOptions::NonGC)
   if (getLangOpts().getGC() != LangOptions::NonGC)
     return;
     return;
   for (const auto *Property : IDecl->properties()) {
   for (const auto *Property : IDecl->properties()) {
-    ObjCMethodDecl *GetterMethod = 0;
-    ObjCMethodDecl *SetterMethod = 0;
+    ObjCMethodDecl *GetterMethod = nullptr;
+    ObjCMethodDecl *SetterMethod = nullptr;
     bool LookedUpGetterSetter = false;
     bool LookedUpGetterSetter = false;
 
 
     unsigned Attributes = Property->getPropertyAttributes();
     unsigned Attributes = Property->getPropertyAttributes();
@@ -1792,8 +1796,8 @@ Sema::AtomicPropertySetterGetterRules (ObjCImplDecl* IMPDecl,
           (GetterMethod ? GetterMethod->getLocation()
           (GetterMethod ? GetterMethod->getLocation()
                         : SetterMethod->getLocation());
                         : SetterMethod->getLocation());
         Diag(MethodLoc, diag::warn_atomic_property_rule)
         Diag(MethodLoc, diag::warn_atomic_property_rule)
-          << Property->getIdentifier() << (GetterMethod != 0)
-          << (SetterMethod != 0);
+          << Property->getIdentifier() << (GetterMethod != nullptr)
+          << (SetterMethod != nullptr);
         // fixit stuff.
         // fixit stuff.
         if (!AttributesAsWritten) {
         if (!AttributesAsWritten) {
           if (Property->getLParenLoc().isValid()) {
           if (Property->getLParenLoc().isValid()) {
@@ -1943,8 +1947,9 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property,
 
 
     GetterMethod = ObjCMethodDecl::Create(Context, Loc, Loc,
     GetterMethod = ObjCMethodDecl::Create(Context, Loc, Loc,
                              property->getGetterName(),
                              property->getGetterName(),
-                             property->getType(), 0, CD, /*isInstance=*/true,
-                             /*isVariadic=*/false, /*isPropertyAccessor=*/true,
+                             property->getType(), nullptr, CD,
+                             /*isInstance=*/true, /*isVariadic=*/false,
+                             /*isPropertyAccessor=*/true,
                              /*isImplicitlyDeclared=*/true, /*isDefined=*/false,
                              /*isImplicitlyDeclared=*/true, /*isDefined=*/false,
                              (property->getPropertyImplementation() ==
                              (property->getPropertyImplementation() ==
                               ObjCPropertyDecl::Optional) ?
                               ObjCPropertyDecl::Optional) ?
@@ -1992,8 +1997,9 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property,
 
 
       SetterMethod =
       SetterMethod =
         ObjCMethodDecl::Create(Context, Loc, Loc,
         ObjCMethodDecl::Create(Context, Loc, Loc,
-                               property->getSetterName(), Context.VoidTy, 0,
-                               CD, /*isInstance=*/true, /*isVariadic=*/false,
+                               property->getSetterName(), Context.VoidTy,
+                               nullptr, CD, /*isInstance=*/true,
+                               /*isVariadic=*/false,
                                /*isPropertyAccessor=*/true,
                                /*isPropertyAccessor=*/true,
                                /*isImplicitlyDeclared=*/true,
                                /*isImplicitlyDeclared=*/true,
                                /*isDefined=*/false,
                                /*isDefined=*/false,
@@ -2008,9 +2014,9 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property,
                                                   Loc, Loc,
                                                   Loc, Loc,
                                                   property->getIdentifier(),
                                                   property->getIdentifier(),
                                     property->getType().getUnqualifiedType(),
                                     property->getType().getUnqualifiedType(),
-                                                  /*TInfo=*/0,
+                                                  /*TInfo=*/nullptr,
                                                   SC_None,
                                                   SC_None,
-                                                  0);
+                                                  nullptr);
       SetterMethod->setMethodParams(Context, Argument, None);
       SetterMethod->setMethodParams(Context, Argument, None);
 
 
       AddPropertyAttrs(*this, SetterMethod, property);
       AddPropertyAttrs(*this, SetterMethod, property);

+ 100 - 96
lib/Sema/SemaOverload.cpp

@@ -216,7 +216,7 @@ void StandardConversionSequence::setAsIdentityConversion() {
   BindsToRvalue = false;
   BindsToRvalue = false;
   BindsImplicitObjectArgumentWithoutRefQualifier = false;
   BindsImplicitObjectArgumentWithoutRefQualifier = false;
   ObjCLifetimeConversionBinding = false;
   ObjCLifetimeConversionBinding = false;
-  CopyConstructor = 0;
+  CopyConstructor = nullptr;
 }
 }
 
 
 /// getRank - Retrieve the rank of this standard conversion sequence
 /// getRank - Retrieve the rank of this standard conversion sequence
@@ -574,7 +574,7 @@ DeductionFailureInfo MakeDeductionFailureInfo(ASTContext &Context,
   DeductionFailureInfo Result;
   DeductionFailureInfo Result;
   Result.Result = static_cast<unsigned>(TDK);
   Result.Result = static_cast<unsigned>(TDK);
   Result.HasDiagnostic = false;
   Result.HasDiagnostic = false;
-  Result.Data = 0;
+  Result.Data = nullptr;
   switch (TDK) {
   switch (TDK) {
   case Sema::TDK_Success:
   case Sema::TDK_Success:
   case Sema::TDK_Invalid:
   case Sema::TDK_Invalid:
@@ -645,12 +645,12 @@ void DeductionFailureInfo::Destroy() {
   case Sema::TDK_Underqualified:
   case Sema::TDK_Underqualified:
   case Sema::TDK_NonDeducedMismatch:
   case Sema::TDK_NonDeducedMismatch:
     // FIXME: Destroy the data?
     // FIXME: Destroy the data?
-    Data = 0;
+    Data = nullptr;
     break;
     break;
 
 
   case Sema::TDK_SubstitutionFailure:
   case Sema::TDK_SubstitutionFailure:
     // FIXME: Destroy the template argument list?
     // FIXME: Destroy the template argument list?
-    Data = 0;
+    Data = nullptr;
     if (PartialDiagnosticAt *Diag = getSFINAEDiagnostic()) {
     if (PartialDiagnosticAt *Diag = getSFINAEDiagnostic()) {
       Diag->~PartialDiagnosticAt();
       Diag->~PartialDiagnosticAt();
       HasDiagnostic = false;
       HasDiagnostic = false;
@@ -666,7 +666,7 @@ void DeductionFailureInfo::Destroy() {
 PartialDiagnosticAt *DeductionFailureInfo::getSFINAEDiagnostic() {
 PartialDiagnosticAt *DeductionFailureInfo::getSFINAEDiagnostic() {
   if (HasDiagnostic)
   if (HasDiagnostic)
     return static_cast<PartialDiagnosticAt*>(static_cast<void*>(Diagnostic));
     return static_cast<PartialDiagnosticAt*>(static_cast<void*>(Diagnostic));
-  return 0;
+  return nullptr;
 }
 }
 
 
 TemplateParameter DeductionFailureInfo::getTemplateParameter() {
 TemplateParameter DeductionFailureInfo::getTemplateParameter() {
@@ -710,7 +710,7 @@ TemplateArgumentList *DeductionFailureInfo::getTemplateArgumentList() {
   case Sema::TDK_Underqualified:
   case Sema::TDK_Underqualified:
   case Sema::TDK_NonDeducedMismatch:
   case Sema::TDK_NonDeducedMismatch:
   case Sema::TDK_FailedOverloadResolution:
   case Sema::TDK_FailedOverloadResolution:
-    return 0;
+    return nullptr;
 
 
   case Sema::TDK_SubstitutionFailure:
   case Sema::TDK_SubstitutionFailure:
     return static_cast<TemplateArgumentList*>(Data);
     return static_cast<TemplateArgumentList*>(Data);
@@ -720,7 +720,7 @@ TemplateArgumentList *DeductionFailureInfo::getTemplateArgumentList() {
     break;
     break;
   }
   }
 
 
-  return 0;
+  return nullptr;
 }
 }
 
 
 const TemplateArgument *DeductionFailureInfo::getFirstArg() {
 const TemplateArgument *DeductionFailureInfo::getFirstArg() {
@@ -734,7 +734,7 @@ const TemplateArgument *DeductionFailureInfo::getFirstArg() {
   case Sema::TDK_InvalidExplicitArguments:
   case Sema::TDK_InvalidExplicitArguments:
   case Sema::TDK_SubstitutionFailure:
   case Sema::TDK_SubstitutionFailure:
   case Sema::TDK_FailedOverloadResolution:
   case Sema::TDK_FailedOverloadResolution:
-    return 0;
+    return nullptr;
 
 
   case Sema::TDK_Inconsistent:
   case Sema::TDK_Inconsistent:
   case Sema::TDK_Underqualified:
   case Sema::TDK_Underqualified:
@@ -746,7 +746,7 @@ const TemplateArgument *DeductionFailureInfo::getFirstArg() {
     break;
     break;
   }
   }
 
 
-  return 0;
+  return nullptr;
 }
 }
 
 
 const TemplateArgument *DeductionFailureInfo::getSecondArg() {
 const TemplateArgument *DeductionFailureInfo::getSecondArg() {
@@ -760,7 +760,7 @@ const TemplateArgument *DeductionFailureInfo::getSecondArg() {
   case Sema::TDK_InvalidExplicitArguments:
   case Sema::TDK_InvalidExplicitArguments:
   case Sema::TDK_SubstitutionFailure:
   case Sema::TDK_SubstitutionFailure:
   case Sema::TDK_FailedOverloadResolution:
   case Sema::TDK_FailedOverloadResolution:
-    return 0;
+    return nullptr;
 
 
   case Sema::TDK_Inconsistent:
   case Sema::TDK_Inconsistent:
   case Sema::TDK_Underqualified:
   case Sema::TDK_Underqualified:
@@ -772,7 +772,7 @@ const TemplateArgument *DeductionFailureInfo::getSecondArg() {
     break;
     break;
   }
   }
 
 
-  return 0;
+  return nullptr;
 }
 }
 
 
 Expr *DeductionFailureInfo::getExpr() {
 Expr *DeductionFailureInfo::getExpr() {
@@ -780,7 +780,7 @@ Expr *DeductionFailureInfo::getExpr() {
         Sema::TDK_FailedOverloadResolution)
         Sema::TDK_FailedOverloadResolution)
     return static_cast<Expr*>(Data);
     return static_cast<Expr*>(Data);
 
 
-  return 0;
+  return nullptr;
 }
 }
 
 
 void OverloadCandidateSet::destroyCandidates() {
 void OverloadCandidateSet::destroyCandidates() {
@@ -830,8 +830,9 @@ namespace {
 ///   without this, they will be immediately diagnosed as errors
 ///   without this, they will be immediately diagnosed as errors
 ///
 ///
 /// Return true on unrecoverable error.
 /// Return true on unrecoverable error.
-static bool checkPlaceholderForOverload(Sema &S, Expr *&E,
-                                        UnbridgedCastsSet *unbridgedCasts = 0) {
+static bool
+checkPlaceholderForOverload(Sema &S, Expr *&E,
+                            UnbridgedCastsSet *unbridgedCasts = nullptr) {
   if (const BuiltinType *placeholder =  E->getType()->getAsPlaceholderType()) {
   if (const BuiltinType *placeholder =  E->getType()->getAsPlaceholderType()) {
     // We can't handle overloaded expressions here because overload
     // We can't handle overloaded expressions here because overload
     // resolution might reasonably tweak them.
     // resolution might reasonably tweak them.
@@ -983,7 +984,7 @@ bool Sema::IsOverload(FunctionDecl *New, FunctionDecl *Old,
   // C++ [temp.fct]p2:
   // C++ [temp.fct]p2:
   //   A function template can be overloaded with other function templates
   //   A function template can be overloaded with other function templates
   //   and with normal (non-template) functions.
   //   and with normal (non-template) functions.
-  if ((OldTemplate == 0) != (NewTemplate == 0))
+  if ((OldTemplate == nullptr) != (NewTemplate == nullptr))
     return true;
     return true;
 
 
   // Is the function New an overload of the function Old?
   // Is the function New an overload of the function Old?
@@ -1256,7 +1257,7 @@ TryImplicitConversion(Sema &S, Expr *From, QualType ToType,
     // copy/move constructor, since overloading just assumes that it
     // copy/move constructor, since overloading just assumes that it
     // exists. When we actually perform initialization, we'll find the
     // exists. When we actually perform initialization, we'll find the
     // appropriate constructor to copy the returned object, if needed.
     // appropriate constructor to copy the returned object, if needed.
-    ICS.Standard.CopyConstructor = 0;
+    ICS.Standard.CopyConstructor = nullptr;
 
 
     // Determine whether this is considered a derived-to-base conversion.
     // Determine whether this is considered a derived-to-base conversion.
     if (!S.Context.hasSameUnqualifiedType(FromType, ToType))
     if (!S.Context.hasSameUnqualifiedType(FromType, ToType))
@@ -1438,7 +1439,7 @@ static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType,
   SCS.setAsIdentityConversion();
   SCS.setAsIdentityConversion();
   SCS.IncompatibleObjC = false;
   SCS.IncompatibleObjC = false;
   SCS.setFromType(FromType);
   SCS.setFromType(FromType);
-  SCS.CopyConstructor = 0;
+  SCS.CopyConstructor = nullptr;
 
 
   // There are no standard conversions for class types in C++, so
   // There are no standard conversions for class types in C++, so
   // abort early. When overloading in C, however, we do permit
   // abort early. When overloading in C, however, we do permit
@@ -1922,7 +1923,7 @@ bool Sema::IsComplexPromotion(QualType FromType, QualType ToType) {
 
 
   return IsFloatingPointPromotion(FromComplex->getElementType(),
   return IsFloatingPointPromotion(FromComplex->getElementType(),
                                   ToComplex->getElementType()) ||
                                   ToComplex->getElementType()) ||
-    IsIntegralPromotion(0, FromComplex->getElementType(),
+    IsIntegralPromotion(nullptr, FromComplex->getElementType(),
                         ToComplex->getElementType());
                         ToComplex->getElementType());
 }
 }
 
 
@@ -2950,7 +2951,7 @@ IsInitializerListConstructorConversion(Sema &S, Expr *From, QualType ToType,
     DeclAccessPair FoundDecl = DeclAccessPair::make(D, D->getAccess());
     DeclAccessPair FoundDecl = DeclAccessPair::make(D, D->getAccess());
 
 
     // Find the constructor (which may be a template).
     // Find the constructor (which may be a template).
-    CXXConstructorDecl *Constructor = 0;
+    CXXConstructorDecl *Constructor = nullptr;
     FunctionTemplateDecl *ConstructorTmpl
     FunctionTemplateDecl *ConstructorTmpl
       = dyn_cast<FunctionTemplateDecl>(D);
       = dyn_cast<FunctionTemplateDecl>(D);
     if (ConstructorTmpl)
     if (ConstructorTmpl)
@@ -2969,7 +2970,7 @@ IsInitializerListConstructorConversion(Sema &S, Expr *From, QualType ToType,
           isFirstArgumentCompatibleWithType(S.Context, Constructor, ToType);
           isFirstArgumentCompatibleWithType(S.Context, Constructor, ToType);
       if (ConstructorTmpl)
       if (ConstructorTmpl)
         S.AddTemplateOverloadCandidate(ConstructorTmpl, FoundDecl,
         S.AddTemplateOverloadCandidate(ConstructorTmpl, FoundDecl,
-                                       /*ExplicitArgs*/ 0,
+                                       /*ExplicitArgs*/ nullptr,
                                        From, CandidateSet,
                                        From, CandidateSet,
                                        SuppressUserConversions);
                                        SuppressUserConversions);
       else
       else
@@ -3085,7 +3086,7 @@ IsUserDefinedConversion(Sema &S, Expr *From, QualType ToType,
         DeclAccessPair FoundDecl = DeclAccessPair::make(D, D->getAccess());
         DeclAccessPair FoundDecl = DeclAccessPair::make(D, D->getAccess());
 
 
         // Find the constructor (which may be a template).
         // Find the constructor (which may be a template).
-        CXXConstructorDecl *Constructor = 0;
+        CXXConstructorDecl *Constructor = nullptr;
         FunctionTemplateDecl *ConstructorTmpl
         FunctionTemplateDecl *ConstructorTmpl
           = dyn_cast<FunctionTemplateDecl>(D);
           = dyn_cast<FunctionTemplateDecl>(D);
         if (ConstructorTmpl)
         if (ConstructorTmpl)
@@ -3112,7 +3113,7 @@ IsUserDefinedConversion(Sema &S, Expr *From, QualType ToType,
           }
           }
           if (ConstructorTmpl)
           if (ConstructorTmpl)
             S.AddTemplateOverloadCandidate(ConstructorTmpl, FoundDecl,
             S.AddTemplateOverloadCandidate(ConstructorTmpl, FoundDecl,
-                                           /*ExplicitArgs*/ 0,
+                                           /*ExplicitArgs*/ nullptr,
                                            llvm::makeArrayRef(Args, NumArgs),
                                            llvm::makeArrayRef(Args, NumArgs),
                                            CandidateSet, SuppressUserConversions);
                                            CandidateSet, SuppressUserConversions);
           else
           else
@@ -4265,7 +4266,7 @@ TryReferenceInit(Sema &S, Expr *Init, QualType DeclType,
       ICS.Standard.BindsToRvalue = false;
       ICS.Standard.BindsToRvalue = false;
       ICS.Standard.BindsImplicitObjectArgumentWithoutRefQualifier = false;
       ICS.Standard.BindsImplicitObjectArgumentWithoutRefQualifier = false;
       ICS.Standard.ObjCLifetimeConversionBinding = ObjCLifetimeConversion;
       ICS.Standard.ObjCLifetimeConversionBinding = ObjCLifetimeConversion;
-      ICS.Standard.CopyConstructor = 0;
+      ICS.Standard.CopyConstructor = nullptr;
       ICS.Standard.DeprecatedStringLiteralToCharPtr = false;
       ICS.Standard.DeprecatedStringLiteralToCharPtr = false;
 
 
       // Nothing more to do: the inaccessibility/ambiguity check for
       // Nothing more to do: the inaccessibility/ambiguity check for
@@ -4340,7 +4341,7 @@ TryReferenceInit(Sema &S, Expr *Init, QualType DeclType,
     ICS.Standard.BindsToRvalue = InitCategory.isRValue();
     ICS.Standard.BindsToRvalue = InitCategory.isRValue();
     ICS.Standard.BindsImplicitObjectArgumentWithoutRefQualifier = false;
     ICS.Standard.BindsImplicitObjectArgumentWithoutRefQualifier = false;
     ICS.Standard.ObjCLifetimeConversionBinding = ObjCLifetimeConversion;
     ICS.Standard.ObjCLifetimeConversionBinding = ObjCLifetimeConversion;
-    ICS.Standard.CopyConstructor = 0;
+    ICS.Standard.CopyConstructor = nullptr;
     ICS.Standard.DeprecatedStringLiteralToCharPtr = false;
     ICS.Standard.DeprecatedStringLiteralToCharPtr = false;
     return ICS;
     return ICS;
   }
   }
@@ -4566,7 +4567,7 @@ TryListConversion(Sema &S, InitListExpr *From, QualType ToType,
       Result.UserDefined.After.setAsIdentityConversion();
       Result.UserDefined.After.setAsIdentityConversion();
       Result.UserDefined.After.setFromType(ToType);
       Result.UserDefined.After.setFromType(ToType);
       Result.UserDefined.After.setAllToTypes(ToType);
       Result.UserDefined.After.setAllToTypes(ToType);
-      Result.UserDefined.ConversionFunction = 0;
+      Result.UserDefined.ConversionFunction = nullptr;
     }
     }
     return Result;
     return Result;
   }
   }
@@ -4995,7 +4996,7 @@ ExprResult Sema::CheckConvertedConstantExpression(Expr *From, QualType T,
                           /*InOverloadResolution=*/false,
                           /*InOverloadResolution=*/false,
                           /*CStyle=*/false,
                           /*CStyle=*/false,
                           /*AllowObjcWritebackConversion=*/false);
                           /*AllowObjcWritebackConversion=*/false);
-  StandardConversionSequence *SCS = 0;
+  StandardConversionSequence *SCS = nullptr;
   switch (ICS.getKind()) {
   switch (ICS.getKind()) {
   case ImplicitConversionSequence::StandardConversion:
   case ImplicitConversionSequence::StandardConversion:
     if (!CheckConvertedConstantConversions(*this, ICS.Standard))
     if (!CheckConvertedConstantConversions(*this, ICS.Standard))
@@ -5196,15 +5197,15 @@ diagnoseNoViableConversion(Sema &SemaRef, SourceLocation Loc, Expr *&From,
     if (SemaRef.isSFINAEContext())
     if (SemaRef.isSFINAEContext())
       return true;
       return true;
 
 
-    SemaRef.CheckMemberOperatorAccess(From->getExprLoc(), From, 0, Found);
+    SemaRef.CheckMemberOperatorAccess(From->getExprLoc(), From, nullptr, Found);
     ExprResult Result = SemaRef.BuildCXXMemberCallExpr(From, Found, Conversion,
     ExprResult Result = SemaRef.BuildCXXMemberCallExpr(From, Found, Conversion,
                                                        HadMultipleCandidates);
                                                        HadMultipleCandidates);
     if (Result.isInvalid())
     if (Result.isInvalid())
       return true;
       return true;
     // Record usage of conversion in an implicit cast.
     // Record usage of conversion in an implicit cast.
     From = ImplicitCastExpr::Create(SemaRef.Context, Result.get()->getType(),
     From = ImplicitCastExpr::Create(SemaRef.Context, Result.get()->getType(),
-                                    CK_UserDefinedConversion, Result.get(), 0,
-                                    Result.get()->getValueKind());
+                                    CK_UserDefinedConversion, Result.get(),
+                                    nullptr, Result.get()->getValueKind());
   }
   }
   return false;
   return false;
 }
 }
@@ -5215,7 +5216,7 @@ static bool recordConversion(Sema &SemaRef, SourceLocation Loc, Expr *&From,
                              DeclAccessPair &Found) {
                              DeclAccessPair &Found) {
   CXXConversionDecl *Conversion =
   CXXConversionDecl *Conversion =
       cast<CXXConversionDecl>(Found->getUnderlyingDecl());
       cast<CXXConversionDecl>(Found->getUnderlyingDecl());
-  SemaRef.CheckMemberOperatorAccess(From->getExprLoc(), From, 0, Found);
+  SemaRef.CheckMemberOperatorAccess(From->getExprLoc(), From, nullptr, Found);
 
 
   QualType ToType = Conversion->getConversionType().getNonReferenceType();
   QualType ToType = Conversion->getConversionType().getNonReferenceType();
   if (!Converter.SuppressConversion) {
   if (!Converter.SuppressConversion) {
@@ -5232,8 +5233,8 @@ static bool recordConversion(Sema &SemaRef, SourceLocation Loc, Expr *&From,
     return true;
     return true;
   // Record usage of conversion in an implicit cast.
   // Record usage of conversion in an implicit cast.
   From = ImplicitCastExpr::Create(SemaRef.Context, Result.get()->getType(),
   From = ImplicitCastExpr::Create(SemaRef.Context, Result.get()->getType(),
-                                  CK_UserDefinedConversion, Result.get(), 0,
-                                  Result.get()->getValueKind());
+                                  CK_UserDefinedConversion, Result.get(),
+                                  nullptr, Result.get()->getValueKind());
   return false;
   return false;
 }
 }
 
 
@@ -5682,12 +5683,12 @@ EnableIfAttr *Sema::CheckEnableIf(FunctionDecl *Function, ArrayRef<Expr *> Args,
   // FIXME: specific_attr_iterator<EnableIfAttr> iterates in reverse order, but
   // FIXME: specific_attr_iterator<EnableIfAttr> iterates in reverse order, but
   // we need to find the first failing one.
   // we need to find the first failing one.
   if (!Function->hasAttrs())
   if (!Function->hasAttrs())
-    return 0;
+    return nullptr;
   AttrVec Attrs = Function->getAttrs();
   AttrVec Attrs = Function->getAttrs();
   AttrVec::iterator E = std::remove_if(Attrs.begin(), Attrs.end(),
   AttrVec::iterator E = std::remove_if(Attrs.begin(), Attrs.end(),
                                        IsNotEnableIfAttr);
                                        IsNotEnableIfAttr);
   if (Attrs.begin() == E)
   if (Attrs.begin() == E)
-    return 0;
+    return nullptr;
   std::reverse(Attrs.begin(), E);
   std::reverse(Attrs.begin(), E);
 
 
   SFINAETrap Trap(*this);
   SFINAETrap Trap(*this);
@@ -5701,7 +5702,7 @@ EnableIfAttr *Sema::CheckEnableIf(FunctionDecl *Function, ArrayRef<Expr *> Args,
         !isa<CXXConstructorDecl>(Function)) {
         !isa<CXXConstructorDecl>(Function)) {
       CXXMethodDecl *Method = cast<CXXMethodDecl>(Function);
       CXXMethodDecl *Method = cast<CXXMethodDecl>(Function);
       ExprResult R =
       ExprResult R =
-        PerformObjectArgumentInitialization(Args[0], /*Qualifier=*/0,
+        PerformObjectArgumentInitialization(Args[0], /*Qualifier=*/nullptr,
                                             Method, Method);
                                             Method, Method);
       if (R.isInvalid()) {
       if (R.isInvalid()) {
         InitializationFailed = true;
         InitializationFailed = true;
@@ -5737,7 +5738,7 @@ EnableIfAttr *Sema::CheckEnableIf(FunctionDecl *Function, ArrayRef<Expr *> Args,
       return EIA;
       return EIA;
     }
     }
   }
   }
-  return 0;
+  return nullptr;
 }
 }
 
 
 /// \brief Add all of the function declarations in the given function set to
 /// \brief Add all of the function declarations in the given function set to
@@ -5795,7 +5796,7 @@ void Sema::AddMethodCandidate(DeclAccessPair FoundDecl,
     assert(isa<CXXMethodDecl>(TD->getTemplatedDecl()) &&
     assert(isa<CXXMethodDecl>(TD->getTemplatedDecl()) &&
            "Expected a member function template");
            "Expected a member function template");
     AddMethodTemplateCandidate(TD, FoundDecl, ActingContext,
     AddMethodTemplateCandidate(TD, FoundDecl, ActingContext,
-                               /*ExplicitArgs*/ 0,
+                               /*ExplicitArgs*/ nullptr,
                                ObjectType, ObjectClassification,
                                ObjectType, ObjectClassification,
                                Args, CandidateSet,
                                Args, CandidateSet,
                                SuppressUserConversions);
                                SuppressUserConversions);
@@ -5952,7 +5953,7 @@ Sema::AddMethodTemplateCandidate(FunctionTemplateDecl *MethodTmpl,
   //   function template are combined with the set of non-template candidate
   //   function template are combined with the set of non-template candidate
   //   functions.
   //   functions.
   TemplateDeductionInfo Info(CandidateSet.getLocation());
   TemplateDeductionInfo Info(CandidateSet.getLocation());
-  FunctionDecl *Specialization = 0;
+  FunctionDecl *Specialization = nullptr;
   if (TemplateDeductionResult Result
   if (TemplateDeductionResult Result
       = DeduceTemplateArguments(MethodTmpl, ExplicitTemplateArgs, Args,
       = DeduceTemplateArguments(MethodTmpl, ExplicitTemplateArgs, Args,
                                 Specialization, Info)) {
                                 Specialization, Info)) {
@@ -6002,7 +6003,7 @@ Sema::AddTemplateOverloadCandidate(FunctionTemplateDecl *FunctionTemplate,
   //   function template are combined with the set of non-template candidate
   //   function template are combined with the set of non-template candidate
   //   functions.
   //   functions.
   TemplateDeductionInfo Info(CandidateSet.getLocation());
   TemplateDeductionInfo Info(CandidateSet.getLocation());
-  FunctionDecl *Specialization = 0;
+  FunctionDecl *Specialization = nullptr;
   if (TemplateDeductionResult Result
   if (TemplateDeductionResult Result
         = DeduceTemplateArguments(FunctionTemplate, ExplicitTemplateArgs, Args,
         = DeduceTemplateArguments(FunctionTemplate, ExplicitTemplateArgs, Args,
                                   Specialization, Info)) {
                                   Specialization, Info)) {
@@ -6252,7 +6253,7 @@ Sema::AddTemplateConversionCandidate(FunctionTemplateDecl *FunctionTemplate,
     return;
     return;
 
 
   TemplateDeductionInfo Info(CandidateSet.getLocation());
   TemplateDeductionInfo Info(CandidateSet.getLocation());
-  CXXConversionDecl *Specialization = 0;
+  CXXConversionDecl *Specialization = nullptr;
   if (TemplateDeductionResult Result
   if (TemplateDeductionResult Result
         = DeduceTemplateArguments(FunctionTemplate, ToType,
         = DeduceTemplateArguments(FunctionTemplate, ToType,
                                   Specialization, Info)) {
                                   Specialization, Info)) {
@@ -6296,7 +6297,7 @@ void Sema::AddSurrogateCandidate(CXXConversionDecl *Conversion,
 
 
   OverloadCandidate &Candidate = CandidateSet.addCandidate(Args.size() + 1);
   OverloadCandidate &Candidate = CandidateSet.addCandidate(Args.size() + 1);
   Candidate.FoundDecl = FoundDecl;
   Candidate.FoundDecl = FoundDecl;
-  Candidate.Function = 0;
+  Candidate.Function = nullptr;
   Candidate.Surrogate = Conversion;
   Candidate.Surrogate = Conversion;
   Candidate.Viable = true;
   Candidate.Viable = true;
   Candidate.IsSurrogate = true;
   Candidate.IsSurrogate = true;
@@ -6456,8 +6457,8 @@ void Sema::AddBuiltinCandidate(QualType ResultTy, QualType *ParamTys,
 
 
   // Add this candidate
   // Add this candidate
   OverloadCandidate &Candidate = CandidateSet.addCandidate(Args.size());
   OverloadCandidate &Candidate = CandidateSet.addCandidate(Args.size());
-  Candidate.FoundDecl = DeclAccessPair::make(0, AS_none);
-  Candidate.Function = 0;
+  Candidate.FoundDecl = DeclAccessPair::make(nullptr, AS_none);
+  Candidate.Function = nullptr;
   Candidate.IsSurrogate = false;
   Candidate.IsSurrogate = false;
   Candidate.IgnoreObjectArgument = false;
   Candidate.IgnoreObjectArgument = false;
   Candidate.BuiltinTypes.ResultTy = ResultTy;
   Candidate.BuiltinTypes.ResultTy = ResultTy;
@@ -8802,12 +8803,12 @@ void DiagnoseArityMismatch(Sema &S, Decl *D, unsigned NumFormalArgs) {
 
 
   if (modeCount == 1 && Fn->getParamDecl(0)->getDeclName())
   if (modeCount == 1 && Fn->getParamDecl(0)->getDeclName())
     S.Diag(Fn->getLocation(), diag::note_ovl_candidate_arity_one)
     S.Diag(Fn->getLocation(), diag::note_ovl_candidate_arity_one)
-      << (unsigned) FnKind << (Fn->getDescribedFunctionTemplate() != 0) << mode
-      << Fn->getParamDecl(0) << NumFormalArgs;
+      << (unsigned) FnKind << (Fn->getDescribedFunctionTemplate() != nullptr)
+      << mode << Fn->getParamDecl(0) << NumFormalArgs;
   else
   else
     S.Diag(Fn->getLocation(), diag::note_ovl_candidate_arity)
     S.Diag(Fn->getLocation(), diag::note_ovl_candidate_arity)
-      << (unsigned) FnKind << (Fn->getDescribedFunctionTemplate() != 0) << mode
-      << modeCount << NumFormalArgs;
+      << (unsigned) FnKind << (Fn->getDescribedFunctionTemplate() != nullptr)
+      << mode << modeCount << NumFormalArgs;
   MaybeEmitInheritedConstructorNote(S, Fn);
   MaybeEmitInheritedConstructorNote(S, Fn);
 }
 }
 
 
@@ -9742,7 +9743,7 @@ private:
     //   resulting template argument list is used to generate a single
     //   resulting template argument list is used to generate a single
     //   function template specialization, which is added to the set of
     //   function template specialization, which is added to the set of
     //   overloaded functions considered.
     //   overloaded functions considered.
-    FunctionDecl *Specialization = 0;
+    FunctionDecl *Specialization = nullptr;
     TemplateDeductionInfo Info(FailedCandidates.getLocation());
     TemplateDeductionInfo Info(FailedCandidates.getLocation());
     if (Sema::TemplateDeductionResult Result
     if (Sema::TemplateDeductionResult Result
           = S.DeduceTemplateArguments(FunctionTemplate, 
           = S.DeduceTemplateArguments(FunctionTemplate, 
@@ -9878,7 +9879,7 @@ private:
     //   [...] any function template specializations in the set are
     //   [...] any function template specializations in the set are
     //   eliminated if the set also contains a non-template function, [...]
     //   eliminated if the set also contains a non-template function, [...]
     for (unsigned I = 0, N = Matches.size(); I != N; ) {
     for (unsigned I = 0, N = Matches.size(); I != N; ) {
-      if (Matches[I].second->getPrimaryTemplate() == 0)
+      if (Matches[I].second->getPrimaryTemplate() == nullptr)
         ++I;
         ++I;
       else {
       else {
         Matches[I] = Matches[--N];
         Matches[I] = Matches[--N];
@@ -9950,12 +9951,12 @@ public:
   int getNumMatches() const { return Matches.size(); }
   int getNumMatches() const { return Matches.size(); }
   
   
   FunctionDecl* getMatchingFunctionDecl() const {
   FunctionDecl* getMatchingFunctionDecl() const {
-    if (Matches.size() != 1) return 0;
+    if (Matches.size() != 1) return nullptr;
     return Matches[0].second;
     return Matches[0].second;
   }
   }
   
   
   const DeclAccessPair* getMatchingFunctionAccessPair() const {
   const DeclAccessPair* getMatchingFunctionAccessPair() const {
-    if (Matches.size() != 1) return 0;
+    if (Matches.size() != 1) return nullptr;
     return &Matches[0].first;
     return &Matches[0].first;
   }
   }
 };
 };
@@ -9986,7 +9987,7 @@ Sema::ResolveAddressOfOverloadedFunction(Expr *AddressOfExpr,
   AddressOfFunctionResolver Resolver(*this, AddressOfExpr, TargetType,
   AddressOfFunctionResolver Resolver(*this, AddressOfExpr, TargetType,
                                      Complain);
                                      Complain);
   int NumMatches = Resolver.getNumMatches();
   int NumMatches = Resolver.getNumMatches();
-  FunctionDecl* Fn = 0;
+  FunctionDecl *Fn = nullptr;
   if (NumMatches == 0 && Complain) {
   if (NumMatches == 0 && Complain) {
     if (Resolver.IsInvalidFormOfPointerToMemberFunction())
     if (Resolver.IsInvalidFormOfPointerToMemberFunction())
       Resolver.ComplainIsInvalidFormOfPointerToMemberFunction();
       Resolver.ComplainIsInvalidFormOfPointerToMemberFunction();
@@ -10035,7 +10036,7 @@ Sema::ResolveSingleFunctionTemplateSpecialization(OverloadExpr *ovl,
 
 
   // If we didn't actually find any template-ids, we're done.
   // If we didn't actually find any template-ids, we're done.
   if (!ovl->hasExplicitTemplateArgs())
   if (!ovl->hasExplicitTemplateArgs())
-    return 0;
+    return nullptr;
 
 
   TemplateArgumentListInfo ExplicitTemplateArgs;
   TemplateArgumentListInfo ExplicitTemplateArgs;
   ovl->getExplicitTemplateArgs().copyInto(ExplicitTemplateArgs);
   ovl->getExplicitTemplateArgs().copyInto(ExplicitTemplateArgs);
@@ -10043,7 +10044,7 @@ Sema::ResolveSingleFunctionTemplateSpecialization(OverloadExpr *ovl,
 
 
   // Look through all of the overloaded functions, searching for one
   // Look through all of the overloaded functions, searching for one
   // whose type matches exactly.
   // whose type matches exactly.
-  FunctionDecl *Matched = 0;
+  FunctionDecl *Matched = nullptr;
   for (UnresolvedSetIterator I = ovl->decls_begin(),
   for (UnresolvedSetIterator I = ovl->decls_begin(),
          E = ovl->decls_end(); I != E; ++I) {
          E = ovl->decls_end(); I != E; ++I) {
     // C++0x [temp.arg.explicit]p3:
     // C++0x [temp.arg.explicit]p3:
@@ -10061,7 +10062,7 @@ Sema::ResolveSingleFunctionTemplateSpecialization(OverloadExpr *ovl,
     //   resulting template argument list is used to generate a single
     //   resulting template argument list is used to generate a single
     //   function template specialization, which is added to the set of
     //   function template specialization, which is added to the set of
     //   overloaded functions considered.
     //   overloaded functions considered.
-    FunctionDecl *Specialization = 0;
+    FunctionDecl *Specialization = nullptr;
     TemplateDeductionInfo Info(FailedCandidates.getLocation());
     TemplateDeductionInfo Info(FailedCandidates.getLocation());
     if (TemplateDeductionResult Result
     if (TemplateDeductionResult Result
           = DeduceTemplateArguments(FunctionTemplate, &ExplicitTemplateArgs,
           = DeduceTemplateArguments(FunctionTemplate, &ExplicitTemplateArgs,
@@ -10084,7 +10085,7 @@ Sema::ResolveSingleFunctionTemplateSpecialization(OverloadExpr *ovl,
           << ovl->getName();
           << ovl->getName();
         NoteAllOverloadCandidates(ovl);
         NoteAllOverloadCandidates(ovl);
       }
       }
-      return 0;
+      return nullptr;
     }
     }
     
     
     Matched = Specialization;
     Matched = Specialization;
@@ -10094,7 +10095,7 @@ Sema::ResolveSingleFunctionTemplateSpecialization(OverloadExpr *ovl,
   if (Matched && getLangOpts().CPlusPlus1y &&
   if (Matched && getLangOpts().CPlusPlus1y &&
       Matched->getReturnType()->isUndeducedType() &&
       Matched->getReturnType()->isUndeducedType() &&
       DeduceReturnType(Matched, ovl->getExprLoc(), Complain))
       DeduceReturnType(Matched, ovl->getExprLoc(), Complain))
-    return 0;
+    return nullptr;
 
 
   return Matched;
   return Matched;
 }
 }
@@ -10255,7 +10256,7 @@ void Sema::AddOverloadedCallCandidates(UnresolvedLookupExpr *ULE,
 
 
   // It would be nice to avoid this copy.
   // It would be nice to avoid this copy.
   TemplateArgumentListInfo TABuffer;
   TemplateArgumentListInfo TABuffer;
-  TemplateArgumentListInfo *ExplicitTemplateArgs = 0;
+  TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr;
   if (ULE->hasExplicitTemplateArgs()) {
   if (ULE->hasExplicitTemplateArgs()) {
     ULE->copyTemplateArgumentsInto(TABuffer);
     ULE->copyTemplateArgumentsInto(TABuffer);
     ExplicitTemplateArgs = &TABuffer;
     ExplicitTemplateArgs = &TABuffer;
@@ -10402,7 +10403,7 @@ DiagnoseTwoPhaseOperatorLookup(Sema &SemaRef, OverloadedOperatorKind Op,
   LookupResult R(SemaRef, OpName, OpLoc, Sema::LookupOperatorName);
   LookupResult R(SemaRef, OpName, OpLoc, Sema::LookupOperatorName);
   return DiagnoseTwoPhaseLookup(SemaRef, OpLoc, CXXScopeSpec(), R,
   return DiagnoseTwoPhaseLookup(SemaRef, OpLoc, CXXScopeSpec(), R,
                                 OverloadCandidateSet::CSK_Operator,
                                 OverloadCandidateSet::CSK_Operator,
-                                /*ExplicitTemplateArgs=*/0, Args);
+                                /*ExplicitTemplateArgs=*/nullptr, Args);
 }
 }
 
 
 namespace {
 namespace {
@@ -10446,7 +10447,7 @@ BuildRecoveryCallExpr(Sema &SemaRef, Scope *S, Expr *Fn,
   SourceLocation TemplateKWLoc = ULE->getTemplateKeywordLoc();
   SourceLocation TemplateKWLoc = ULE->getTemplateKeywordLoc();
 
 
   TemplateArgumentListInfo TABuffer;
   TemplateArgumentListInfo TABuffer;
-  TemplateArgumentListInfo *ExplicitTemplateArgs = 0;
+  TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr;
   if (ULE->hasExplicitTemplateArgs()) {
   if (ULE->hasExplicitTemplateArgs()) {
     ULE->copyTemplateArgumentsInto(TABuffer);
     ULE->copyTemplateArgumentsInto(TABuffer);
     ExplicitTemplateArgs = &TABuffer;
     ExplicitTemplateArgs = &TABuffer;
@@ -10455,7 +10456,7 @@ BuildRecoveryCallExpr(Sema &SemaRef, Scope *S, Expr *Fn,
   LookupResult R(SemaRef, ULE->getName(), ULE->getNameLoc(),
   LookupResult R(SemaRef, ULE->getName(), ULE->getNameLoc(),
                  Sema::LookupOrdinaryName);
                  Sema::LookupOrdinaryName);
   FunctionCallFilterCCC Validator(SemaRef, Args.size(),
   FunctionCallFilterCCC Validator(SemaRef, Args.size(),
-                                  ExplicitTemplateArgs != 0,
+                                  ExplicitTemplateArgs != nullptr,
                                   dyn_cast<MemberExpr>(Fn));
                                   dyn_cast<MemberExpr>(Fn));
   NoTypoCorrectionCCC RejectAll;
   NoTypoCorrectionCCC RejectAll;
   CorrectionCandidateCallback *CCC = AllowTypoCorrection ?
   CorrectionCandidateCallback *CCC = AllowTypoCorrection ?
@@ -10489,7 +10490,7 @@ BuildRecoveryCallExpr(Sema &SemaRef, Scope *S, Expr *Fn,
   // This shouldn't cause an infinite loop because we're giving it
   // This shouldn't cause an infinite loop because we're giving it
   // an expression with viable lookup results, which should never
   // an expression with viable lookup results, which should never
   // end up here.
   // end up here.
-  return SemaRef.ActOnCallExpr(/*Scope*/ 0, NewFn.take(), LParenLoc,
+  return SemaRef.ActOnCallExpr(/*Scope*/ nullptr, NewFn.take(), LParenLoc,
                                MultiExprArg(Args.data(), Args.size()),
                                MultiExprArg(Args.data(), Args.size()),
                                RParenLoc);
                                RParenLoc);
 }
 }
@@ -10695,7 +10696,7 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, unsigned OpcIn,
   if (checkPlaceholderForOverload(*this, Input))
   if (checkPlaceholderForOverload(*this, Input))
     return ExprError();
     return ExprError();
 
 
-  Expr *Args[2] = { Input, 0 };
+  Expr *Args[2] = { Input, nullptr };
   unsigned NumArgs = 1;
   unsigned NumArgs = 1;
 
 
   // For post-increment and post-decrement, add the implicit '0' as
   // For post-increment and post-decrement, add the implicit '0' as
@@ -10718,7 +10719,7 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, unsigned OpcIn,
                                                VK_RValue, OK_Ordinary,
                                                VK_RValue, OK_Ordinary,
                                                OpLoc));
                                                OpLoc));
 
 
-    CXXRecordDecl *NamingClass = 0; // because lookup ignores member operators
+    CXXRecordDecl *NamingClass = nullptr; // lookup ignores member operators
     UnresolvedLookupExpr *Fn
     UnresolvedLookupExpr *Fn
       = UnresolvedLookupExpr::Create(Context, NamingClass,
       = UnresolvedLookupExpr::Create(Context, NamingClass,
                                      NestedNameSpecifierLoc(), OpNameInfo,
                                      NestedNameSpecifierLoc(), OpNameInfo,
@@ -10741,7 +10742,8 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, unsigned OpcIn,
 
 
   // Add candidates from ADL.
   // Add candidates from ADL.
   AddArgumentDependentLookupCandidates(OpName, OpLoc, ArgsArray,
   AddArgumentDependentLookupCandidates(OpName, OpLoc, ArgsArray,
-                                       /*ExplicitTemplateArgs*/0, CandidateSet);
+                                       /*ExplicitTemplateArgs*/nullptr,
+                                       CandidateSet);
 
 
   // Add builtin operator candidates.
   // Add builtin operator candidates.
   AddBuiltinOperatorCandidates(Op, OpLoc, ArgsArray, CandidateSet);
   AddBuiltinOperatorCandidates(Op, OpLoc, ArgsArray, CandidateSet);
@@ -10761,10 +10763,10 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, unsigned OpcIn,
 
 
       // Convert the arguments.
       // Convert the arguments.
       if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(FnDecl)) {
       if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(FnDecl)) {
-        CheckMemberOperatorAccess(OpLoc, Args[0], 0, Best->FoundDecl);
+        CheckMemberOperatorAccess(OpLoc, Args[0], nullptr, Best->FoundDecl);
 
 
         ExprResult InputRes =
         ExprResult InputRes =
-          PerformObjectArgumentInitialization(Input, /*Qualifier=*/0,
+          PerformObjectArgumentInitialization(Input, /*Qualifier=*/nullptr,
                                               Best->FoundDecl, Method);
                                               Best->FoundDecl, Method);
         if (InputRes.isInvalid())
         if (InputRes.isInvalid())
           return ExprError();
           return ExprError();
@@ -10877,7 +10879,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
                             const UnresolvedSetImpl &Fns,
                             const UnresolvedSetImpl &Fns,
                             Expr *LHS, Expr *RHS) {
                             Expr *LHS, Expr *RHS) {
   Expr *Args[2] = { LHS, RHS };
   Expr *Args[2] = { LHS, RHS };
-  LHS=RHS=0; //Please use only Args instead of LHS/RHS couple
+  LHS=RHS=nullptr; // Please use only Args instead of LHS/RHS couple
 
 
   BinaryOperator::Opcode Opc = static_cast<BinaryOperator::Opcode>(OpcIn);
   BinaryOperator::Opcode Opc = static_cast<BinaryOperator::Opcode>(OpcIn);
   OverloadedOperatorKind Op = BinaryOperator::getOverloadedOperator(Opc);
   OverloadedOperatorKind Op = BinaryOperator::getOverloadedOperator(Opc);
@@ -10907,7 +10909,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
     }
     }
 
 
     // FIXME: save results of ADL from here?
     // FIXME: save results of ADL from here?
-    CXXRecordDecl *NamingClass = 0; // because lookup ignores member operators
+    CXXRecordDecl *NamingClass = nullptr; // lookup ignores member operators
     // TODO: provide better source location info in DNLoc component.
     // TODO: provide better source location info in DNLoc component.
     DeclarationNameInfo OpNameInfo(OpName, OpLoc);
     DeclarationNameInfo OpNameInfo(OpName, OpLoc);
     UnresolvedLookupExpr *Fn
     UnresolvedLookupExpr *Fn
@@ -10955,7 +10957,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
 
 
   // Add candidates from ADL.
   // Add candidates from ADL.
   AddArgumentDependentLookupCandidates(OpName, OpLoc, Args,
   AddArgumentDependentLookupCandidates(OpName, OpLoc, Args,
-                                       /*ExplicitTemplateArgs*/ 0,
+                                       /*ExplicitTemplateArgs*/ nullptr,
                                        CandidateSet);
                                        CandidateSet);
 
 
   // Add builtin operator candidates.
   // Add builtin operator candidates.
@@ -10988,7 +10990,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
             return ExprError();
             return ExprError();
 
 
           ExprResult Arg0 =
           ExprResult Arg0 =
-            PerformObjectArgumentInitialization(Args[0], /*Qualifier=*/0,
+            PerformObjectArgumentInitialization(Args[0], /*Qualifier=*/nullptr,
                                                 Best->FoundDecl, Method);
                                                 Best->FoundDecl, Method);
           if (Arg0.isInvalid())
           if (Arg0.isInvalid())
             return ExprError();
             return ExprError();
@@ -11154,7 +11156,7 @@ Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc,
   // expression.
   // expression.
   if (Args[0]->isTypeDependent() || Args[1]->isTypeDependent()) {
   if (Args[0]->isTypeDependent() || Args[1]->isTypeDependent()) {
 
 
-    CXXRecordDecl *NamingClass = 0; // because lookup ignores member operators
+    CXXRecordDecl *NamingClass = nullptr; // lookup ignores member operators
     // CHECKME: no 'operator' keyword?
     // CHECKME: no 'operator' keyword?
     DeclarationNameInfo OpNameInfo(OpName, LLoc);
     DeclarationNameInfo OpNameInfo(OpName, LLoc);
     OpNameInfo.setCXXOperatorNameRange(SourceRange(LLoc, RLoc));
     OpNameInfo.setCXXOperatorNameRange(SourceRange(LLoc, RLoc));
@@ -11208,7 +11210,7 @@ Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc,
         // Convert the arguments.
         // Convert the arguments.
         CXXMethodDecl *Method = cast<CXXMethodDecl>(FnDecl);
         CXXMethodDecl *Method = cast<CXXMethodDecl>(FnDecl);
         ExprResult Arg0 =
         ExprResult Arg0 =
-          PerformObjectArgumentInitialization(Args[0], /*Qualifier=*/0,
+          PerformObjectArgumentInitialization(Args[0], /*Qualifier=*/nullptr,
                                               Best->FoundDecl, Method);
                                               Best->FoundDecl, Method);
         if (Arg0.isInvalid())
         if (Arg0.isInvalid())
           return ExprError();
           return ExprError();
@@ -11367,10 +11369,10 @@ Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE,
                                         resultType, valueKind, RParenLoc);
                                         resultType, valueKind, RParenLoc);
 
 
     if (CheckCallReturnType(proto->getReturnType(), op->getRHS()->getLocStart(),
     if (CheckCallReturnType(proto->getReturnType(), op->getRHS()->getLocStart(),
-                            call, 0))
+                            call, nullptr))
       return ExprError();
       return ExprError();
 
 
-    if (ConvertArgumentsForCall(call, op, 0, proto, Args, RParenLoc))
+    if (ConvertArgumentsForCall(call, op, nullptr, proto, Args, RParenLoc))
       return ExprError();
       return ExprError();
 
 
     if (CheckOtherCall(call, proto))
     if (CheckOtherCall(call, proto))
@@ -11384,9 +11386,9 @@ Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE,
     return ExprError();
     return ExprError();
 
 
   MemberExpr *MemExpr;
   MemberExpr *MemExpr;
-  CXXMethodDecl *Method = 0;
-  DeclAccessPair FoundDecl = DeclAccessPair::make(0, AS_public);
-  NestedNameSpecifier *Qualifier = 0;
+  CXXMethodDecl *Method = nullptr;
+  DeclAccessPair FoundDecl = DeclAccessPair::make(nullptr, AS_public);
+  NestedNameSpecifier *Qualifier = nullptr;
   if (isa<MemberExpr>(NakedMemExpr)) {
   if (isa<MemberExpr>(NakedMemExpr)) {
     MemExpr = cast<MemberExpr>(NakedMemExpr);
     MemExpr = cast<MemberExpr>(NakedMemExpr);
     Method = cast<CXXMethodDecl>(MemExpr->getMemberDecl());
     Method = cast<CXXMethodDecl>(MemExpr->getMemberDecl());
@@ -11407,7 +11409,7 @@ Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE,
                                       OverloadCandidateSet::CSK_Normal);
                                       OverloadCandidateSet::CSK_Normal);
 
 
     // FIXME: avoid copy.
     // FIXME: avoid copy.
-    TemplateArgumentListInfo TemplateArgsBuffer, *TemplateArgs = 0;
+    TemplateArgumentListInfo TemplateArgsBuffer, *TemplateArgs = nullptr;
     if (UnresExpr->hasExplicitTemplateArgs()) {
     if (UnresExpr->hasExplicitTemplateArgs()) {
       UnresExpr->copyTemplateArgumentsInto(TemplateArgsBuffer);
       UnresExpr->copyTemplateArgumentsInto(TemplateArgsBuffer);
       TemplateArgs = &TemplateArgsBuffer;
       TemplateArgs = &TemplateArgsBuffer;
@@ -11702,14 +11704,15 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
 
 
   UnbridgedCasts.restore();
   UnbridgedCasts.restore();
 
 
-  if (Best->Function == 0) {
+  if (Best->Function == nullptr) {
     // Since there is no function declaration, this is one of the
     // Since there is no function declaration, this is one of the
     // surrogate candidates. Dig out the conversion function.
     // surrogate candidates. Dig out the conversion function.
     CXXConversionDecl *Conv
     CXXConversionDecl *Conv
       = cast<CXXConversionDecl>(
       = cast<CXXConversionDecl>(
                          Best->Conversions[0].UserDefined.ConversionFunction);
                          Best->Conversions[0].UserDefined.ConversionFunction);
 
 
-    CheckMemberOperatorAccess(LParenLoc, Object.get(), 0, Best->FoundDecl);
+    CheckMemberOperatorAccess(LParenLoc, Object.get(), nullptr,
+                              Best->FoundDecl);
     if (DiagnoseUseOfDecl(Best->FoundDecl, LParenLoc))
     if (DiagnoseUseOfDecl(Best->FoundDecl, LParenLoc))
       return ExprError();
       return ExprError();
     assert(Conv == Best->FoundDecl.getDecl() && 
     assert(Conv == Best->FoundDecl.getDecl() && 
@@ -11727,12 +11730,12 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
     // Record usage of conversion in an implicit cast.
     // Record usage of conversion in an implicit cast.
     Call = Owned(ImplicitCastExpr::Create(Context, Call.get()->getType(),
     Call = Owned(ImplicitCastExpr::Create(Context, Call.get()->getType(),
                                           CK_UserDefinedConversion,
                                           CK_UserDefinedConversion,
-                                          Call.get(), 0, VK_RValue));
+                                          Call.get(), nullptr, VK_RValue));
 
 
     return ActOnCallExpr(S, Call.get(), LParenLoc, Args, RParenLoc);
     return ActOnCallExpr(S, Call.get(), LParenLoc, Args, RParenLoc);
   }
   }
 
 
-  CheckMemberOperatorAccess(LParenLoc, Object.get(), 0, Best->FoundDecl);
+  CheckMemberOperatorAccess(LParenLoc, Object.get(), nullptr, Best->FoundDecl);
 
 
   // We found an overloaded operator(). Build a CXXOperatorCallExpr
   // We found an overloaded operator(). Build a CXXOperatorCallExpr
   // that calls this method, using Object for the implicit object
   // that calls this method, using Object for the implicit object
@@ -11788,7 +11791,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
 
 
   // Initialize the implicit object parameter.
   // Initialize the implicit object parameter.
   ExprResult ObjRes =
   ExprResult ObjRes =
-    PerformObjectArgumentInitialization(Object.get(), /*Qualifier=*/0,
+    PerformObjectArgumentInitialization(Object.get(), /*Qualifier=*/nullptr,
                                         Best->FoundDecl, Method);
                                         Best->FoundDecl, Method);
   if (ObjRes.isInvalid())
   if (ObjRes.isInvalid())
     IsError = true;
     IsError = true;
@@ -11830,7 +11833,8 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Obj,
   if (Proto->isVariadic()) {
   if (Proto->isVariadic()) {
     // Promote the arguments (C99 6.5.2.2p7).
     // Promote the arguments (C99 6.5.2.2p7).
     for (unsigned i = NumParams, e = Args.size(); i < e; i++) {
     for (unsigned i = NumParams, e = Args.size(); i < e; i++) {
-      ExprResult Arg = DefaultVariadicArgumentPromotion(Args[i], VariadicMethod, 0);
+      ExprResult Arg = DefaultVariadicArgumentPromotion(Args[i], VariadicMethod,
+                                                        nullptr);
       IsError |= Arg.isInvalid();
       IsError |= Arg.isInvalid();
       TheCall->setArg(i + 1, Arg.take());
       TheCall->setArg(i + 1, Arg.take());
     }
     }
@@ -11931,12 +11935,12 @@ Sema::BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc,
     return ExprError();
     return ExprError();
   }
   }
 
 
-  CheckMemberOperatorAccess(OpLoc, Base, 0, Best->FoundDecl);
+  CheckMemberOperatorAccess(OpLoc, Base, nullptr, Best->FoundDecl);
 
 
   // Convert the object parameter.
   // Convert the object parameter.
   CXXMethodDecl *Method = cast<CXXMethodDecl>(Best->Function);
   CXXMethodDecl *Method = cast<CXXMethodDecl>(Best->Function);
   ExprResult BaseResult =
   ExprResult BaseResult =
-    PerformObjectArgumentInitialization(Base, /*Qualifier=*/0,
+    PerformObjectArgumentInitialization(Base, /*Qualifier=*/nullptr,
                                         Best->FoundDecl, Method);
                                         Best->FoundDecl, Method);
   if (BaseResult.isInvalid())
   if (BaseResult.isInvalid())
     return ExprError();
     return ExprError();
@@ -12029,7 +12033,7 @@ ExprResult Sema::BuildLiteralOperatorCall(LookupResult &R,
   if (CheckCallReturnType(FD->getReturnType(), UDSuffixLoc, UDL, FD))
   if (CheckCallReturnType(FD->getReturnType(), UDSuffixLoc, UDL, FD))
     return ExprError();
     return ExprError();
 
 
-  if (CheckFunctionCall(FD, UDL, NULL))
+  if (CheckFunctionCall(FD, UDL, nullptr))
     return ExprError();
     return ExprError();
 
 
   return MaybeBindToTemporary(UDL);
   return MaybeBindToTemporary(UDL);
@@ -12056,16 +12060,16 @@ Sema::BuildForRangeBeginEndCall(Scope *S, SourceLocation Loc,
         BuildMemberReferenceExpr(Range, Range->getType(), Loc,
         BuildMemberReferenceExpr(Range, Range->getType(), Loc,
                                  /*IsPtr=*/false, CXXScopeSpec(),
                                  /*IsPtr=*/false, CXXScopeSpec(),
                                  /*TemplateKWLoc=*/SourceLocation(),
                                  /*TemplateKWLoc=*/SourceLocation(),
-                                 /*FirstQualifierInScope=*/0,
+                                 /*FirstQualifierInScope=*/nullptr,
                                  MemberLookup,
                                  MemberLookup,
-                                 /*TemplateArgs=*/0);
+                                 /*TemplateArgs=*/nullptr);
     if (MemberRef.isInvalid()) {
     if (MemberRef.isInvalid()) {
       *CallExpr = ExprError();
       *CallExpr = ExprError();
       Diag(Range->getLocStart(), diag::note_in_for_range)
       Diag(Range->getLocStart(), diag::note_in_for_range)
           << RangeLoc << BEF << Range->getType();
           << RangeLoc << BEF << Range->getType();
       return FRS_DiagnosticIssued;
       return FRS_DiagnosticIssued;
     }
     }
-    *CallExpr = ActOnCallExpr(S, MemberRef.get(), Loc, None, Loc, 0);
+    *CallExpr = ActOnCallExpr(S, MemberRef.get(), Loc, None, Loc, nullptr);
     if (CallExpr->isInvalid()) {
     if (CallExpr->isInvalid()) {
       *CallExpr = ExprError();
       *CallExpr = ExprError();
       Diag(Range->getLocStart(), diag::note_in_for_range)
       Diag(Range->getLocStart(), diag::note_in_for_range)
@@ -12075,7 +12079,7 @@ Sema::BuildForRangeBeginEndCall(Scope *S, SourceLocation Loc,
   } else {
   } else {
     UnresolvedSet<0> FoundNames;
     UnresolvedSet<0> FoundNames;
     UnresolvedLookupExpr *Fn =
     UnresolvedLookupExpr *Fn =
-      UnresolvedLookupExpr::Create(Context, /*NamingClass=*/0,
+      UnresolvedLookupExpr::Create(Context, /*NamingClass=*/nullptr,
                                    NestedNameSpecifierLoc(), NameInfo,
                                    NestedNameSpecifierLoc(), NameInfo,
                                    /*NeedsADL=*/true, /*Overloaded=*/false,
                                    /*NeedsADL=*/true, /*Overloaded=*/false,
                                    FoundNames.begin(), FoundNames.end());
                                    FoundNames.begin(), FoundNames.end());
@@ -12095,7 +12099,7 @@ Sema::BuildForRangeBeginEndCall(Scope *S, SourceLocation Loc,
       return FRS_NoViableFunction;
       return FRS_NoViableFunction;
     }
     }
     *CallExpr = FinishOverloadedCallExpr(*this, S, Fn, Fn, Loc, Range,
     *CallExpr = FinishOverloadedCallExpr(*this, S, Fn, Fn, Loc, Range,
-                                         Loc, 0, CandidateSet, &Best,
+                                         Loc, nullptr, CandidateSet, &Best,
                                          OverloadResult,
                                          OverloadResult,
                                          /*AllowTypoCorrection=*/false);
                                          /*AllowTypoCorrection=*/false);
     if (CallExpr->isInvalid() || OverloadResult != OR_Success) {
     if (CallExpr->isInvalid() || OverloadResult != OR_Success) {
@@ -12137,7 +12141,7 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, DeclAccessPair Found,
 
 
     return ImplicitCastExpr::Create(Context, ICE->getType(),
     return ImplicitCastExpr::Create(Context, ICE->getType(),
                                     ICE->getCastKind(),
                                     ICE->getCastKind(),
-                                    SubExpr, 0,
+                                    SubExpr, nullptr,
                                     ICE->getValueKind());
                                     ICE->getValueKind());
   }
   }
 
 
@@ -12188,7 +12192,7 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, DeclAccessPair Found,
 
 
   if (UnresolvedLookupExpr *ULE = dyn_cast<UnresolvedLookupExpr>(E)) {
   if (UnresolvedLookupExpr *ULE = dyn_cast<UnresolvedLookupExpr>(E)) {
     // FIXME: avoid copy.
     // FIXME: avoid copy.
-    TemplateArgumentListInfo TemplateArgsBuffer, *TemplateArgs = 0;
+    TemplateArgumentListInfo TemplateArgsBuffer, *TemplateArgs = nullptr;
     if (ULE->hasExplicitTemplateArgs()) {
     if (ULE->hasExplicitTemplateArgs()) {
       ULE->copyTemplateArgumentsInto(TemplateArgsBuffer);
       ULE->copyTemplateArgumentsInto(TemplateArgsBuffer);
       TemplateArgs = &TemplateArgsBuffer;
       TemplateArgs = &TemplateArgsBuffer;
@@ -12211,7 +12215,7 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, DeclAccessPair Found,
 
 
   if (UnresolvedMemberExpr *MemExpr = dyn_cast<UnresolvedMemberExpr>(E)) {
   if (UnresolvedMemberExpr *MemExpr = dyn_cast<UnresolvedMemberExpr>(E)) {
     // FIXME: avoid copy.
     // FIXME: avoid copy.
-    TemplateArgumentListInfo TemplateArgsBuffer, *TemplateArgs = 0;
+    TemplateArgumentListInfo TemplateArgsBuffer, *TemplateArgs = nullptr;
     if (MemExpr->hasExplicitTemplateArgs()) {
     if (MemExpr->hasExplicitTemplateArgs()) {
       MemExpr->copyTemplateArgumentsInto(TemplateArgsBuffer);
       MemExpr->copyTemplateArgumentsInto(TemplateArgsBuffer);
       TemplateArgs = &TemplateArgsBuffer;
       TemplateArgs = &TemplateArgsBuffer;

+ 19 - 18
lib/Sema/SemaPseudoObject.cpp

@@ -268,7 +268,8 @@ namespace {
   public:
   public:
     ObjCPropertyOpBuilder(Sema &S, ObjCPropertyRefExpr *refExpr) :
     ObjCPropertyOpBuilder(Sema &S, ObjCPropertyRefExpr *refExpr) :
       PseudoOpBuilder(S, refExpr->getLocation()), RefExpr(refExpr),
       PseudoOpBuilder(S, refExpr->getLocation()), RefExpr(refExpr),
-      SyntacticRefExpr(0), InstanceReceiver(0), Getter(0), Setter(0) {
+      SyntacticRefExpr(nullptr), InstanceReceiver(nullptr), Getter(nullptr),
+      Setter(nullptr) {
     }
     }
 
 
     ExprResult buildRValueOperation(Expr *op);
     ExprResult buildRValueOperation(Expr *op);
@@ -307,9 +308,9 @@ namespace {
     ObjCSubscriptOpBuilder(Sema &S, ObjCSubscriptRefExpr *refExpr) :
     ObjCSubscriptOpBuilder(Sema &S, ObjCSubscriptRefExpr *refExpr) :
       PseudoOpBuilder(S, refExpr->getSourceRange().getBegin()), 
       PseudoOpBuilder(S, refExpr->getSourceRange().getBegin()), 
       RefExpr(refExpr),
       RefExpr(refExpr),
-    InstanceBase(0), InstanceKey(0), 
-    AtIndexGetter(0), AtIndexSetter(0) { }
-  
+      InstanceBase(nullptr), InstanceKey(nullptr),
+      AtIndexGetter(nullptr), AtIndexSetter(nullptr) {}
+
    ExprResult buildRValueOperation(Expr *op);
    ExprResult buildRValueOperation(Expr *op);
    ExprResult buildAssignmentOperation(Scope *Sc,
    ExprResult buildAssignmentOperation(Scope *Sc,
                                        SourceLocation opLoc,
                                        SourceLocation opLoc,
@@ -579,7 +580,7 @@ bool ObjCPropertyOpBuilder::findGetter() {
 
 
   ObjCPropertyDecl *prop = RefExpr->getExplicitProperty();
   ObjCPropertyDecl *prop = RefExpr->getExplicitProperty();
   Getter = LookupMethodInReceiverType(S, prop->getGetterName(), RefExpr);
   Getter = LookupMethodInReceiverType(S, prop->getGetterName(), RefExpr);
-  return (Getter != 0);
+  return (Getter != nullptr);
 }
 }
 
 
 /// Try to find the most accurate setter declaration for the property
 /// Try to find the most accurate setter declaration for the property
@@ -644,7 +645,7 @@ bool ObjCPropertyOpBuilder::findSetter(bool warn) {
 
 
 /// Capture the base object of an Objective-C property expression.
 /// Capture the base object of an Objective-C property expression.
 Expr *ObjCPropertyOpBuilder::rebuildAndCaptureObject(Expr *syntacticBase) {
 Expr *ObjCPropertyOpBuilder::rebuildAndCaptureObject(Expr *syntacticBase) {
-  assert(InstanceReceiver == 0);
+  assert(InstanceReceiver == nullptr);
 
 
   // If we have a base, capture it in an OVE and rebuild the syntactic
   // If we have a base, capture it in an OVE and rebuild the syntactic
   // form to use the OVE as its base.
   // form to use the OVE as its base.
@@ -967,8 +968,8 @@ ObjCSubscriptOpBuilder::buildAssignmentOperation(Scope *Sc,
 
 
 /// Capture the base object of an Objective-C Index'ed expression.
 /// Capture the base object of an Objective-C Index'ed expression.
 Expr *ObjCSubscriptOpBuilder::rebuildAndCaptureObject(Expr *syntacticBase) {
 Expr *ObjCSubscriptOpBuilder::rebuildAndCaptureObject(Expr *syntacticBase) {
-  assert(InstanceBase == 0);
-  
+  assert(InstanceBase == nullptr);
+
   // Capture base expression in an OVE and rebuild the syntactic
   // Capture base expression in an OVE and rebuild the syntactic
   // form to use the OVE as its base expression.
   // form to use the OVE as its base expression.
   InstanceBase = capture(RefExpr->getBaseExpr());
   InstanceBase = capture(RefExpr->getBaseExpr());
@@ -1134,7 +1135,7 @@ bool ObjCSubscriptOpBuilder::findAtIndexGetter() {
     AtIndexGetter = ObjCMethodDecl::Create(S.Context, SourceLocation(), 
     AtIndexGetter = ObjCMethodDecl::Create(S.Context, SourceLocation(), 
                            SourceLocation(), AtIndexGetterSelector,
                            SourceLocation(), AtIndexGetterSelector,
                            S.Context.getObjCIdType() /*ReturnType*/,
                            S.Context.getObjCIdType() /*ReturnType*/,
-                           0 /*TypeSourceInfo */,
+                           nullptr /*TypeSourceInfo */,
                            S.Context.getTranslationUnitDecl(),
                            S.Context.getTranslationUnitDecl(),
                            true /*Instance*/, false/*isVariadic*/,
                            true /*Instance*/, false/*isVariadic*/,
                            /*isPropertyAccessor=*/false,
                            /*isPropertyAccessor=*/false,
@@ -1147,9 +1148,9 @@ bool ObjCSubscriptOpBuilder::findAtIndexGetter() {
                                                          : &S.Context.Idents.get("key"),
                                                          : &S.Context.Idents.get("key"),
                                                 arrayRef ? S.Context.UnsignedLongTy
                                                 arrayRef ? S.Context.UnsignedLongTy
                                                          : S.Context.getObjCIdType(),
                                                          : S.Context.getObjCIdType(),
-                                                /*TInfo=*/0,
+                                                /*TInfo=*/nullptr,
                                                 SC_None,
                                                 SC_None,
-                                                0);
+                                                nullptr);
     AtIndexGetter->setMethodParams(S.Context, Argument, None);
     AtIndexGetter->setMethodParams(S.Context, Argument, None);
   }
   }
 
 
@@ -1243,7 +1244,7 @@ bool ObjCSubscriptOpBuilder::findAtIndexSetter() {
                          BaseT->isObjCQualifiedIdType());
                          BaseT->isObjCQualifiedIdType());
 
 
   if (!AtIndexSetter && S.getLangOpts().DebuggerObjCLiteral) {
   if (!AtIndexSetter && S.getLangOpts().DebuggerObjCLiteral) {
-    TypeSourceInfo *ReturnTInfo = 0;
+    TypeSourceInfo *ReturnTInfo = nullptr;
     QualType ReturnType = S.Context.VoidTy;
     QualType ReturnType = S.Context.VoidTy;
     AtIndexSetter = ObjCMethodDecl::Create(
     AtIndexSetter = ObjCMethodDecl::Create(
         S.Context, SourceLocation(), SourceLocation(), AtIndexSetterSelector,
         S.Context, SourceLocation(), SourceLocation(), AtIndexSetterSelector,
@@ -1257,9 +1258,9 @@ bool ObjCSubscriptOpBuilder::findAtIndexSetter() {
                                                 SourceLocation(), SourceLocation(),
                                                 SourceLocation(), SourceLocation(),
                                                 &S.Context.Idents.get("object"),
                                                 &S.Context.Idents.get("object"),
                                                 S.Context.getObjCIdType(),
                                                 S.Context.getObjCIdType(),
-                                                /*TInfo=*/0,
+                                                /*TInfo=*/nullptr,
                                                 SC_None,
                                                 SC_None,
-                                                0);
+                                                nullptr);
     Params.push_back(object);
     Params.push_back(object);
     ParmVarDecl *key = ParmVarDecl::Create(S.Context, AtIndexSetter,
     ParmVarDecl *key = ParmVarDecl::Create(S.Context, AtIndexSetter,
                                                 SourceLocation(), SourceLocation(),
                                                 SourceLocation(), SourceLocation(),
@@ -1267,9 +1268,9 @@ bool ObjCSubscriptOpBuilder::findAtIndexSetter() {
                                                          :  &S.Context.Idents.get("key"),
                                                          :  &S.Context.Idents.get("key"),
                                                 arrayRef ? S.Context.UnsignedLongTy
                                                 arrayRef ? S.Context.UnsignedLongTy
                                                          : S.Context.getObjCIdType(),
                                                          : S.Context.getObjCIdType(),
-                                                /*TInfo=*/0,
+                                                /*TInfo=*/nullptr,
                                                 SC_None,
                                                 SC_None,
-                                                0);
+                                                nullptr);
     Params.push_back(key);
     Params.push_back(key);
     AtIndexSetter->setMethodParams(S.Context, Params, None);
     AtIndexSetter->setMethodParams(S.Context, Params, None);
   }
   }
@@ -1409,7 +1410,7 @@ ExprResult MSPropertyOpBuilder::buildGet() {
   ExprResult GetterExpr = S.ActOnMemberAccessExpr(
   ExprResult GetterExpr = S.ActOnMemberAccessExpr(
     S.getCurScope(), RefExpr->getBaseExpr(), SourceLocation(),
     S.getCurScope(), RefExpr->getBaseExpr(), SourceLocation(),
     RefExpr->isArrow() ? tok::arrow : tok::period, SS, SourceLocation(),
     RefExpr->isArrow() ? tok::arrow : tok::period, SS, SourceLocation(),
-    GetterName, 0, true);
+    GetterName, nullptr, true);
   if (GetterExpr.isInvalid()) {
   if (GetterExpr.isInvalid()) {
     S.Diag(RefExpr->getMemberLoc(),
     S.Diag(RefExpr->getMemberLoc(),
            diag::error_cannot_find_suitable_accessor) << 0 /* getter */
            diag::error_cannot_find_suitable_accessor) << 0 /* getter */
@@ -1439,7 +1440,7 @@ ExprResult MSPropertyOpBuilder::buildSet(Expr *op, SourceLocation sl,
   ExprResult SetterExpr = S.ActOnMemberAccessExpr(
   ExprResult SetterExpr = S.ActOnMemberAccessExpr(
     S.getCurScope(), RefExpr->getBaseExpr(), SourceLocation(),
     S.getCurScope(), RefExpr->getBaseExpr(), SourceLocation(),
     RefExpr->isArrow() ? tok::arrow : tok::period, SS, SourceLocation(),
     RefExpr->isArrow() ? tok::arrow : tok::period, SS, SourceLocation(),
-    SetterName, 0, true);
+    SetterName, nullptr, true);
   if (SetterExpr.isInvalid()) {
   if (SetterExpr.isInvalid()) {
     S.Diag(RefExpr->getMemberLoc(),
     S.Diag(RefExpr->getMemberLoc(),
            diag::error_cannot_find_suitable_accessor) << 1 /* setter */
            diag::error_cannot_find_suitable_accessor) << 1 /* setter */

+ 33 - 32
lib/Sema/SemaStmt.cpp

@@ -95,7 +95,7 @@ void Sema::ActOnForEachDeclStmt(DeclGroupPtrTy dg) {
 
 
   // foreach variables are never actually initialized in the way that
   // foreach variables are never actually initialized in the way that
   // the parser came up with.
   // the parser came up with.
-  var->setInit(0);
+  var->setInit(nullptr);
 
 
   // In ARC, we don't need to retain the iteration variable of a fast
   // In ARC, we don't need to retain the iteration variable of a fast
   // enumeration loop.  Rather than actually trying to catch that
   // enumeration loop.  Rather than actually trying to catch that
@@ -289,7 +289,7 @@ void Sema::DiagnoseUnusedExprResult(const Stmt *S) {
     return;
     return;
   }
   }
 
 
-  DiagRuntimeBehavior(Loc, 0, PDiag(DiagID) << R1 << R2);
+  DiagRuntimeBehavior(Loc, nullptr, PDiag(DiagID) << R1 << R2);
 }
 }
 
 
 void Sema::ActOnStartOfCompoundStmt() {
 void Sema::ActOnStartOfCompoundStmt() {
@@ -351,7 +351,7 @@ StmtResult
 Sema::ActOnCaseStmt(SourceLocation CaseLoc, Expr *LHSVal,
 Sema::ActOnCaseStmt(SourceLocation CaseLoc, Expr *LHSVal,
                     SourceLocation DotDotDotLoc, Expr *RHSVal,
                     SourceLocation DotDotDotLoc, Expr *RHSVal,
                     SourceLocation ColonLoc) {
                     SourceLocation ColonLoc) {
-  assert((LHSVal != 0) && "missing expression in case statement");
+  assert(LHSVal && "missing expression in case statement");
 
 
   if (getCurFunction()->SwitchStack.empty()) {
   if (getCurFunction()->SwitchStack.empty()) {
     Diag(CaseLoc, diag::err_case_not_in_switch);
     Diag(CaseLoc, diag::err_case_not_in_switch);
@@ -451,7 +451,7 @@ Sema::ActOnIfStmt(SourceLocation IfLoc, FullExprArg CondVal, Decl *CondVar,
 
 
   ExprResult CondResult(CondVal.release());
   ExprResult CondResult(CondVal.release());
 
 
-  VarDecl *ConditionVar = 0;
+  VarDecl *ConditionVar = nullptr;
   if (CondVar) {
   if (CondVar) {
     ConditionVar = cast<VarDecl>(CondVar);
     ConditionVar = cast<VarDecl>(CondVar);
     CondResult = CheckConditionVariable(ConditionVar, IfLoc, true);
     CondResult = CheckConditionVariable(ConditionVar, IfLoc, true);
@@ -580,7 +580,7 @@ Sema::ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, Expr *Cond,
                              Decl *CondVar) {
                              Decl *CondVar) {
   ExprResult CondResult;
   ExprResult CondResult;
 
 
-  VarDecl *ConditionVar = 0;
+  VarDecl *ConditionVar = nullptr;
   if (CondVar) {
   if (CondVar) {
     ConditionVar = cast<VarDecl>(CondVar);
     ConditionVar = cast<VarDecl>(CondVar);
     CondResult = CheckConditionVariable(ConditionVar, SourceLocation(), false);
     CondResult = CheckConditionVariable(ConditionVar, SourceLocation(), false);
@@ -757,7 +757,7 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch,
   typedef std::vector<std::pair<llvm::APSInt, CaseStmt*> > CaseRangesTy;
   typedef std::vector<std::pair<llvm::APSInt, CaseStmt*> > CaseRangesTy;
   CaseRangesTy CaseRanges;
   CaseRangesTy CaseRanges;
 
 
-  DefaultStmt *TheDefaultStmt = 0;
+  DefaultStmt *TheDefaultStmt = nullptr;
 
 
   bool CaseListIsErroneous = false;
   bool CaseListIsErroneous = false;
 
 
@@ -964,7 +964,7 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch,
 
 
         // Check to see whether the case range overlaps with any
         // Check to see whether the case range overlaps with any
         // singleton cases.
         // singleton cases.
-        CaseStmt *OverlapStmt = 0;
+        CaseStmt *OverlapStmt = nullptr;
         llvm::APSInt OverlapVal(32);
         llvm::APSInt OverlapVal(32);
 
 
         // Find the smallest value >= the lower bound.  If I is in the
         // Find the smallest value >= the lower bound.  If I is in the
@@ -1208,7 +1208,7 @@ Sema::ActOnWhileStmt(SourceLocation WhileLoc, FullExprArg Cond,
                      Decl *CondVar, Stmt *Body) {
                      Decl *CondVar, Stmt *Body) {
   ExprResult CondResult(Cond.release());
   ExprResult CondResult(Cond.release());
 
 
-  VarDecl *ConditionVar = 0;
+  VarDecl *ConditionVar = nullptr;
   if (CondVar) {
   if (CondVar) {
     ConditionVar = cast<VarDecl>(CondVar);
     ConditionVar = cast<VarDecl>(CondVar);
     CondResult = CheckConditionVariable(ConditionVar, WhileLoc, true);
     CondResult = CheckConditionVariable(ConditionVar, WhileLoc, true);
@@ -1599,8 +1599,8 @@ Sema::ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc,
       for (auto *DI : DS->decls()) {
       for (auto *DI : DS->decls()) {
         VarDecl *VD = dyn_cast<VarDecl>(DI);
         VarDecl *VD = dyn_cast<VarDecl>(DI);
         if (VD && VD->isLocalVarDecl() && !VD->hasLocalStorage())
         if (VD && VD->isLocalVarDecl() && !VD->hasLocalStorage())
-          VD = 0;
-        if (VD == 0) {
+          VD = nullptr;
+        if (!VD) {
           Diag(DI->getLocation(), diag::err_non_local_variable_decl_in_for);
           Diag(DI->getLocation(), diag::err_non_local_variable_decl_in_for);
           DI->setInvalidDecl();
           DI->setInvalidDecl();
         }
         }
@@ -1615,7 +1615,7 @@ Sema::ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc,
   CheckForRedundantIteration(*this, third.get(), Body);
   CheckForRedundantIteration(*this, third.get(), Body);
 
 
   ExprResult SecondResult(second.release());
   ExprResult SecondResult(second.release());
-  VarDecl *ConditionVar = 0;
+  VarDecl *ConditionVar = nullptr;
   if (secondVar) {
   if (secondVar) {
     ConditionVar = cast<VarDecl>(secondVar);
     ConditionVar = cast<VarDecl>(secondVar);
     SecondResult = CheckConditionVariable(ConditionVar, ForLoc, true);
     SecondResult = CheckConditionVariable(ConditionVar, ForLoc, true);
@@ -1700,7 +1700,7 @@ Sema::CheckObjCForCollectionOperand(SourceLocation forLoc, Expr *collection) {
     };
     };
     Selector selector = Context.Selectors.getSelector(3, &selectorIdents[0]);
     Selector selector = Context.Selectors.getSelector(3, &selectorIdents[0]);
 
 
-    ObjCMethodDecl *method = 0;
+    ObjCMethodDecl *method = nullptr;
 
 
     // If there's an interface, look in both the public and private APIs.
     // If there's an interface, look in both the public and private APIs.
     if (iface) {
     if (iface) {
@@ -1803,8 +1803,8 @@ Sema::ActOnObjCForCollectionStmt(SourceLocation ForLoc,
     return StmtError();
     return StmtError();
 
 
   return Owned(new (Context) ObjCForCollectionStmt(First,
   return Owned(new (Context) ObjCForCollectionStmt(First,
-                                                   CollectionExprResult.take(), 0,
-                                                   ForLoc, RParenLoc));
+                                                   CollectionExprResult.take(),
+                                                   nullptr, ForLoc, RParenLoc));
 }
 }
 
 
 /// Finish building a variable declaration for a for-range statement.
 /// Finish building a variable declaration for a for-range statement.
@@ -1882,7 +1882,7 @@ VarDecl *BuildForRangeVarDecl(Sema &SemaRef, SourceLocation Loc,
 
 
 static bool ObjCEnumerationCollection(Expr *Collection) {
 static bool ObjCEnumerationCollection(Expr *Collection) {
   return !Collection->isTypeDependent()
   return !Collection->isTypeDependent()
-          && Collection->getType()->getAs<ObjCObjectPointerType>() != 0;
+          && Collection->getType()->getAs<ObjCObjectPointerType>() != nullptr;
 }
 }
 
 
 /// ActOnCXXForRangeStmt - Check and build a C++11 for-range statement.
 /// ActOnCXXForRangeStmt - Check and build a C++11 for-range statement.
@@ -1950,8 +1950,8 @@ Sema::ActOnCXXForRangeStmt(SourceLocation ForLoc,
   }
   }
 
 
   return BuildCXXForRangeStmt(ForLoc, ColonLoc, RangeDecl.get(),
   return BuildCXXForRangeStmt(ForLoc, ColonLoc, RangeDecl.get(),
-                              /*BeginEndDecl=*/0, /*Cond=*/0, /*Inc=*/0, DS,
-                              RParenLoc, Kind);
+                              /*BeginEndDecl=*/nullptr, /*Cond=*/nullptr,
+                              /*Inc=*/nullptr, DS, RParenLoc, Kind);
 }
 }
 
 
 /// \brief Create the initialization, compare, and increment steps for
 /// \brief Create the initialization, compare, and increment steps for
@@ -2335,8 +2335,8 @@ Sema::BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation ColonLoc,
   return Owned(new (Context) CXXForRangeStmt(RangeDS,
   return Owned(new (Context) CXXForRangeStmt(RangeDS,
                                      cast_or_null<DeclStmt>(BeginEndDecl.get()),
                                      cast_or_null<DeclStmt>(BeginEndDecl.get()),
                                              NotEqExpr.take(), IncrExpr.take(),
                                              NotEqExpr.take(), IncrExpr.take(),
-                                             LoopVarDS, /*Body=*/0, ForLoc,
-                                             ColonLoc, RParenLoc));
+                                             LoopVarDS, /*Body=*/nullptr,
+                                             ForLoc, ColonLoc, RParenLoc));
 }
 }
 
 
 /// FinishObjCForCollectionStmt - Attach the body to a objective-C foreach
 /// FinishObjCForCollectionStmt - Attach the body to a objective-C foreach
@@ -2560,7 +2560,7 @@ Sema::PerformMoveOrCopyInitialization(const InitializedEntity &Entity,
         // Promote "AsRvalue" to the heap, since we now need this
         // Promote "AsRvalue" to the heap, since we now need this
         // expression node to persist.
         // expression node to persist.
         Value = ImplicitCastExpr::Create(Context, Value->getType(),
         Value = ImplicitCastExpr::Create(Context, Value->getType(),
-                                         CK_NoOp, Value, 0, VK_XValue);
+                                         CK_NoOp, Value, nullptr, VK_XValue);
 
 
         // Complete type-checking the initialization of the return type
         // Complete type-checking the initialization of the return type
         // using the constructor we found.
         // using the constructor we found.
@@ -2666,7 +2666,7 @@ Sema::ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) {
   // Otherwise, verify that this result type matches the previous one.  We are
   // Otherwise, verify that this result type matches the previous one.  We are
   // pickier with blocks than for normal functions because we don't have GCC
   // pickier with blocks than for normal functions because we don't have GCC
   // compatibility to worry about here.
   // compatibility to worry about here.
-  const VarDecl *NRVOCandidate = 0;
+  const VarDecl *NRVOCandidate = nullptr;
   if (FnRetType->isDependentType()) {
   if (FnRetType->isDependentType()) {
     // Delay processing for now.  TODO: there are lots of dependent
     // Delay processing for now.  TODO: there are lots of dependent
     // types we can conclusively prove aren't void.
     // types we can conclusively prove aren't void.
@@ -2680,7 +2680,7 @@ Sema::ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) {
         Diag(ReturnLoc, diag::ext_return_has_void_expr) << "literal" << 2;
         Diag(ReturnLoc, diag::ext_return_has_void_expr) << "literal" << 2;
       else {
       else {
         Diag(ReturnLoc, diag::err_return_block_has_expr);
         Diag(ReturnLoc, diag::err_return_block_has_expr);
-        RetValExp = 0;
+        RetValExp = nullptr;
       }
       }
     }
     }
   } else if (!RetValExp) {
   } else if (!RetValExp) {
@@ -2697,7 +2697,7 @@ Sema::ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) {
     NRVOCandidate = getCopyElisionCandidate(FnRetType, RetValExp, false);
     NRVOCandidate = getCopyElisionCandidate(FnRetType, RetValExp, false);
     InitializedEntity Entity = InitializedEntity::InitializeResult(ReturnLoc,
     InitializedEntity Entity = InitializedEntity::InitializeResult(ReturnLoc,
                                                                    FnRetType,
                                                                    FnRetType,
-                                                          NRVOCandidate != 0);
+                                                      NRVOCandidate != nullptr);
     ExprResult Res = PerformMoveOrCopyInitialization(Entity, NRVOCandidate,
     ExprResult Res = PerformMoveOrCopyInitialization(Entity, NRVOCandidate,
                                                      FnRetType, RetValExp);
                                                      FnRetType, RetValExp);
     if (Res.isInvalid()) {
     if (Res.isInvalid()) {
@@ -2846,7 +2846,7 @@ StmtResult Sema::BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) {
 
 
   QualType FnRetType;
   QualType FnRetType;
   QualType RelatedRetType;
   QualType RelatedRetType;
-  const AttrVec *Attrs = 0;
+  const AttrVec *Attrs = nullptr;
   bool isObjCMethod = false;
   bool isObjCMethod = false;
 
 
   if (const FunctionDecl *FD = getCurFunctionDecl()) {
   if (const FunctionDecl *FD = getCurFunctionDecl()) {
@@ -2887,7 +2887,7 @@ StmtResult Sema::BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) {
 
 
   bool HasDependentReturnType = FnRetType->isDependentType();
   bool HasDependentReturnType = FnRetType->isDependentType();
 
 
-  ReturnStmt *Result = 0;
+  ReturnStmt *Result = nullptr;
   if (FnRetType->isVoidType()) {
   if (FnRetType->isVoidType()) {
     if (RetValExp) {
     if (RetValExp) {
       if (isa<InitListExpr>(RetValExp)) {
       if (isa<InitListExpr>(RetValExp)) {
@@ -2908,7 +2908,7 @@ StmtResult Sema::BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) {
           << RetValExp->getSourceRange();
           << RetValExp->getSourceRange();
 
 
         // Drop the expression.
         // Drop the expression.
-        RetValExp = 0;
+        RetValExp = nullptr;
       } else if (!RetValExp->isTypeDependent()) {
       } else if (!RetValExp->isTypeDependent()) {
         // C99 6.8.6.4p1 (ext_ since GCC warns)
         // C99 6.8.6.4p1 (ext_ since GCC warns)
         unsigned D = diag::ext_return_has_expr;
         unsigned D = diag::ext_return_has_expr;
@@ -2963,7 +2963,7 @@ StmtResult Sema::BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) {
       }
       }
     }
     }
 
 
-    Result = new (Context) ReturnStmt(ReturnLoc, RetValExp, 0);
+    Result = new (Context) ReturnStmt(ReturnLoc, RetValExp, nullptr);
   } else if (!RetValExp && !HasDependentReturnType) {
   } else if (!RetValExp && !HasDependentReturnType) {
     unsigned DiagID = diag::warn_return_missing_expr;  // C90 6.6.6.4p4
     unsigned DiagID = diag::warn_return_missing_expr;  // C90 6.6.6.4p4
     // C99 6.8.6.4p1 (ext_ since GCC warns)
     // C99 6.8.6.4p1 (ext_ since GCC warns)
@@ -2976,7 +2976,7 @@ StmtResult Sema::BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) {
     Result = new (Context) ReturnStmt(ReturnLoc);
     Result = new (Context) ReturnStmt(ReturnLoc);
   } else {
   } else {
     assert(RetValExp || HasDependentReturnType);
     assert(RetValExp || HasDependentReturnType);
-    const VarDecl *NRVOCandidate = 0;
+    const VarDecl *NRVOCandidate = nullptr;
 
 
     QualType RetType = RelatedRetType.isNull() ? FnRetType : RelatedRetType;
     QualType RetType = RelatedRetType.isNull() ? FnRetType : RelatedRetType;
 
 
@@ -2992,7 +2992,7 @@ StmtResult Sema::BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) {
       // we have a non-void function with an expression, continue checking
       // we have a non-void function with an expression, continue checking
       InitializedEntity Entity = InitializedEntity::InitializeResult(ReturnLoc,
       InitializedEntity Entity = InitializedEntity::InitializeResult(ReturnLoc,
                                                                      RetType,
                                                                      RetType,
-                                                            NRVOCandidate != 0);
+                                                      NRVOCandidate != nullptr);
       ExprResult Res = PerformMoveOrCopyInitialization(Entity, NRVOCandidate,
       ExprResult Res = PerformMoveOrCopyInitialization(Entity, NRVOCandidate,
                                                        RetType, RetValExp);
                                                        RetType, RetValExp);
       if (Res.isInvalid()) {
       if (Res.isInvalid()) {
@@ -3314,11 +3314,12 @@ Sema::CreateCapturedStmtRecordDecl(CapturedDecl *&CD, SourceLocation Loc,
   while (!(DC->isFunctionOrMethod() || DC->isRecord() || DC->isFileContext()))
   while (!(DC->isFunctionOrMethod() || DC->isRecord() || DC->isFileContext()))
     DC = DC->getParent();
     DC = DC->getParent();
 
 
-  RecordDecl *RD = 0;
+  RecordDecl *RD = nullptr;
   if (getLangOpts().CPlusPlus)
   if (getLangOpts().CPlusPlus)
-    RD = CXXRecordDecl::Create(Context, TTK_Struct, DC, Loc, Loc, /*Id=*/0);
+    RD = CXXRecordDecl::Create(Context, TTK_Struct, DC, Loc, Loc,
+                               /*Id=*/nullptr);
   else
   else
-    RD = RecordDecl::Create(Context, TTK_Struct, DC, Loc, Loc, /*Id=*/0);
+    RD = RecordDecl::Create(Context, TTK_Struct, DC, Loc, Loc, /*Id=*/nullptr);
 
 
   DC->addDecl(RD);
   DC->addDecl(RD);
   RD->setImplicit();
   RD->setImplicit();

+ 2 - 2
lib/Sema/SemaStmtAsm.cpp

@@ -381,7 +381,7 @@ ExprResult Sema::LookupInlineAsmIdentifier(CXXScopeSpec &SS,
   ExprResult Result = ActOnIdExpression(getCurScope(), SS, TemplateKWLoc, Id,
   ExprResult Result = ActOnIdExpression(getCurScope(), SS, TemplateKWLoc, Id,
                                         /*trailing lparen*/ false,
                                         /*trailing lparen*/ false,
                                         /*is & operand*/ false,
                                         /*is & operand*/ false,
-                                        /*CorrectionCandidateCallback=*/0,
+                                        /*CorrectionCandidateCallback=*/nullptr,
                                         /*IsInlineAsmIdentifier=*/ true);
                                         /*IsInlineAsmIdentifier=*/ true);
 
 
   if (IsUnevaluatedContext)
   if (IsUnevaluatedContext)
@@ -437,7 +437,7 @@ bool Sema::LookupInlineAsmField(StringRef Base, StringRef Member,
   if (!BaseResult.isSingleResult())
   if (!BaseResult.isSingleResult())
     return true;
     return true;
 
 
-  const RecordType *RT = 0;
+  const RecordType *RT = nullptr;
   NamedDecl *FoundDecl = BaseResult.getFoundDecl();
   NamedDecl *FoundDecl = BaseResult.getFoundDecl();
   if (VarDecl *VD = dyn_cast<VarDecl>(FoundDecl))
   if (VarDecl *VD = dyn_cast<VarDecl>(FoundDecl))
     RT = VD->getType()->getAs<RecordType>();
     RT = VD->getType()->getAs<RecordType>();

+ 4 - 4
lib/Sema/SemaStmtAttr.cpp

@@ -32,11 +32,11 @@ static Attr *handleFallThroughAttr(Sema &S, Stmt *St, const AttributeList &A,
       S.Diag(L, diag::note_fallthrough_insert_semi_fixit)
       S.Diag(L, diag::note_fallthrough_insert_semi_fixit)
           << FixItHint::CreateInsertion(L, ";");
           << FixItHint::CreateInsertion(L, ";");
     }
     }
-    return 0;
+    return nullptr;
   }
   }
   if (S.getCurFunction()->SwitchStack.empty()) {
   if (S.getCurFunction()->SwitchStack.empty()) {
     S.Diag(A.getRange().getBegin(), diag::err_fallthrough_attr_outside_switch);
     S.Diag(A.getRange().getBegin(), diag::err_fallthrough_attr_outside_switch);
-    return 0;
+    return nullptr;
   }
   }
   return ::new (S.Context) FallThroughAttr(A.getRange(), S.Context,
   return ::new (S.Context) FallThroughAttr(A.getRange(), S.Context,
                                            A.getAttributeSpellingListIndex());
                                            A.getAttributeSpellingListIndex());
@@ -50,7 +50,7 @@ static Attr *ProcessStmtAttribute(Sema &S, Stmt *St, const AttributeList &A,
     S.Diag(A.getLoc(), A.isDeclspecAttribute() ?
     S.Diag(A.getLoc(), A.isDeclspecAttribute() ?
            diag::warn_unhandled_ms_attribute_ignored :
            diag::warn_unhandled_ms_attribute_ignored :
            diag::warn_unknown_attribute_ignored) << A.getName();
            diag::warn_unknown_attribute_ignored) << A.getName();
-    return 0;
+    return nullptr;
   case AttributeList::AT_FallThrough:
   case AttributeList::AT_FallThrough:
     return handleFallThroughAttr(S, St, A, Range);
     return handleFallThroughAttr(S, St, A, Range);
   default:
   default:
@@ -58,7 +58,7 @@ static Attr *ProcessStmtAttribute(Sema &S, Stmt *St, const AttributeList &A,
     // it as a statement attribute => it is declaration attribute
     // it as a statement attribute => it is declaration attribute
     S.Diag(A.getRange().getBegin(), diag::err_attribute_invalid_on_stmt)
     S.Diag(A.getRange().getBegin(), diag::err_attribute_invalid_on_stmt)
         << A.getName() << St->getLocStart();
         << A.getName() << St->getLocStart();
-    return 0;
+    return nullptr;
   }
   }
 }
 }
 
 

+ 68 - 64
lib/Sema/SemaTemplate.cpp

@@ -52,8 +52,8 @@ static NamedDecl *isAcceptableTemplateName(ASTContext &Context,
 
 
   if (isa<TemplateDecl>(D)) {
   if (isa<TemplateDecl>(D)) {
     if (!AllowFunctionTemplates && isa<FunctionTemplateDecl>(D))
     if (!AllowFunctionTemplates && isa<FunctionTemplateDecl>(D))
-      return 0;
-    
+      return nullptr;
+
     return Orig;
     return Orig;
   }
   }
 
 
@@ -79,10 +79,10 @@ static NamedDecl *isAcceptableTemplateName(ASTContext &Context,
         return Spec->getSpecializedTemplate();
         return Spec->getSpecializedTemplate();
     }
     }
 
 
-    return 0;
+    return nullptr;
   }
   }
 
 
-  return 0;
+  return nullptr;
 }
 }
 
 
 void Sema::FilterAcceptableTemplateNames(LookupResult &R, 
 void Sema::FilterAcceptableTemplateNames(LookupResult &R, 
@@ -250,7 +250,7 @@ void Sema::LookupTemplateName(LookupResult &Found,
                               bool &MemberOfUnknownSpecialization) {
                               bool &MemberOfUnknownSpecialization) {
   // Determine where to perform name lookup
   // Determine where to perform name lookup
   MemberOfUnknownSpecialization = false;
   MemberOfUnknownSpecialization = false;
-  DeclContext *LookupCtx = 0;
+  DeclContext *LookupCtx = nullptr;
   bool isDependent = false;
   bool isDependent = false;
   if (!ObjectType.isNull()) {
   if (!ObjectType.isNull()) {
     // This nested-name-specifier occurs in a member access expression, e.g.,
     // This nested-name-specifier occurs in a member access expression, e.g.,
@@ -419,10 +419,10 @@ Sema::ActOnDependentIdExpression(const CXXScopeSpec &SS,
 
 
     // Since the 'this' expression is synthesized, we don't need to
     // Since the 'this' expression is synthesized, we don't need to
     // perform the double-lookup check.
     // perform the double-lookup check.
-    NamedDecl *FirstQualifierInScope = 0;
+    NamedDecl *FirstQualifierInScope = nullptr;
 
 
     return Owned(CXXDependentScopeMemberExpr::Create(Context,
     return Owned(CXXDependentScopeMemberExpr::Create(Context,
-                                                     /*This*/ 0, ThisType,
+                                                     /*This*/ nullptr, ThisType,
                                                      /*IsArrow*/ true,
                                                      /*IsArrow*/ true,
                                                      /*Op*/ SourceLocation(),
                                                      /*Op*/ SourceLocation(),
                                                SS.getWithLocInContext(Context),
                                                SS.getWithLocInContext(Context),
@@ -475,7 +475,7 @@ TemplateDecl *Sema::AdjustDeclIfTemplate(Decl *&D) {
     D = Temp->getTemplatedDecl();
     D = Temp->getTemplatedDecl();
     return Temp;
     return Temp;
   }
   }
-  return 0;
+  return nullptr;
 }
 }
 
 
 ParsedTemplateArgument ParsedTemplateArgument::getTemplatePackExpansion(
 ParsedTemplateArgument ParsedTemplateArgument::getTemplatePackExpansion(
@@ -716,7 +716,7 @@ Decl *Sema::ActOnNonTypeTemplateParameter(Scope *S, Declarator &D,
   //   template-parameter that is not a template parameter pack.
   //   template-parameter that is not a template parameter pack.
   if (Default && IsParameterPack) {
   if (Default && IsParameterPack) {
     Diag(EqualLoc, diag::err_template_param_pack_default_arg);
     Diag(EqualLoc, diag::err_template_param_pack_default_arg);
-    Default = 0;
+    Default = nullptr;
   }
   }
 
 
   // Check the well-formedness of the default template argument, if provided.
   // Check the well-formedness of the default template argument, if provided.
@@ -907,7 +907,7 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
   if (Previous.isAmbiguous())
   if (Previous.isAmbiguous())
     return true;
     return true;
 
 
-  NamedDecl *PrevDecl = 0;
+  NamedDecl *PrevDecl = nullptr;
   if (Previous.begin() != Previous.end())
   if (Previous.begin() != Previous.end())
     PrevDecl = (*Previous.begin())->getUnderlyingDecl();
     PrevDecl = (*Previous.begin())->getUnderlyingDecl();
 
 
@@ -950,7 +950,7 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
         // Declarations in outer scopes don't matter. However, the outermost
         // Declarations in outer scopes don't matter. However, the outermost
         // context we computed is the semantic context for our new
         // context we computed is the semantic context for our new
         // declaration.
         // declaration.
-        PrevDecl = PrevClassTemplate = 0;
+        PrevDecl = PrevClassTemplate = nullptr;
         SemanticContext = OutermostContext;
         SemanticContext = OutermostContext;
 
 
         // Check that the chosen semantic context doesn't already contain a
         // Check that the chosen semantic context doesn't already contain a
@@ -971,7 +971,7 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
     }
     }
   } else if (PrevDecl &&
   } else if (PrevDecl &&
              !isDeclInScope(PrevDecl, SemanticContext, S, SS.isValid()))
              !isDeclInScope(PrevDecl, SemanticContext, S, SS.isValid()))
-    PrevDecl = PrevClassTemplate = 0;
+    PrevDecl = PrevClassTemplate = nullptr;
 
 
   if (PrevClassTemplate) {
   if (PrevClassTemplate) {
     // Ensure that the template parameter lists are compatible. Skip this check
     // Ensure that the template parameter lists are compatible. Skip this check
@@ -1013,7 +1013,7 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
     // Maybe we will complain about the shadowed template parameter.
     // Maybe we will complain about the shadowed template parameter.
     DiagnoseTemplateParameterShadow(NameLoc, PrevDecl);
     DiagnoseTemplateParameterShadow(NameLoc, PrevDecl);
     // Just pretend that we didn't see the previous declaration.
     // Just pretend that we didn't see the previous declaration.
-    PrevDecl = 0;
+    PrevDecl = nullptr;
   } else if (PrevDecl) {
   } else if (PrevDecl) {
     // C++ [temp]p5:
     // C++ [temp]p5:
     //   A class template shall not have the same name as any other
     //   A class template shall not have the same name as any other
@@ -1032,7 +1032,8 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
   if (!(TUK == TUK_Friend && CurContext->isDependentContext()) &&
   if (!(TUK == TUK_Friend && CurContext->isDependentContext()) &&
       CheckTemplateParameterList(
       CheckTemplateParameterList(
           TemplateParams,
           TemplateParams,
-          PrevClassTemplate ? PrevClassTemplate->getTemplateParameters() : 0,
+          PrevClassTemplate ? PrevClassTemplate->getTemplateParameters()
+                            : nullptr,
           (SS.isSet() && SemanticContext && SemanticContext->isRecord() &&
           (SS.isSet() && SemanticContext && SemanticContext->isRecord() &&
            SemanticContext->isDependentContext())
            SemanticContext->isDependentContext())
               ? TPC_ClassTemplateMember
               ? TPC_ClassTemplateMember
@@ -1054,7 +1055,7 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK,
   CXXRecordDecl *NewClass =
   CXXRecordDecl *NewClass =
     CXXRecordDecl::Create(Context, Kind, SemanticContext, KWLoc, NameLoc, Name,
     CXXRecordDecl::Create(Context, Kind, SemanticContext, KWLoc, NameLoc, Name,
                           PrevClassTemplate?
                           PrevClassTemplate?
-                            PrevClassTemplate->getTemplatedDecl() : 0,
+                            PrevClassTemplate->getTemplatedDecl() : nullptr,
                           /*DelayTypeCreation=*/true);
                           /*DelayTypeCreation=*/true);
   SetNestedNameSpecifier(NewClass, SS);
   SetNestedNameSpecifier(NewClass, SS);
   if (NumOuterTemplateParamLists > 0)
   if (NumOuterTemplateParamLists > 0)
@@ -1301,7 +1302,7 @@ bool Sema::CheckTemplateParameterList(TemplateParameterList *NewParams,
 
 
       // Merge default arguments for template type parameters.
       // Merge default arguments for template type parameters.
       TemplateTypeParmDecl *OldTypeParm
       TemplateTypeParmDecl *OldTypeParm
-          = OldParams? cast<TemplateTypeParmDecl>(*OldParam) : 0;
+          = OldParams? cast<TemplateTypeParmDecl>(*OldParam) : nullptr;
 
 
       if (NewTypeParm->isParameterPack()) {
       if (NewTypeParm->isParameterPack()) {
         assert(!NewTypeParm->hasDefaultArgument() &&
         assert(!NewTypeParm->hasDefaultArgument() &&
@@ -1346,7 +1347,7 @@ bool Sema::CheckTemplateParameterList(TemplateParameterList *NewParams,
 
 
       // Merge default arguments for non-type template parameters
       // Merge default arguments for non-type template parameters
       NonTypeTemplateParmDecl *OldNonTypeParm
       NonTypeTemplateParmDecl *OldNonTypeParm
-        = OldParams? cast<NonTypeTemplateParmDecl>(*OldParam) : 0;
+        = OldParams? cast<NonTypeTemplateParmDecl>(*OldParam) : nullptr;
       if (NewNonTypeParm->isParameterPack()) {
       if (NewNonTypeParm->isParameterPack()) {
         assert(!NewNonTypeParm->hasDefaultArgument() &&
         assert(!NewNonTypeParm->hasDefaultArgument() &&
                "Parameter packs can't have a default argument!");
                "Parameter packs can't have a default argument!");
@@ -1393,7 +1394,7 @@ bool Sema::CheckTemplateParameterList(TemplateParameterList *NewParams,
 
 
       // Merge default arguments for template template parameters
       // Merge default arguments for template template parameters
       TemplateTemplateParmDecl *OldTemplateParm
       TemplateTemplateParmDecl *OldTemplateParm
-        = OldParams? cast<TemplateTemplateParmDecl>(*OldParam) : 0;
+        = OldParams? cast<TemplateTemplateParmDecl>(*OldParam) : nullptr;
       if (NewTemplateParm->isParameterPack()) {
       if (NewTemplateParm->isParameterPack()) {
         assert(!NewTemplateParm->hasDefaultArgument() &&
         assert(!NewTemplateParm->hasDefaultArgument() &&
                "Parameter packs can't have a default argument!");
                "Parameter packs can't have a default argument!");
@@ -1766,7 +1767,7 @@ TemplateParameterList *Sema::MatchTemplateParametersToScopeSpecifier(
     
     
     // For a dependent type, the set of template parameters that we
     // For a dependent type, the set of template parameters that we
     // expect to see.
     // expect to see.
-    TemplateParameterList *ExpectedTemplateParams = 0;
+    TemplateParameterList *ExpectedTemplateParams = nullptr;
 
 
     // C++0x [temp.expl.spec]p15:
     // C++0x [temp.expl.spec]p15:
     //   A member or a member template may be nested within many enclosing 
     //   A member or a member template may be nested within many enclosing 
@@ -1825,7 +1826,7 @@ TemplateParameterList *Sema::MatchTemplateParametersToScopeSpecifier(
       if (ParamLists[ParamIdx]->size() == 0) {
       if (ParamLists[ParamIdx]->size() == 0) {
         if (CheckExplicitSpecialization(ParamLists[ParamIdx]->getSourceRange(),
         if (CheckExplicitSpecialization(ParamLists[ParamIdx]->getSourceRange(),
                                         false))
                                         false))
-          return 0;
+          return nullptr;
       } else
       } else
         SawNonEmptyTemplateParameterList = true;
         SawNonEmptyTemplateParameterList = true;
     }
     }
@@ -1846,7 +1847,7 @@ TemplateParameterList *Sema::MatchTemplateParametersToScopeSpecifier(
                            ParamLists[ParamIdx]->getRAngleLoc())
                            ParamLists[ParamIdx]->getRAngleLoc())
             << getRangeOfTypeInNestedNameSpecifier(Context, T, SS);
             << getRangeOfTypeInNestedNameSpecifier(Context, T, SS);
           Invalid = true;
           Invalid = true;
-          return 0;
+          return nullptr;
         }
         }
 
 
         // Consume this template header.
         // Consume this template header.
@@ -1857,7 +1858,7 @@ TemplateParameterList *Sema::MatchTemplateParametersToScopeSpecifier(
       if (!IsFriend)
       if (!IsFriend)
         if (DiagnoseMissingExplicitSpecialization(
         if (DiagnoseMissingExplicitSpecialization(
                 getRangeOfTypeInNestedNameSpecifier(Context, T, SS)))
                 getRangeOfTypeInNestedNameSpecifier(Context, T, SS)))
-          return 0;
+          return nullptr;
 
 
       continue;
       continue;
     }
     }
@@ -1870,7 +1871,7 @@ TemplateParameterList *Sema::MatchTemplateParametersToScopeSpecifier(
       if (IsFriend && T->isDependentType()) {
       if (IsFriend && T->isDependentType()) {
         if (ParamIdx < ParamLists.size() &&
         if (ParamIdx < ParamLists.size() &&
             DependsOnTemplateParameters(T, ParamLists[ParamIdx]))
             DependsOnTemplateParameters(T, ParamLists[ParamIdx]))
-          ExpectedTemplateParams = 0;
+          ExpectedTemplateParams = nullptr;
         else 
         else 
           continue;
           continue;
       }
       }
@@ -1882,9 +1883,9 @@ TemplateParameterList *Sema::MatchTemplateParametersToScopeSpecifier(
                                             ExpectedTemplateParams,
                                             ExpectedTemplateParams,
                                             true, TPL_TemplateMatch))
                                             true, TPL_TemplateMatch))
           Invalid = true;
           Invalid = true;
-        
+
         if (!Invalid &&
         if (!Invalid &&
-            CheckTemplateParameterList(ParamLists[ParamIdx], 0,
+            CheckTemplateParameterList(ParamLists[ParamIdx], nullptr,
                                        TPC_ClassTemplateMember))
                                        TPC_ClassTemplateMember))
           Invalid = true;
           Invalid = true;
         
         
@@ -1913,11 +1914,11 @@ TemplateParameterList *Sema::MatchTemplateParametersToScopeSpecifier(
 
 
       // Fabricate an empty template parameter list for the invented header.
       // Fabricate an empty template parameter list for the invented header.
       return TemplateParameterList::Create(Context, SourceLocation(),
       return TemplateParameterList::Create(Context, SourceLocation(),
-                                           SourceLocation(), 0, 0,
+                                           SourceLocation(), nullptr, 0,
                                            SourceLocation());
                                            SourceLocation());
     }
     }
 
 
-    return 0;
+    return nullptr;
   }
   }
 
 
   // If there were too many template parameter lists, complain about that now.
   // If there were too many template parameter lists, complain about that now.
@@ -1962,7 +1963,7 @@ TemplateParameterList *Sema::MatchTemplateParametersToScopeSpecifier(
   if (ParamLists.back()->size() == 0 &&
   if (ParamLists.back()->size() == 0 &&
       CheckExplicitSpecialization(ParamLists[ParamIdx]->getSourceRange(),
       CheckExplicitSpecialization(ParamLists[ParamIdx]->getSourceRange(),
                                   false))
                                   false))
-    return 0;
+    return nullptr;
 
 
   // Return the last template parameter list, which corresponds to the
   // Return the last template parameter list, which corresponds to the
   // entity being declared.
   // entity being declared.
@@ -2122,7 +2123,7 @@ QualType Sema::CheckTemplateIdType(TemplateName Name,
                = dyn_cast<ClassTemplateDecl>(Template)) {
                = dyn_cast<ClassTemplateDecl>(Template)) {
     // Find the class template specialization declaration that
     // Find the class template specialization declaration that
     // corresponds to these arguments.
     // corresponds to these arguments.
-    void *InsertPos = 0;
+    void *InsertPos = nullptr;
     ClassTemplateSpecializationDecl *Decl
     ClassTemplateSpecializationDecl *Decl
       = ClassTemplate->findSpecialization(Converted.data(), Converted.size(),
       = ClassTemplate->findSpecialization(Converted.data(), Converted.size(),
                                           InsertPos);
                                           InsertPos);
@@ -2137,7 +2138,7 @@ QualType Sema::CheckTemplateIdType(TemplateName Name,
                                                 ClassTemplate->getLocation(),
                                                 ClassTemplate->getLocation(),
                                                      ClassTemplate,
                                                      ClassTemplate,
                                                      Converted.data(),
                                                      Converted.data(),
-                                                     Converted.size(), 0);
+                                                     Converted.size(), nullptr);
       ClassTemplate->AddSpecialization(Decl, InsertPos);
       ClassTemplate->AddSpecialization(Decl, InsertPos);
       if (ClassTemplate->isOutOfLine())
       if (ClassTemplate->isOutOfLine())
         Decl->setLexicalDeclContext(ClassTemplate->getLexicalDeclContext());
         Decl->setLexicalDeclContext(ClassTemplate->getLexicalDeclContext());
@@ -2500,8 +2501,8 @@ DeclResult Sema::ActOnVarTemplateSpecialization(
     }
     }
   }
   }
 
 
-  void *InsertPos = 0;
-  VarTemplateSpecializationDecl *PrevDecl = 0;
+  void *InsertPos = nullptr;
+  VarTemplateSpecializationDecl *PrevDecl = nullptr;
 
 
   if (IsPartialSpecialization)
   if (IsPartialSpecialization)
     // FIXME: Template parameter list matters too
     // FIXME: Template parameter list matters too
@@ -2511,7 +2512,7 @@ DeclResult Sema::ActOnVarTemplateSpecialization(
     PrevDecl = VarTemplate->findSpecialization(Converted.data(),
     PrevDecl = VarTemplate->findSpecialization(Converted.data(),
                                                Converted.size(), InsertPos);
                                                Converted.size(), InsertPos);
 
 
-  VarTemplateSpecializationDecl *Specialization = 0;
+  VarTemplateSpecializationDecl *Specialization = nullptr;
 
 
   // Check whether we can declare a variable template specialization in
   // Check whether we can declare a variable template specialization in
   // the current scope.
   // the current scope.
@@ -2527,7 +2528,7 @@ DeclResult Sema::ActOnVarTemplateSpecialization(
     // the list of outer template parameters to reflect our new declaration.
     // the list of outer template parameters to reflect our new declaration.
     Specialization = PrevDecl;
     Specialization = PrevDecl;
     Specialization->setLocation(TemplateNameLoc);
     Specialization->setLocation(TemplateNameLoc);
-    PrevDecl = 0;
+    PrevDecl = nullptr;
   } else if (IsPartialSpecialization) {
   } else if (IsPartialSpecialization) {
     // Create a new class template partial specialization declaration node.
     // Create a new class template partial specialization declaration node.
     VarTemplatePartialSpecializationDecl *PrevPartial =
     VarTemplatePartialSpecializationDecl *PrevPartial =
@@ -2672,7 +2673,7 @@ Sema::CheckVarTemplateId(VarTemplateDecl *Template, SourceLocation TemplateLoc,
 
 
   // Find the variable template specialization declaration that
   // Find the variable template specialization declaration that
   // corresponds to these arguments.
   // corresponds to these arguments.
-  void *InsertPos = 0;
+  void *InsertPos = nullptr;
   if (VarTemplateSpecializationDecl *Spec = Template->findSpecialization(
   if (VarTemplateSpecializationDecl *Spec = Template->findSpecialization(
           Converted.data(), Converted.size(), InsertPos))
           Converted.data(), Converted.size(), InsertPos))
     // If we already have a variable template specialization, return it.
     // If we already have a variable template specialization, return it.
@@ -2825,7 +2826,7 @@ Sema::CheckVarTemplateId(const CXXScopeSpec &SS,
 
 
   // Build an ordinary singleton decl ref.
   // Build an ordinary singleton decl ref.
   return BuildDeclarationNameExpr(SS, NameInfo, Var,
   return BuildDeclarationNameExpr(SS, NameInfo, Var,
-                                  /*FoundD=*/0, TemplateArgs);
+                                  /*FoundD=*/nullptr, TemplateArgs);
 }
 }
 
 
 ExprResult Sema::BuildTemplateIdExpr(const CXXScopeSpec &SS,
 ExprResult Sema::BuildTemplateIdExpr(const CXXScopeSpec &SS,
@@ -2887,7 +2888,7 @@ Sema::BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS,
 
 
   bool MemberOfUnknownSpecialization;
   bool MemberOfUnknownSpecialization;
   LookupResult R(*this, NameInfo, LookupOrdinaryName);
   LookupResult R(*this, NameInfo, LookupOrdinaryName);
-  LookupTemplateName(R, (Scope*) 0, SS, QualType(), /*Entering*/ false,
+  LookupTemplateName(R, (Scope*)nullptr, SS, QualType(), /*Entering*/ false,
                      MemberOfUnknownSpecialization);
                      MemberOfUnknownSpecialization);
 
 
   if (R.isAmbiguous())
   if (R.isAmbiguous())
@@ -2931,7 +2932,7 @@ TemplateNameKind Sema::ActOnDependentTemplateName(Scope *S,
            diag::ext_template_outside_of_template)
            diag::ext_template_outside_of_template)
       << FixItHint::CreateRemoval(TemplateKWLoc);
       << FixItHint::CreateRemoval(TemplateKWLoc);
 
 
-  DeclContext *LookupCtx = 0;
+  DeclContext *LookupCtx = nullptr;
   if (SS.isSet())
   if (SS.isSet())
     LookupCtx = computeDeclContext(SS, EnteringContext);
     LookupCtx = computeDeclContext(SS, EnteringContext);
   if (!LookupCtx && ObjectType)
   if (!LookupCtx && ObjectType)
@@ -3133,7 +3134,7 @@ SubstDefaultTemplateArgument(Sema &SemaRef,
                                      Template, Converted,
                                      Template, Converted,
                                      SourceRange(TemplateLoc, RAngleLoc));
                                      SourceRange(TemplateLoc, RAngleLoc));
     if (Inst.isInvalid())
     if (Inst.isInvalid())
-      return 0;
+      return nullptr;
 
 
     TemplateArgumentList TemplateArgs(TemplateArgumentList::OnStack,
     TemplateArgumentList TemplateArgs(TemplateArgumentList::OnStack,
                                       Converted.data(), Converted.size());
                                       Converted.data(), Converted.size());
@@ -3454,7 +3455,8 @@ bool Sema::CheckTemplateArgument(NamedDecl *Param,
         ExprResult E = Owned(DependentScopeDeclRefExpr::Create(Context,
         ExprResult E = Owned(DependentScopeDeclRefExpr::Create(Context,
                                                 SS.getWithLocInContext(Context),
                                                 SS.getWithLocInContext(Context),
                                                                TemplateKWLoc,
                                                                TemplateKWLoc,
-                                                               NameInfo, 0));
+                                                               NameInfo,
+                                                               nullptr));
 
 
         // If we parsed the template argument as a pack expansion, create a
         // If we parsed the template argument as a pack expansion, create a
         // pack expansion expression.
         // pack expansion expression.
@@ -4630,7 +4632,7 @@ static bool CheckTemplateArgumentPointerToMember(Sema &S,
   //   template-parameter shall be one of: [...]
   //   template-parameter shall be one of: [...]
   //
   //
   //     -- a pointer to member expressed as described in 5.3.1.
   //     -- a pointer to member expressed as described in 5.3.1.
-  DeclRefExpr *DRE = 0;
+  DeclRefExpr *DRE = nullptr;
 
 
   // In C++98/03 mode, give an extension warning on any extra parentheses.
   // In C++98/03 mode, give an extension warning on any extra parentheses.
   // See http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#773
   // See http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#773
@@ -4657,7 +4659,7 @@ static bool CheckTemplateArgumentPointerToMember(Sema &S,
     if (UnOp->getOpcode() == UO_AddrOf) {
     if (UnOp->getOpcode() == UO_AddrOf) {
       DRE = dyn_cast<DeclRefExpr>(UnOp->getSubExpr());
       DRE = dyn_cast<DeclRefExpr>(UnOp->getSubExpr());
       if (DRE && !DRE->getQualifier())
       if (DRE && !DRE->getQualifier())
-        DRE = 0;
+        DRE = nullptr;
     }
     }
   }
   }
   // A constant of pointer-to-member type.
   // A constant of pointer-to-member type.
@@ -4676,7 +4678,7 @@ static bool CheckTemplateArgumentPointerToMember(Sema &S,
       }
       }
     }
     }
 
 
-    DRE = 0;
+    DRE = nullptr;
   }
   }
 
 
   if (!DRE)
   if (!DRE)
@@ -5161,7 +5163,7 @@ Sema::BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg,
       QualType ClassType
       QualType ClassType
         = Context.getTypeDeclType(cast<RecordDecl>(VD->getDeclContext()));
         = Context.getTypeDeclType(cast<RecordDecl>(VD->getDeclContext()));
       NestedNameSpecifier *Qualifier
       NestedNameSpecifier *Qualifier
-        = NestedNameSpecifier::Create(Context, 0, false,
+        = NestedNameSpecifier::Create(Context, nullptr, false,
                                       ClassType.getTypePtr());
                                       ClassType.getTypePtr());
       CXXScopeSpec SS;
       CXXScopeSpec SS;
       SS.MakeTrivial(Context, Qualifier, Loc);
       SS.MakeTrivial(Context, Qualifier, Loc);
@@ -5287,7 +5289,8 @@ Sema::BuildExpressionFromIntegralTemplateArgument(const TemplateArgument &Arg,
   if (OrigT->isEnumeralType()) {
   if (OrigT->isEnumeralType()) {
     // FIXME: This is a hack. We need a better way to handle substituted
     // FIXME: This is a hack. We need a better way to handle substituted
     // non-type template parameters.
     // non-type template parameters.
-    E = CStyleCastExpr::Create(Context, OrigT, VK_RValue, CK_IntegralCast, E, 0,
+    E = CStyleCastExpr::Create(Context, OrigT, VK_RValue, CK_IntegralCast, E,
+                               nullptr,
                                Context.getTrivialTypeSourceInfo(OrigT, Loc),
                                Context.getTrivialTypeSourceInfo(OrigT, Loc),
                                Loc, Loc);
                                Loc, Loc);
   }
   }
@@ -6040,8 +6043,8 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec,
     }
     }
   }
   }
 
 
-  void *InsertPos = 0;
-  ClassTemplateSpecializationDecl *PrevDecl = 0;
+  void *InsertPos = nullptr;
+  ClassTemplateSpecializationDecl *PrevDecl = nullptr;
 
 
   if (isPartialSpecialization)
   if (isPartialSpecialization)
     // FIXME: Template parameter list matters, too
     // FIXME: Template parameter list matters, too
@@ -6054,7 +6057,7 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec,
       = ClassTemplate->findSpecialization(Converted.data(),
       = ClassTemplate->findSpecialization(Converted.data(),
                                           Converted.size(), InsertPos);
                                           Converted.size(), InsertPos);
 
 
-  ClassTemplateSpecializationDecl *Specialization = 0;
+  ClassTemplateSpecializationDecl *Specialization = nullptr;
 
 
   // Check whether we can declare a class template specialization in
   // Check whether we can declare a class template specialization in
   // the current scope.
   // the current scope.
@@ -6291,7 +6294,7 @@ Decl *Sema::ActOnTemplateDeclarator(Scope *S,
 Decl *Sema::ActOnStartOfFunctionTemplateDef(Scope *FnBodyScope,
 Decl *Sema::ActOnStartOfFunctionTemplateDef(Scope *FnBodyScope,
                                MultiTemplateParamsArg TemplateParameterLists,
                                MultiTemplateParamsArg TemplateParameterLists,
                                             Declarator &D) {
                                             Declarator &D) {
-  assert(getCurFunctionDecl() == 0 && "Function parsing confused");
+  assert(getCurFunctionDecl() == nullptr && "Function parsing confused");
   DeclaratorChunk::FunctionTypeInfo &FTI = D.getFunctionTypeInfo();
   DeclaratorChunk::FunctionTypeInfo &FTI = D.getFunctionTypeInfo();
 
 
   if (FTI.hasPrototype) {
   if (FTI.hasPrototype) {
@@ -6628,7 +6631,7 @@ bool Sema::CheckFunctionTemplateSpecialization(
       // specializing this template.
       // specializing this template.
       // FIXME: It is somewhat wasteful to build
       // FIXME: It is somewhat wasteful to build
       TemplateDeductionInfo Info(FailedCandidates.getLocation());
       TemplateDeductionInfo Info(FailedCandidates.getLocation());
-      FunctionDecl *Specialization = 0;
+      FunctionDecl *Specialization = nullptr;
       if (TemplateDeductionResult TDK = DeduceTemplateArguments(
       if (TemplateDeductionResult TDK = DeduceTemplateArguments(
               cast<FunctionTemplateDecl>(FunTmpl->getFirstDecl()),
               cast<FunctionTemplateDecl>(FunTmpl->getFirstDecl()),
               ExplicitTemplateArgs, FT, Specialization, Info)) {
               ExplicitTemplateArgs, FT, Specialization, Info)) {
@@ -6652,7 +6655,7 @@ bool Sema::CheckFunctionTemplateSpecialization(
       FD->getLocation(),
       FD->getLocation(),
       PDiag(diag::err_function_template_spec_no_match) << FD->getDeclName(),
       PDiag(diag::err_function_template_spec_no_match) << FD->getDeclName(),
       PDiag(diag::err_function_template_spec_ambiguous)
       PDiag(diag::err_function_template_spec_ambiguous)
-          << FD->getDeclName() << (ExplicitTemplateArgs != 0),
+          << FD->getDeclName() << (ExplicitTemplateArgs != nullptr),
       PDiag(diag::note_function_template_spec_matched));
       PDiag(diag::note_function_template_spec_matched));
 
 
   if (Result == Candidates.end())
   if (Result == Candidates.end())
@@ -6721,7 +6724,7 @@ bool Sema::CheckFunctionTemplateSpecialization(
   const TemplateArgumentList* TemplArgs = new (Context)
   const TemplateArgumentList* TemplArgs = new (Context)
     TemplateArgumentList(Specialization->getTemplateSpecializationArgs());
     TemplateArgumentList(Specialization->getTemplateSpecializationArgs());
   FD->setFunctionTemplateSpecialization(Specialization->getPrimaryTemplate(),
   FD->setFunctionTemplateSpecialization(Specialization->getPrimaryTemplate(),
-                                        TemplArgs, /*InsertPos=*/0,
+                                        TemplArgs, /*InsertPos=*/nullptr,
                                     SpecInfo->getTemplateSpecializationKind(),
                                     SpecInfo->getTemplateSpecializationKind(),
                                         ExplicitTemplateArgs);
                                         ExplicitTemplateArgs);
 
 
@@ -6751,9 +6754,9 @@ Sema::CheckMemberSpecialization(NamedDecl *Member, LookupResult &Previous) {
   assert(!isa<TemplateDecl>(Member) && "Only for non-template members");
   assert(!isa<TemplateDecl>(Member) && "Only for non-template members");
 
 
   // Try to find the member we are instantiating.
   // Try to find the member we are instantiating.
-  NamedDecl *Instantiation = 0;
-  NamedDecl *InstantiatedFrom = 0;
-  MemberSpecializationInfo *MSInfo = 0;
+  NamedDecl *Instantiation = nullptr;
+  NamedDecl *InstantiatedFrom = nullptr;
+  MemberSpecializationInfo *MSInfo = nullptr;
 
 
   if (Previous.empty()) {
   if (Previous.empty()) {
     // Nowhere to look anyway.
     // Nowhere to look anyway.
@@ -7060,7 +7063,7 @@ Sema::ActOnExplicitInstantiation(Scope *S,
 
 
   // Find the class template specialization declaration that
   // Find the class template specialization declaration that
   // corresponds to these arguments.
   // corresponds to these arguments.
-  void *InsertPos = 0;
+  void *InsertPos = nullptr;
   ClassTemplateSpecializationDecl *PrevDecl
   ClassTemplateSpecializationDecl *PrevDecl
     = ClassTemplate->findSpecialization(Converted.data(),
     = ClassTemplate->findSpecialization(Converted.data(),
                                         Converted.size(), InsertPos);
                                         Converted.size(), InsertPos);
@@ -7077,7 +7080,7 @@ Sema::ActOnExplicitInstantiation(Scope *S,
                                       SS.isSet()))
                                       SS.isSet()))
     return true;
     return true;
 
 
-  ClassTemplateSpecializationDecl *Specialization = 0;
+  ClassTemplateSpecializationDecl *Specialization = nullptr;
 
 
   bool HasNoEffect = false;
   bool HasNoEffect = false;
   if (PrevDecl) {
   if (PrevDecl) {
@@ -7099,7 +7102,7 @@ Sema::ActOnExplicitInstantiation(Scope *S,
       // (Other source locations will be updated later.)
       // (Other source locations will be updated later.)
       Specialization = PrevDecl;
       Specialization = PrevDecl;
       Specialization->setLocation(TemplateNameLoc);
       Specialization->setLocation(TemplateNameLoc);
-      PrevDecl = 0;
+      PrevDecl = nullptr;
     }
     }
   }
   }
 
 
@@ -7516,7 +7519,7 @@ DeclResult Sema::ActOnExplicitInstantiation(Scope *S,
     }
     }
 
 
     // FIXME: Create an ExplicitInstantiation node?
     // FIXME: Create an ExplicitInstantiation node?
-    return (Decl*) 0;
+    return (Decl*) nullptr;
   }
   }
 
 
   // If the declarator is a template-id, translate the parser's template
   // If the declarator is a template-id, translate the parser's template
@@ -7556,10 +7559,11 @@ DeclResult Sema::ActOnExplicitInstantiation(Scope *S,
       continue;
       continue;
 
 
     TemplateDeductionInfo Info(FailedCandidates.getLocation());
     TemplateDeductionInfo Info(FailedCandidates.getLocation());
-    FunctionDecl *Specialization = 0;
+    FunctionDecl *Specialization = nullptr;
     if (TemplateDeductionResult TDK
     if (TemplateDeductionResult TDK
           = DeduceTemplateArguments(FunTmpl,
           = DeduceTemplateArguments(FunTmpl,
-                               (HasExplicitTemplateArgs ? &TemplateArgs : 0),
+                               (HasExplicitTemplateArgs ? &TemplateArgs
+                                                        : nullptr),
                                     R, Specialization, Info)) {
                                     R, Specialization, Info)) {
       // Keep track of almost-matches.
       // Keep track of almost-matches.
       FailedCandidates.addCandidate()
       FailedCandidates.addCandidate()
@@ -7612,7 +7616,7 @@ DeclResult Sema::ActOnExplicitInstantiation(Scope *S,
     // FIXME: We may still want to build some representation of this
     // FIXME: We may still want to build some representation of this
     // explicit specialization.
     // explicit specialization.
     if (HasNoEffect)
     if (HasNoEffect)
-      return (Decl*) 0;
+      return (Decl*) nullptr;
   }
   }
 
 
   Specialization->setTemplateSpecializationKind(TSK, D.getIdentifierLoc());
   Specialization->setTemplateSpecializationKind(TSK, D.getIdentifierLoc());
@@ -7649,7 +7653,7 @@ DeclResult Sema::ActOnExplicitInstantiation(Scope *S,
                                   D.getCXXScopeSpec().isSet());
                                   D.getCXXScopeSpec().isSet());
 
 
   // FIXME: Create some kind of ExplicitInstantiationDecl here.
   // FIXME: Create some kind of ExplicitInstantiationDecl here.
-  return (Decl*) 0;
+  return (Decl*) nullptr;
 }
 }
 
 
 TypeResult
 TypeResult
@@ -7861,7 +7865,7 @@ Sema::CheckTypenameType(ElaboratedTypeKeyword Keyword,
   LookupResult Result(*this, Name, IILoc, LookupOrdinaryName);
   LookupResult Result(*this, Name, IILoc, LookupOrdinaryName);
   LookupQualifiedName(Result, Ctx);
   LookupQualifiedName(Result, Ctx);
   unsigned DiagID = 0;
   unsigned DiagID = 0;
-  Decl *Referenced = 0;
+  Decl *Referenced = nullptr;
   switch (Result.getResultKind()) {
   switch (Result.getResultKind()) {
   case LookupResult::NotFound: {
   case LookupResult::NotFound: {
     // If we're looking up 'type' within a template named 'enable_if', produce
     // If we're looking up 'type' within a template named 'enable_if', produce

+ 27 - 27
lib/Sema/SemaTemplateDeduction.cpp

@@ -126,7 +126,7 @@ DeduceTemplateArgumentsByTypeMatch(Sema &S,
                                    unsigned TDF,
                                    unsigned TDF,
                                    bool PartialOrdering = false,
                                    bool PartialOrdering = false,
                             SmallVectorImpl<RefParamPartialOrderingComparison> *
                             SmallVectorImpl<RefParamPartialOrderingComparison> *
-                                                      RefParamComparisons = 0);
+                                                 RefParamComparisons = nullptr);
 
 
 static Sema::TemplateDeductionResult
 static Sema::TemplateDeductionResult
 DeduceTemplateArguments(Sema &S,
 DeduceTemplateArguments(Sema &S,
@@ -155,7 +155,7 @@ static NonTypeTemplateParmDecl *getDeducedParameterFromExpr(Expr *E) {
   if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E))
   if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E))
     return dyn_cast<NonTypeTemplateParmDecl>(DRE->getDecl());
     return dyn_cast<NonTypeTemplateParmDecl>(DRE->getDecl());
 
 
-  return 0;
+  return nullptr;
 }
 }
 
 
 /// \brief Determine whether two declaration pointers refer to the same
 /// \brief Determine whether two declaration pointers refer to the same
@@ -382,7 +382,7 @@ DeduceNonTypeTemplateArgument(Sema &S,
   assert(NTTP->getDepth() == 0 &&
   assert(NTTP->getDepth() == 0 &&
          "Cannot deduce non-type template argument with depth > 0");
          "Cannot deduce non-type template argument with depth > 0");
 
 
-  D = D ? cast<ValueDecl>(D->getCanonicalDecl()) : 0;
+  D = D ? cast<ValueDecl>(D->getCanonicalDecl()) : nullptr;
   TemplateArgument New(D, NTTP->getType()->isReferenceType());
   TemplateArgument New(D, NTTP->getType()->isReferenceType());
   DeducedTemplateArgument NewDeduced(New);
   DeducedTemplateArgument NewDeduced(New);
   DeducedTemplateArgument Result = checkDeducedTemplateArguments(S.Context,
   DeducedTemplateArgument Result = checkDeducedTemplateArguments(S.Context,
@@ -715,7 +715,7 @@ DeduceTemplateArguments(Sema &S,
                         unsigned TDF,
                         unsigned TDF,
                         bool PartialOrdering = false,
                         bool PartialOrdering = false,
                         SmallVectorImpl<RefParamPartialOrderingComparison> *
                         SmallVectorImpl<RefParamPartialOrderingComparison> *
-                                                     RefParamComparisons = 0) {
+                                                RefParamComparisons = nullptr) {
   // Fast-path check to see if we have too many/too few arguments.
   // Fast-path check to see if we have too many/too few arguments.
   if (NumParams != NumArgs &&
   if (NumParams != NumArgs &&
       !(NumParams && isa<PackExpansionType>(Params[NumParams - 1])) &&
       !(NumParams && isa<PackExpansionType>(Params[NumParams - 1])) &&
@@ -2461,7 +2461,7 @@ Sema::DeduceTemplateArguments(VarTemplatePartialSpecializationDecl *Partial,
 static bool isSimpleTemplateIdType(QualType T) {
 static bool isSimpleTemplateIdType(QualType T) {
   if (const TemplateSpecializationType *Spec
   if (const TemplateSpecializationType *Spec
         = T->getAs<TemplateSpecializationType>())
         = T->getAs<TemplateSpecializationType>())
-    return Spec->getTemplateName().getAsTemplateDecl() != 0;
+    return Spec->getTemplateName().getAsTemplateDecl() != nullptr;
 
 
   return false;
   return false;
 }
 }
@@ -2600,7 +2600,7 @@ Sema::SubstituteExplicitTemplateArguments(
     //   and the end of the function-definition, member-declarator, or 
     //   and the end of the function-definition, member-declarator, or 
     //   declarator.
     //   declarator.
     unsigned ThisTypeQuals = 0;
     unsigned ThisTypeQuals = 0;
-    CXXRecordDecl *ThisContext = 0;
+    CXXRecordDecl *ThisContext = nullptr;
     if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(Function)) {
     if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(Function)) {
       ThisContext = Method->getParent();
       ThisContext = Method->getParent();
       ThisTypeQuals = Method->getTypeQualifiers();
       ThisTypeQuals = Method->getTypeQualifiers();
@@ -3052,7 +3052,7 @@ ResolveOverloadForDeduction(Sema &S, TemplateParameterList *TemplateParams,
         return QualType();
         return QualType();
       
       
       // Otherwise, see if we can resolve a function type 
       // Otherwise, see if we can resolve a function type 
-      FunctionDecl *Specialization = 0;
+      FunctionDecl *Specialization = nullptr;
       TemplateDeductionInfo Info(Ovl->getNameLoc());
       TemplateDeductionInfo Info(Ovl->getNameLoc());
       if (S.DeduceTemplateArguments(FunTmpl, &ExplicitTemplateArgs,
       if (S.DeduceTemplateArguments(FunTmpl, &ExplicitTemplateArgs,
                                     Specialization, Info))
                                     Specialization, Info))
@@ -3144,7 +3144,7 @@ static bool AdjustFunctionParmAndArgTypesForDeduction(Sema &S,
   if (ArgType == S.Context.OverloadTy) {
   if (ArgType == S.Context.OverloadTy) {
     ArgType = ResolveOverloadForDeduction(S, TemplateParams,
     ArgType = ResolveOverloadForDeduction(S, TemplateParams,
                                           Arg, ParamType,
                                           Arg, ParamType,
-                                          ParamRefType != 0);
+                                          ParamRefType != nullptr);
     if (ArgType.isNull())
     if (ArgType.isNull())
       return true;
       return true;
   }
   }
@@ -3313,7 +3313,7 @@ Sema::TemplateDeductionResult Sema::DeduceTemplateArguments(
                                           *ExplicitTemplateArgs,
                                           *ExplicitTemplateArgs,
                                           Deduced,
                                           Deduced,
                                           ParamTypes,
                                           ParamTypes,
-                                          0,
+                                          nullptr,
                                           Info);
                                           Info);
     if (Result)
     if (Result)
       return Result;
       return Result;
@@ -3679,7 +3679,7 @@ SpecializeCorrespondingLambdaCallOperatorAndInvoker(
   FunctionTemplateDecl *CallOpTemplate = 
   FunctionTemplateDecl *CallOpTemplate = 
       CallOpGeneric->getDescribedFunctionTemplate();
       CallOpGeneric->getDescribedFunctionTemplate();
 
 
-  FunctionDecl *CallOpSpecialized = 0;
+  FunctionDecl *CallOpSpecialized = nullptr;
   // Use the deduced arguments of the conversion function, to specialize our 
   // Use the deduced arguments of the conversion function, to specialize our 
   // generic lambda's call operator.
   // generic lambda's call operator.
   if (Sema::TemplateDeductionResult Result
   if (Sema::TemplateDeductionResult Result
@@ -3705,7 +3705,7 @@ SpecializeCorrespondingLambdaCallOperatorAndInvoker(
   // specialized our corresponding call operator, we are ready to
   // specialized our corresponding call operator, we are ready to
   // specialize the static invoker with the deduced arguments of our
   // specialize the static invoker with the deduced arguments of our
   // ptr-to-function.
   // ptr-to-function.
-  FunctionDecl *InvokerSpecialized = 0;
+  FunctionDecl *InvokerSpecialized = nullptr;
   FunctionTemplateDecl *InvokerTemplate = LambdaClass->
   FunctionTemplateDecl *InvokerTemplate = LambdaClass->
                   getLambdaStaticInvoker()->getDescribedFunctionTemplate();
                   getLambdaStaticInvoker()->getDescribedFunctionTemplate();
 
 
@@ -3848,7 +3848,7 @@ Sema::DeduceTemplateArguments(FunctionTemplateDecl *ConversionTemplate,
   // Create an Instantiation Scope for finalizing the operator.
   // Create an Instantiation Scope for finalizing the operator.
   LocalInstantiationScope InstScope(*this);
   LocalInstantiationScope InstScope(*this);
   // Finish template argument deduction.
   // Finish template argument deduction.
-  FunctionDecl *ConversionSpecialized = 0;
+  FunctionDecl *ConversionSpecialized = nullptr;
   TemplateDeductionResult Result
   TemplateDeductionResult Result
       = FinishTemplateArgumentDeduction(ConversionTemplate, Deduced, 0, 
       = FinishTemplateArgumentDeduction(ConversionTemplate, Deduced, 0, 
                                         ConversionSpecialized, Info);
                                         ConversionSpecialized, Info);
@@ -4017,8 +4017,8 @@ Sema::DeduceAutoType(TypeLoc Type, Expr *&Init, QualType &Result) {
 
 
   // Build template<class TemplParam> void Func(FuncParam);
   // Build template<class TemplParam> void Func(FuncParam);
   TemplateTypeParmDecl *TemplParam =
   TemplateTypeParmDecl *TemplParam =
-    TemplateTypeParmDecl::Create(Context, 0, SourceLocation(), Loc, 0, 0, 0,
-                                 false, false);
+    TemplateTypeParmDecl::Create(Context, nullptr, SourceLocation(), Loc, 0, 0,
+                                 nullptr, false, false);
   QualType TemplArg = QualType(TemplParam->getTypeForDecl(), 0);
   QualType TemplArg = QualType(TemplParam->getTypeForDecl(), 0);
   NamedDecl *TemplParamPtr = TemplParam;
   NamedDecl *TemplParamPtr = TemplParam;
   FixedSizeTemplateParameterList<1> TemplateParams(Loc, Loc, &TemplParamPtr,
   FixedSizeTemplateParameterList<1> TemplateParams(Loc, Loc, &TemplParamPtr,
@@ -4363,7 +4363,7 @@ Sema::getMoreSpecializedTemplate(FunctionTemplateDecl *FT1,
                                  unsigned NumCallArguments2) {
                                  unsigned NumCallArguments2) {
   SmallVector<RefParamPartialOrderingComparison, 4> RefParamComparisons;
   SmallVector<RefParamPartialOrderingComparison, 4> RefParamComparisons;
   bool Better1 = isAtLeastAsSpecializedAs(*this, Loc, FT1, FT2, TPOC,
   bool Better1 = isAtLeastAsSpecializedAs(*this, Loc, FT1, FT2, TPOC,
-                                          NumCallArguments1, 0);
+                                          NumCallArguments1, nullptr);
   bool Better2 = isAtLeastAsSpecializedAs(*this, Loc, FT2, FT1, TPOC,
   bool Better2 = isAtLeastAsSpecializedAs(*this, Loc, FT2, FT1, TPOC,
                                           NumCallArguments2,
                                           NumCallArguments2,
                                           &RefParamComparisons);
                                           &RefParamComparisons);
@@ -4372,7 +4372,7 @@ Sema::getMoreSpecializedTemplate(FunctionTemplateDecl *FT1,
     return Better1? FT1 : FT2;
     return Better1? FT1 : FT2;
 
 
   if (!Better1 && !Better2) // Neither is better than the other
   if (!Better1 && !Better2) // Neither is better than the other
-    return 0;
+    return nullptr;
 
 
   // C++0x [temp.deduct.partial]p10:
   // C++0x [temp.deduct.partial]p10:
   //   If for each type being considered a given template is at least as
   //   If for each type being considered a given template is at least as
@@ -4398,13 +4398,13 @@ Sema::getMoreSpecializedTemplate(FunctionTemplateDecl *FT1,
         RefParamComparisons[I].ParamIsRvalueRef) {
         RefParamComparisons[I].ParamIsRvalueRef) {
       Better2 = true;
       Better2 = true;
       if (Better1)
       if (Better1)
-        return 0;
+        return nullptr;
       continue;
       continue;
     } else if (!RefParamComparisons[I].ParamIsRvalueRef &&
     } else if (!RefParamComparisons[I].ParamIsRvalueRef &&
                RefParamComparisons[I].ArgIsRvalueRef) {
                RefParamComparisons[I].ArgIsRvalueRef) {
       Better1 = true;
       Better1 = true;
       if (Better2)
       if (Better2)
-        return 0;
+        return nullptr;
       continue;
       continue;
     }
     }
 
 
@@ -4419,13 +4419,13 @@ Sema::getMoreSpecializedTemplate(FunctionTemplateDecl *FT1,
     case ParamMoreQualified:
     case ParamMoreQualified:
       Better1 = true;
       Better1 = true;
       if (Better2)
       if (Better2)
-        return 0;
+        return nullptr;
       continue;
       continue;
 
 
     case ArgMoreQualified:
     case ArgMoreQualified:
       Better2 = true;
       Better2 = true;
       if (Better1)
       if (Better1)
-        return 0;
+        return nullptr;
       continue;
       continue;
     }
     }
 
 
@@ -4446,7 +4446,7 @@ Sema::getMoreSpecializedTemplate(FunctionTemplateDecl *FT1,
   if (Variadic1 != Variadic2)
   if (Variadic1 != Variadic2)
     return Variadic1? FT2 : FT1;
     return Variadic1? FT2 : FT1;
 
 
-  return 0;
+  return nullptr;
 }
 }
 
 
 /// \brief Determine if the two templates are equivalent.
 /// \brief Determine if the two templates are equivalent.
@@ -4611,7 +4611,7 @@ Sema::getMoreSpecializedPartialSpecialization(
                                             PS2->getTemplateParameters(),
                                             PS2->getTemplateParameters(),
                                             PT2, PT1, Info, Deduced, TDF_None,
                                             PT2, PT1, Info, Deduced, TDF_None,
                                             /*PartialOrdering=*/true,
                                             /*PartialOrdering=*/true,
-                                            /*RefParamComparisons=*/0);
+                                            /*RefParamComparisons=*/nullptr);
   if (Better1) {
   if (Better1) {
     SmallVector<TemplateArgument, 4> DeducedArgs(Deduced.begin(),Deduced.end());
     SmallVector<TemplateArgument, 4> DeducedArgs(Deduced.begin(),Deduced.end());
     InstantiatingTemplate Inst(*this, Loc, PS2, DeducedArgs, Info);
     InstantiatingTemplate Inst(*this, Loc, PS2, DeducedArgs, Info);
@@ -4625,7 +4625,7 @@ Sema::getMoreSpecializedPartialSpecialization(
   bool Better2 = !DeduceTemplateArgumentsByTypeMatch(
   bool Better2 = !DeduceTemplateArgumentsByTypeMatch(
       *this, PS1->getTemplateParameters(), PT1, PT2, Info, Deduced, TDF_None,
       *this, PS1->getTemplateParameters(), PT1, PT2, Info, Deduced, TDF_None,
       /*PartialOrdering=*/true,
       /*PartialOrdering=*/true,
-      /*RefParamComparisons=*/0);
+      /*RefParamComparisons=*/nullptr);
   if (Better2) {
   if (Better2) {
     SmallVector<TemplateArgument, 4> DeducedArgs(Deduced.begin(),
     SmallVector<TemplateArgument, 4> DeducedArgs(Deduced.begin(),
                                                  Deduced.end());
                                                  Deduced.end());
@@ -4635,7 +4635,7 @@ Sema::getMoreSpecializedPartialSpecialization(
   }
   }
 
 
   if (Better1 == Better2)
   if (Better1 == Better2)
-    return 0;
+    return nullptr;
 
 
   return Better1 ? PS1 : PS2;
   return Better1 ? PS1 : PS2;
 }
 }
@@ -4669,7 +4669,7 @@ Sema::getMoreSpecializedPartialSpecialization(
   bool Better1 = !DeduceTemplateArgumentsByTypeMatch(
   bool Better1 = !DeduceTemplateArgumentsByTypeMatch(
       *this, PS2->getTemplateParameters(), PT2, PT1, Info, Deduced, TDF_None,
       *this, PS2->getTemplateParameters(), PT2, PT1, Info, Deduced, TDF_None,
       /*PartialOrdering=*/true,
       /*PartialOrdering=*/true,
-      /*RefParamComparisons=*/0);
+      /*RefParamComparisons=*/nullptr);
   if (Better1) {
   if (Better1) {
     SmallVector<TemplateArgument, 4> DeducedArgs(Deduced.begin(),
     SmallVector<TemplateArgument, 4> DeducedArgs(Deduced.begin(),
                                                  Deduced.end());
                                                  Deduced.end());
@@ -4686,7 +4686,7 @@ Sema::getMoreSpecializedPartialSpecialization(
                                             PS1->getTemplateParameters(),
                                             PS1->getTemplateParameters(),
                                             PT1, PT2, Info, Deduced, TDF_None,
                                             PT1, PT2, Info, Deduced, TDF_None,
                                             /*PartialOrdering=*/true,
                                             /*PartialOrdering=*/true,
-                                            /*RefParamComparisons=*/0);
+                                            /*RefParamComparisons=*/nullptr);
   if (Better2) {
   if (Better2) {
     SmallVector<TemplateArgument, 4> DeducedArgs(Deduced.begin(),Deduced.end());
     SmallVector<TemplateArgument, 4> DeducedArgs(Deduced.begin(),Deduced.end());
     InstantiatingTemplate Inst(*this, Loc, PS1, DeducedArgs, Info);
     InstantiatingTemplate Inst(*this, Loc, PS1, DeducedArgs, Info);
@@ -4696,7 +4696,7 @@ Sema::getMoreSpecializedPartialSpecialization(
   }
   }
 
 
   if (Better1 == Better2)
   if (Better1 == Better2)
-    return 0;
+    return nullptr;
 
 
   return Better1? PS1 : PS2;
   return Better1? PS1 : PS2;
 }
 }

+ 40 - 39
lib/Sema/SemaTemplateInstantiate.cpp

@@ -532,8 +532,8 @@ void Sema::PrintInstantiationStack() {
       std::string Name;
       std::string Name;
       if (!Parm->getName().empty())
       if (!Parm->getName().empty())
         Name = std::string(" '") + Parm->getName().str() + "'";
         Name = std::string(" '") + Parm->getName().str() + "'";
-                    
-      TemplateParameterList *TemplateParams = 0;
+
+      TemplateParameterList *TemplateParams = nullptr;
       if (TemplateDecl *Template = dyn_cast<TemplateDecl>(Active->Template))
       if (TemplateDecl *Template = dyn_cast<TemplateDecl>(Active->Template))
         TemplateParams = Template->getTemplateParameters();
         TemplateParams = Template->getTemplateParameters();
       else
       else
@@ -552,7 +552,7 @@ void Sema::PrintInstantiationStack() {
     }
     }
 
 
     case ActiveTemplateInstantiation::DefaultTemplateArgumentChecking: {
     case ActiveTemplateInstantiation::DefaultTemplateArgumentChecking: {
-      TemplateParameterList *TemplateParams = 0;
+      TemplateParameterList *TemplateParams = nullptr;
       if (TemplateDecl *Template = dyn_cast<TemplateDecl>(Active->Template))
       if (TemplateDecl *Template = dyn_cast<TemplateDecl>(Active->Template))
         TemplateParams = Template->getTemplateParameters();
         TemplateParams = Template->getTemplateParameters();
       else
       else
@@ -581,7 +581,7 @@ void Sema::PrintInstantiationStack() {
 
 
 Optional<TemplateDeductionInfo *> Sema::isSFINAEContext() const {
 Optional<TemplateDeductionInfo *> Sema::isSFINAEContext() const {
   if (InNonInstantiationSFINAEContext)
   if (InNonInstantiationSFINAEContext)
-    return Optional<TemplateDeductionInfo *>(0);
+    return Optional<TemplateDeductionInfo *>(nullptr);
 
 
   for (SmallVectorImpl<ActiveTemplateInstantiation>::const_reverse_iterator
   for (SmallVectorImpl<ActiveTemplateInstantiation>::const_reverse_iterator
          Active = ActiveTemplateInstantiations.rbegin(),
          Active = ActiveTemplateInstantiations.rbegin(),
@@ -761,11 +761,11 @@ namespace {
                                    NestedNameSpecifierLoc QualifierLoc,
                                    NestedNameSpecifierLoc QualifierLoc,
                                    QualType T);
                                    QualType T);
 
 
-    TemplateName TransformTemplateName(CXXScopeSpec &SS,
-                                       TemplateName Name,
-                                       SourceLocation NameLoc,                                     
-                                       QualType ObjectType = QualType(),
-                                       NamedDecl *FirstQualifierInScope = 0);
+    TemplateName
+    TransformTemplateName(CXXScopeSpec &SS, TemplateName Name,
+                          SourceLocation NameLoc,
+                          QualType ObjectType = QualType(),
+                          NamedDecl *FirstQualifierInScope = nullptr);
 
 
     ExprResult TransformPredefinedExpr(PredefinedExpr *E);
     ExprResult TransformPredefinedExpr(PredefinedExpr *E);
     ExprResult TransformDeclRefExpr(DeclRefExpr *E);
     ExprResult TransformDeclRefExpr(DeclRefExpr *E);
@@ -885,7 +885,7 @@ getPackSubstitutedTemplateArgument(Sema &S, TemplateArgument Arg) {
 
 
 Decl *TemplateInstantiator::TransformDecl(SourceLocation Loc, Decl *D) {
 Decl *TemplateInstantiator::TransformDecl(SourceLocation Loc, Decl *D) {
   if (!D)
   if (!D)
-    return 0;
+    return nullptr;
 
 
   if (TemplateTemplateParmDecl *TTP = dyn_cast<TemplateTemplateParmDecl>(D)) {
   if (TemplateTemplateParmDecl *TTP = dyn_cast<TemplateTemplateParmDecl>(D)) {
     if (TTP->getDepth() < TemplateArgs.getNumLevels()) {
     if (TTP->getDepth() < TemplateArgs.getNumLevels()) {
@@ -921,7 +921,7 @@ Decl *TemplateInstantiator::TransformDecl(SourceLocation Loc, Decl *D) {
 Decl *TemplateInstantiator::TransformDefinition(SourceLocation Loc, Decl *D) {
 Decl *TemplateInstantiator::TransformDefinition(SourceLocation Loc, Decl *D) {
   Decl *Inst = getSema().SubstDecl(D, getSema().CurContext, TemplateArgs);
   Decl *Inst = getSema().SubstDecl(D, getSema().CurContext, TemplateArgs);
   if (!Inst)
   if (!Inst)
-    return 0;
+    return nullptr;
 
 
   getSema().CurrentInstantiationScope->InstantiatedLocal(D, Inst);
   getSema().CurrentInstantiationScope->InstantiatedLocal(D, Inst);
   return Inst;
   return Inst;
@@ -945,8 +945,8 @@ TemplateInstantiator::TransformFirstQualifierInScope(NamedDecl *D,
                "Missing argument pack");
                "Missing argument pack");
         
         
         if (getSema().ArgumentPackSubstitutionIndex == -1)
         if (getSema().ArgumentPackSubstitutionIndex == -1)
-          return 0;
-        
+          return nullptr;
+
         Arg = getPackSubstitutedTemplateArgument(getSema(), Arg);
         Arg = getPackSubstitutedTemplateArgument(getSema(), Arg);
       }
       }
 
 
@@ -959,7 +959,7 @@ TemplateInstantiator::TransformFirstQualifierInScope(NamedDecl *D,
       
       
       // The resulting type is not a tag; complain.
       // The resulting type is not a tag; complain.
       getSema().Diag(Loc, diag::err_nested_name_spec_non_tag) << T;
       getSema().Diag(Loc, diag::err_nested_name_spec_non_tag) << T;
-      return 0;
+      return nullptr;
     }
     }
   }
   }
   
   
@@ -1155,7 +1155,7 @@ ExprResult TemplateInstantiator::transformNonTypeTemplateParmRef(
         return ExprError();
         return ExprError();
     } else {
     } else {
       // Propagate NULL template argument.
       // Propagate NULL template argument.
-      VD = 0;
+      VD = nullptr;
     }
     }
     
     
     // Derive the type we want the substituted decl to have.  This had
     // Derive the type we want the substituted decl to have.  This had
@@ -1393,7 +1393,7 @@ TemplateInstantiator::TransformTemplateTypeParmType(TypeLocBuilder &TLB,
   // the template parameter list of a member template inside the
   // the template parameter list of a member template inside the
   // template we are instantiating). Create a new template type
   // template we are instantiating). Create a new template type
   // parameter with the template "level" reduced by one.
   // parameter with the template "level" reduced by one.
-  TemplateTypeParmDecl *NewTTPDecl = 0;
+  TemplateTypeParmDecl *NewTTPDecl = nullptr;
   if (TemplateTypeParmDecl *OldTTPDecl = T->getDecl())
   if (TemplateTypeParmDecl *OldTTPDecl = T->getDecl())
     NewTTPDecl = cast_or_null<TemplateTypeParmDecl>(
     NewTTPDecl = cast_or_null<TemplateTypeParmDecl>(
                                   TransformDecl(TL.getNameLoc(), OldTTPDecl));
                                   TransformDecl(TL.getNameLoc(), OldTTPDecl));
@@ -1486,7 +1486,7 @@ TypeSourceInfo *Sema::SubstType(TypeLoc TL,
          "instantiation stack");
          "instantiation stack");
   
   
   if (TL.getType().isNull())
   if (TL.getType().isNull())
-    return 0;
+    return nullptr;
 
 
   if (!TL.getType()->isInstantiationDependentType() && 
   if (!TL.getType()->isInstantiationDependentType() && 
       !TL.getType()->isVariablyModifiedType()) {
       !TL.getType()->isVariablyModifiedType()) {
@@ -1502,7 +1502,7 @@ TypeSourceInfo *Sema::SubstType(TypeLoc TL,
   TLB.reserve(TL.getFullDataSize());
   TLB.reserve(TL.getFullDataSize());
   QualType Result = Instantiator.TransformType(TLB, TL);
   QualType Result = Instantiator.TransformType(TLB, TL);
   if (Result.isNull())
   if (Result.isNull())
-    return 0;
+    return nullptr;
 
 
   return TLB.getTypeSourceInfo(Context, Result);
   return TLB.getTypeSourceInfo(Context, Result);
 }
 }
@@ -1588,7 +1588,7 @@ TypeSourceInfo *Sema::SubstFunctionDeclType(TypeSourceInfo *T,
     Result = Instantiator.TransformType(TLB, TL);
     Result = Instantiator.TransformType(TLB, TL);
   }
   }
   if (Result.isNull())
   if (Result.isNull())
-    return 0;
+    return nullptr;
 
 
   return TLB.getTypeSourceInfo(Context, Result);
   return TLB.getTypeSourceInfo(Context, Result);
 }
 }
@@ -1599,8 +1599,8 @@ ParmVarDecl *Sema::SubstParmVarDecl(ParmVarDecl *OldParm,
                                     Optional<unsigned> NumExpansions,
                                     Optional<unsigned> NumExpansions,
                                     bool ExpectParameterPack) {
                                     bool ExpectParameterPack) {
   TypeSourceInfo *OldDI = OldParm->getTypeSourceInfo();
   TypeSourceInfo *OldDI = OldParm->getTypeSourceInfo();
-  TypeSourceInfo *NewDI = 0;
-  
+  TypeSourceInfo *NewDI = nullptr;
+
   TypeLoc OldTL = OldDI->getTypeLoc();
   TypeLoc OldTL = OldDI->getTypeLoc();
   if (PackExpansionTypeLoc ExpansionTL = OldTL.getAs<PackExpansionTypeLoc>()) {
   if (PackExpansionTypeLoc ExpansionTL = OldTL.getAs<PackExpansionTypeLoc>()) {
 
 
@@ -1609,8 +1609,8 @@ ParmVarDecl *Sema::SubstParmVarDecl(ParmVarDecl *OldParm,
     NewDI = SubstType(ExpansionTL.getPatternLoc(), TemplateArgs, 
     NewDI = SubstType(ExpansionTL.getPatternLoc(), TemplateArgs, 
                       OldParm->getLocation(), OldParm->getDeclName());
                       OldParm->getLocation(), OldParm->getDeclName());
     if (!NewDI)
     if (!NewDI)
-      return 0;
-        
+      return nullptr;
+
     if (NewDI->getType()->containsUnexpandedParameterPack()) {
     if (NewDI->getType()->containsUnexpandedParameterPack()) {
       // We still have unexpanded parameter packs, which means that
       // We still have unexpanded parameter packs, which means that
       // our function parameter is still a function parameter pack.
       // our function parameter is still a function parameter pack.
@@ -1625,7 +1625,7 @@ ParmVarDecl *Sema::SubstParmVarDecl(ParmVarDecl *OldParm,
       Diag(OldParm->getLocation(), 
       Diag(OldParm->getLocation(), 
            diag::err_function_parameter_pack_without_parameter_packs)
            diag::err_function_parameter_pack_without_parameter_packs)
         << NewDI->getType();
         << NewDI->getType();
-      return 0;
+      return nullptr;
     } 
     } 
   } else {
   } else {
     NewDI = SubstType(OldDI, TemplateArgs, OldParm->getLocation(), 
     NewDI = SubstType(OldDI, TemplateArgs, OldParm->getLocation(), 
@@ -1633,11 +1633,11 @@ ParmVarDecl *Sema::SubstParmVarDecl(ParmVarDecl *OldParm,
   }
   }
   
   
   if (!NewDI)
   if (!NewDI)
-    return 0;
+    return nullptr;
 
 
   if (NewDI->getType()->isVoidType()) {
   if (NewDI->getType()->isVoidType()) {
     Diag(OldParm->getLocation(), diag::err_param_with_void_type);
     Diag(OldParm->getLocation(), diag::err_param_with_void_type);
-    return 0;
+    return nullptr;
   }
   }
 
 
   ParmVarDecl *NewParm = CheckParameter(Context.getTranslationUnitDecl(),
   ParmVarDecl *NewParm = CheckParameter(Context.getTranslationUnitDecl(),
@@ -1647,8 +1647,8 @@ ParmVarDecl *Sema::SubstParmVarDecl(ParmVarDecl *OldParm,
                                         NewDI->getType(), NewDI,
                                         NewDI->getType(), NewDI,
                                         OldParm->getStorageClass());
                                         OldParm->getStorageClass());
   if (!NewParm)
   if (!NewParm)
-    return 0;
-                                                
+    return nullptr;
+
   // Mark the (new) default argument as uninstantiated (if any).
   // Mark the (new) default argument as uninstantiated (if any).
   if (OldParm->hasUninstantiatedDefaultArg()) {
   if (OldParm->hasUninstantiatedDefaultArg()) {
     Expr *Arg = OldParm->getUninstantiatedDefaultArg();
     Expr *Arg = OldParm->getUninstantiatedDefaultArg();
@@ -1698,8 +1698,9 @@ bool Sema::SubstParmTypes(SourceLocation Loc,
   
   
   TemplateInstantiator Instantiator(*this, TemplateArgs, Loc, 
   TemplateInstantiator Instantiator(*this, TemplateArgs, Loc, 
                                     DeclarationName());
                                     DeclarationName());
-  return Instantiator.TransformFunctionTypeParams(Loc, Params, NumParams, 0,
-                                                  ParamTypes, OutParams);
+  return Instantiator.TransformFunctionTypeParams(Loc, Params, NumParams,
+                                                  nullptr, ParamTypes,
+                                                  OutParams);
 }
 }
 
 
 /// \brief Perform substitution on the base class specifiers of the
 /// \brief Perform substitution on the base class specifiers of the
@@ -2012,8 +2013,8 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation,
   }
   }
 
 
   // Finish checking fields.
   // Finish checking fields.
-  ActOnFields(0, Instantiation->getLocation(), Instantiation, Fields, 
-              SourceLocation(), SourceLocation(), 0);
+  ActOnFields(nullptr, Instantiation->getLocation(), Instantiation, Fields,
+              SourceLocation(), SourceLocation(), nullptr);
   CheckCompletedCXXClass(Instantiation);
   CheckCompletedCXXClass(Instantiation);
 
 
   // Attach any in-class member initializers now the class is complete.
   // Attach any in-class member initializers now the class is complete.
@@ -2228,7 +2229,7 @@ bool Sema::InstantiateClassTemplateSpecialization(
     return true;
     return true;
   
   
   ClassTemplateDecl *Template = ClassTemplateSpec->getSpecializedTemplate();
   ClassTemplateDecl *Template = ClassTemplateSpec->getSpecializedTemplate();
-  CXXRecordDecl *Pattern = 0;
+  CXXRecordDecl *Pattern = nullptr;
 
 
   // C++ [temp.class.spec.match]p1:
   // C++ [temp.class.spec.match]p1:
   //   When a class template is used in a context that requires an
   //   When a class template is used in a context that requires an
@@ -2684,7 +2685,7 @@ LocalInstantiationScope::findInstantiationOf(const Decl *D) {
       if (const TagDecl *Tag = dyn_cast<TagDecl>(CheckD))
       if (const TagDecl *Tag = dyn_cast<TagDecl>(CheckD))
         CheckD = Tag->getPreviousDecl();
         CheckD = Tag->getPreviousDecl();
       else
       else
-        CheckD = 0;
+        CheckD = nullptr;
     } while (CheckD);
     } while (CheckD);
     
     
     // If we aren't combined with our outer scope, we're done. 
     // If we aren't combined with our outer scope, we're done. 
@@ -2696,13 +2697,13 @@ LocalInstantiationScope::findInstantiationOf(const Decl *D) {
   // deduction, we may not have values for template parameters yet.
   // deduction, we may not have values for template parameters yet.
   if (isa<NonTypeTemplateParmDecl>(D) || isa<TemplateTypeParmDecl>(D) ||
   if (isa<NonTypeTemplateParmDecl>(D) || isa<TemplateTypeParmDecl>(D) ||
       isa<TemplateTemplateParmDecl>(D))
       isa<TemplateTemplateParmDecl>(D))
-    return 0;
+    return nullptr;
 
 
   // If we didn't find the decl, then we either have a sema bug, or we have a
   // If we didn't find the decl, then we either have a sema bug, or we have a
   // forward reference to a label declaration.  Return null to indicate that
   // forward reference to a label declaration.  Return null to indicate that
   // we have an uninstantiated label.
   // we have an uninstantiated label.
   assert(isa<LabelDecl>(D) && "declaration not instantiated in this scope");
   assert(isa<LabelDecl>(D) && "declaration not instantiated in this scope");
-  return 0;
+  return nullptr;
 }
 }
 
 
 void LocalInstantiationScope::InstantiatedLocal(const Decl *D, Decl *Inst) {
 void LocalInstantiationScope::InstantiatedLocal(const Decl *D, Decl *Inst) {
@@ -2749,7 +2750,7 @@ NamedDecl *LocalInstantiationScope::getPartiallySubstitutedPack(
                                          const TemplateArgument **ExplicitArgs,
                                          const TemplateArgument **ExplicitArgs,
                                               unsigned *NumExplicitArgs) const {
                                               unsigned *NumExplicitArgs) const {
   if (ExplicitArgs)
   if (ExplicitArgs)
-    *ExplicitArgs = 0;
+    *ExplicitArgs = nullptr;
   if (NumExplicitArgs)
   if (NumExplicitArgs)
     *NumExplicitArgs = 0;
     *NumExplicitArgs = 0;
   
   
@@ -2767,6 +2768,6 @@ NamedDecl *LocalInstantiationScope::getPartiallySubstitutedPack(
     if (!Current->CombineWithOuterScope)
     if (!Current->CombineWithOuterScope)
       break;
       break;
   }
   }
-  
-  return 0;
+
+  return nullptr;
 }
 }

Datei-Diff unterdrückt, da er zu groß ist
+ 127 - 125
lib/Sema/SemaTemplateInstantiateDecl.cpp


+ 5 - 5
lib/Sema/SemaTemplateVariadic.cpp

@@ -223,7 +223,7 @@ Sema::DiagnoseUnexpandedParameterPacks(SourceLocation Loc,
   llvm::SmallPtrSet<IdentifierInfo *, 4> NamesKnown;
   llvm::SmallPtrSet<IdentifierInfo *, 4> NamesKnown;
 
 
   for (unsigned I = 0, N = Unexpanded.size(); I != N; ++I) {
   for (unsigned I = 0, N = Unexpanded.size(); I != N; ++I) {
-    IdentifierInfo *Name = 0;
+    IdentifierInfo *Name = nullptr;
     if (const TemplateTypeParmType *TTP
     if (const TemplateTypeParmType *TTP
           = Unexpanded[I].first.dyn_cast<const TemplateTypeParmType *>())
           = Unexpanded[I].first.dyn_cast<const TemplateTypeParmType *>())
       Name = TTP->getIdentifier();
       Name = TTP->getIdentifier();
@@ -463,7 +463,7 @@ Sema::CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc,
                                        Pattern->getTypeLoc().getSourceRange(),
                                        Pattern->getTypeLoc().getSourceRange(),
                                        EllipsisLoc, NumExpansions);
                                        EllipsisLoc, NumExpansions);
   if (Result.isNull())
   if (Result.isNull())
-    return 0;
+    return nullptr;
 
 
   TypeLocBuilder TLB;
   TypeLocBuilder TLB;
   TLB.pushFullCopy(Pattern->getTypeLoc());
   TLB.pushFullCopy(Pattern->getTypeLoc());
@@ -798,8 +798,8 @@ ExprResult Sema::ActOnSizeofParameterPackExpr(Scope *S,
   //   The identifier in a sizeof... expression shall name a parameter pack.
   //   The identifier in a sizeof... expression shall name a parameter pack.
   LookupResult R(*this, &Name, NameLoc, LookupOrdinaryName);
   LookupResult R(*this, &Name, NameLoc, LookupOrdinaryName);
   LookupName(R, S);
   LookupName(R, S);
-  
-  NamedDecl *ParameterPack = 0;
+
+  NamedDecl *ParameterPack = nullptr;
   ParameterPackValidatorCCC Validator;
   ParameterPackValidatorCCC Validator;
   switch (R.getResultKind()) {
   switch (R.getResultKind()) {
   case LookupResult::Found:
   case LookupResult::Found:
@@ -809,7 +809,7 @@ ExprResult Sema::ActOnSizeofParameterPackExpr(Scope *S,
   case LookupResult::NotFound:
   case LookupResult::NotFound:
   case LookupResult::NotFoundInCurrentInstantiation:
   case LookupResult::NotFoundInCurrentInstantiation:
     if (TypoCorrection Corrected = CorrectTypo(R.getLookupNameInfo(),
     if (TypoCorrection Corrected = CorrectTypo(R.getLookupNameInfo(),
-                                               R.getLookupKind(), S, 0,
+                                               R.getLookupKind(), S, nullptr,
                                                Validator, CTK_ErrorRecovery)) {
                                                Validator, CTK_ErrorRecovery)) {
       diagnoseTypo(Corrected,
       diagnoseTypo(Corrected,
                    PDiag(diag::err_sizeof_pack_no_pack_name_suggest) << &Name,
                    PDiag(diag::err_sizeof_pack_no_pack_name_suggest) << &Name,

+ 34 - 32
lib/Sema/SemaType.cpp

@@ -79,7 +79,8 @@ static void diagnoseBadTypeAttribute(Sema &S, const AttributeList &attr,
   StringRef name = attr.getName()->getName();
   StringRef name = attr.getName()->getName();
 
 
   // The GC attributes are usually written with macros;  special-case them.
   // The GC attributes are usually written with macros;  special-case them.
-  IdentifierInfo *II = attr.isArgIdent(0) ? attr.getArgAsIdent(0)->Ident : 0;
+  IdentifierInfo *II = attr.isArgIdent(0) ? attr.getArgAsIdent(0)->Ident
+                                          : nullptr;
   if (useExpansionLoc && loc.isMacroID() && II) {
   if (useExpansionLoc && loc.isMacroID() && II) {
     if (II->isStr("strong")) {
     if (II->isStr("strong")) {
       if (S.findMacroSpelling(loc, "__strong")) name = "__strong";
       if (S.findMacroSpelling(loc, "__strong")) name = "__strong";
@@ -223,14 +224,14 @@ namespace {
       assert(hasSavedAttrs);
       assert(hasSavedAttrs);
 
 
       if (savedAttrs.empty()) {
       if (savedAttrs.empty()) {
-        getMutableDeclSpec().getAttributes().set(0);
+        getMutableDeclSpec().getAttributes().set(nullptr);
         return;
         return;
       }
       }
 
 
       getMutableDeclSpec().getAttributes().set(savedAttrs[0]);
       getMutableDeclSpec().getAttributes().set(savedAttrs[0]);
       for (unsigned i = 0, e = savedAttrs.size() - 1; i != e; ++i)
       for (unsigned i = 0, e = savedAttrs.size() - 1; i != e; ++i)
         savedAttrs[i]->setNext(savedAttrs[i+1]);
         savedAttrs[i]->setNext(savedAttrs[i+1]);
-      savedAttrs.back()->setNext(0);
+      savedAttrs.back()->setNext(nullptr);
     }
     }
   };
   };
 }
 }
@@ -310,7 +311,7 @@ static DeclaratorChunk *maybeMovePastReturnType(Declarator &declarator,
                                                 unsigned i) {
                                                 unsigned i) {
   assert(i <= declarator.getNumTypeObjects());
   assert(i <= declarator.getNumTypeObjects());
 
 
-  DeclaratorChunk *result = 0;
+  DeclaratorChunk *result = nullptr;
 
 
   // First, look inwards past parens for a function declarator.
   // First, look inwards past parens for a function declarator.
   for (; i != 0; --i) {
   for (; i != 0; --i) {
@@ -378,7 +379,7 @@ static void distributeObjCPointerTypeAttr(TypeProcessingState &state,
     case DeclaratorChunk::BlockPointer: {
     case DeclaratorChunk::BlockPointer: {
       // But don't move an ARC ownership attribute to the return type
       // But don't move an ARC ownership attribute to the return type
       // of a block.
       // of a block.
-      DeclaratorChunk *destChunk = 0;
+      DeclaratorChunk *destChunk = nullptr;
       if (state.isProcessingDeclSpec() &&
       if (state.isProcessingDeclSpec() &&
           attr.getKind() == AttributeList::AT_ObjCOwnership)
           attr.getKind() == AttributeList::AT_ObjCOwnership)
         destChunk = maybeMovePastReturnType(declarator, i - 1);
         destChunk = maybeMovePastReturnType(declarator, i - 1);
@@ -662,7 +663,7 @@ static void maybeSynthesizeBlockSignature(TypeProcessingState &state,
                              /*HasProto=*/true,
                              /*HasProto=*/true,
                              /*IsAmbiguous=*/false,
                              /*IsAmbiguous=*/false,
                              /*LParenLoc=*/NoLoc,
                              /*LParenLoc=*/NoLoc,
-                             /*ArgInfo=*/0,
+                             /*ArgInfo=*/nullptr,
                              /*NumArgs=*/0,
                              /*NumArgs=*/0,
                              /*EllipsisLoc=*/NoLoc,
                              /*EllipsisLoc=*/NoLoc,
                              /*RParenLoc=*/NoLoc,
                              /*RParenLoc=*/NoLoc,
@@ -674,10 +675,10 @@ static void maybeSynthesizeBlockSignature(TypeProcessingState &state,
                              /*MutableLoc=*/NoLoc,
                              /*MutableLoc=*/NoLoc,
                              EST_None,
                              EST_None,
                              /*ESpecLoc=*/NoLoc,
                              /*ESpecLoc=*/NoLoc,
-                             /*Exceptions=*/0,
-                             /*ExceptionRanges=*/0,
+                             /*Exceptions=*/nullptr,
+                             /*ExceptionRanges=*/nullptr,
                              /*NumExceptions=*/0,
                              /*NumExceptions=*/0,
-                             /*NoexceptExpr=*/0,
+                             /*NoexceptExpr=*/nullptr,
                              loc, loc, declarator));
                              loc, loc, declarator));
 
 
   // For consistency, make sure the state still has us as processing
   // For consistency, make sure the state still has us as processing
@@ -1590,7 +1591,7 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM,
   llvm::APSInt ConstVal(Context.getTypeSize(Context.getSizeType()));
   llvm::APSInt ConstVal(Context.getTypeSize(Context.getSizeType()));
   if (!ArraySize) {
   if (!ArraySize) {
     if (ASM == ArrayType::Star)
     if (ASM == ArrayType::Star)
-      T = Context.getVariableArrayType(T, 0, ASM, Quals, Brackets);
+      T = Context.getVariableArrayType(T, nullptr, ASM, Quals, Brackets);
     else
     else
       T = Context.getIncompleteArrayType(T, ASM, Quals);
       T = Context.getIncompleteArrayType(T, ASM, Quals);
   } else if (ArraySize->isTypeDependent() || ArraySize->isValueDependent()) {
   } else if (ArraySize->isTypeDependent() || ArraySize->isValueDependent()) {
@@ -1871,11 +1872,11 @@ QualType Sema::BuildBlockPointerType(QualType T,
 QualType Sema::GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo) {
 QualType Sema::GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo) {
   QualType QT = Ty.get();
   QualType QT = Ty.get();
   if (QT.isNull()) {
   if (QT.isNull()) {
-    if (TInfo) *TInfo = 0;
+    if (TInfo) *TInfo = nullptr;
     return QualType();
     return QualType();
   }
   }
 
 
-  TypeSourceInfo *DI = 0;
+  TypeSourceInfo *DI = nullptr;
   if (const LocInfoType *LIT = dyn_cast<LocInfoType>(QT)) {
   if (const LocInfoType *LIT = dyn_cast<LocInfoType>(QT)) {
     QT = LIT->getType();
     QT = LIT->getType();
     DI = LIT->getTypeSourceInfo();
     DI = LIT->getTypeSourceInfo();
@@ -2107,10 +2108,10 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state,
   Sema &SemaRef = state.getSema();
   Sema &SemaRef = state.getSema();
   Declarator &D = state.getDeclarator();
   Declarator &D = state.getDeclarator();
   QualType T;
   QualType T;
-  ReturnTypeInfo = 0;
+  ReturnTypeInfo = nullptr;
 
 
   // The TagDecl owned by the DeclSpec.
   // The TagDecl owned by the DeclSpec.
-  TagDecl *OwnedTagDecl = 0;
+  TagDecl *OwnedTagDecl = nullptr;
 
 
   bool ContainsPlaceholderType = false;
   bool ContainsPlaceholderType = false;
 
 
@@ -2870,7 +2871,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
             S.Diag(FTI.getEllipsisLoc(), diag::err_ellipsis_first_param);
             S.Diag(FTI.getEllipsisLoc(), diag::err_ellipsis_first_param);
         }
         }
 
 
-        if (FTI.NumParams && FTI.Params[0].Param == 0) {
+        if (FTI.NumParams && FTI.Params[0].Param == nullptr) {
           // C99 6.7.5.3p3: Reject int(x,y,z) when it's not a function
           // C99 6.7.5.3p3: Reject int(x,y,z) when it's not a function
           // definition.
           // definition.
           S.Diag(FTI.Params[0].IdentLoc,
           S.Diag(FTI.Params[0].IdentLoc,
@@ -2970,7 +2971,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
         SmallVector<QualType, 4> Exceptions;
         SmallVector<QualType, 4> Exceptions;
         SmallVector<ParsedType, 2> DynamicExceptions;
         SmallVector<ParsedType, 2> DynamicExceptions;
         SmallVector<SourceRange, 2> DynamicExceptionRanges;
         SmallVector<SourceRange, 2> DynamicExceptionRanges;
-        Expr *NoexceptExpr = 0;
+        Expr *NoexceptExpr = nullptr;
 
 
         if (FTI.getExceptionSpecType() == EST_Dynamic) {
         if (FTI.getExceptionSpecType() == EST_Dynamic) {
           // FIXME: It's rather inefficient to have to split into two vectors
           // FIXME: It's rather inefficient to have to split into two vectors
@@ -3256,7 +3257,7 @@ TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S) {
 
 
   TypeProcessingState state(*this, D);
   TypeProcessingState state(*this, D);
 
 
-  TypeSourceInfo *ReturnTypeInfo = 0;
+  TypeSourceInfo *ReturnTypeInfo = nullptr;
   QualType T = GetDeclSpecTypeForDeclarator(state, ReturnTypeInfo);
   QualType T = GetDeclSpecTypeForDeclarator(state, ReturnTypeInfo);
   if (T.isNull())
   if (T.isNull())
     return Context.getNullTypeSourceInfo();
     return Context.getNullTypeSourceInfo();
@@ -3291,7 +3292,7 @@ static void transferARCOwnershipToDeclaratorChunk(TypeProcessingState &state,
     if (attr->getKind() == AttributeList::AT_ObjCOwnership)
     if (attr->getKind() == AttributeList::AT_ObjCOwnership)
       return;
       return;
 
 
-  const char *attrStr = 0;
+  const char *attrStr = nullptr;
   switch (ownership) {
   switch (ownership) {
   case Qualifiers::OCL_None: llvm_unreachable("no ownership!");
   case Qualifiers::OCL_None: llvm_unreachable("no ownership!");
   case Qualifiers::OCL_ExplicitNone: attrStr = "none"; break;
   case Qualifiers::OCL_ExplicitNone: attrStr = "none"; break;
@@ -3310,7 +3311,7 @@ static void transferARCOwnershipToDeclaratorChunk(TypeProcessingState &state,
   // so that we don't make an AttributedType for it).
   // so that we don't make an AttributedType for it).
   AttributeList *attr = D.getAttributePool()
   AttributeList *attr = D.getAttributePool()
     .create(&S.Context.Idents.get("objc_ownership"), SourceLocation(),
     .create(&S.Context.Idents.get("objc_ownership"), SourceLocation(),
-            /*scope*/ 0, SourceLocation(),
+            /*scope*/ nullptr, SourceLocation(),
             /*args*/ &Args, 1, AttributeList::AS_GNU);
             /*args*/ &Args, 1, AttributeList::AS_GNU);
   spliceAttrIntoList(*attr, chunk.getAttrListRef());
   spliceAttrIntoList(*attr, chunk.getAttrListRef());
 
 
@@ -3371,7 +3372,7 @@ static void transferARCOwnership(TypeProcessingState &state,
 TypeSourceInfo *Sema::GetTypeForDeclaratorCast(Declarator &D, QualType FromTy) {
 TypeSourceInfo *Sema::GetTypeForDeclaratorCast(Declarator &D, QualType FromTy) {
   TypeProcessingState state(*this, D);
   TypeProcessingState state(*this, D);
 
 
-  TypeSourceInfo *ReturnTypeInfo = 0;
+  TypeSourceInfo *ReturnTypeInfo = nullptr;
   QualType declSpecTy = GetDeclSpecTypeForDeclarator(state, ReturnTypeInfo);
   QualType declSpecTy = GetDeclSpecTypeForDeclarator(state, ReturnTypeInfo);
   if (declSpecTy.isNull())
   if (declSpecTy.isNull())
     return Context.getNullTypeSourceInfo();
     return Context.getNullTypeSourceInfo();
@@ -3521,7 +3522,7 @@ namespace {
       Visit(TL.getPointeeLoc());
       Visit(TL.getPointeeLoc());
     }
     }
     void VisitTemplateSpecializationTypeLoc(TemplateSpecializationTypeLoc TL) {
     void VisitTemplateSpecializationTypeLoc(TemplateSpecializationTypeLoc TL) {
-      TypeSourceInfo *TInfo = 0;
+      TypeSourceInfo *TInfo = nullptr;
       Sema::GetTypeFromParser(DS.getRepAsType(), &TInfo);
       Sema::GetTypeFromParser(DS.getRepAsType(), &TInfo);
 
 
       // If we got no declarator info from previous Sema routines,
       // If we got no declarator info from previous Sema routines,
@@ -3553,7 +3554,7 @@ namespace {
       TL.setTypeofLoc(DS.getTypeSpecTypeLoc());
       TL.setTypeofLoc(DS.getTypeSpecTypeLoc());
       TL.setParensRange(DS.getTypeofParensRange());
       TL.setParensRange(DS.getTypeofParensRange());
       assert(DS.getRepAsType());
       assert(DS.getRepAsType());
-      TypeSourceInfo *TInfo = 0;
+      TypeSourceInfo *TInfo = nullptr;
       Sema::GetTypeFromParser(DS.getRepAsType(), &TInfo);
       Sema::GetTypeFromParser(DS.getRepAsType(), &TInfo);
       TL.setUnderlyingTInfo(TInfo);
       TL.setUnderlyingTInfo(TInfo);
     }
     }
@@ -3563,7 +3564,7 @@ namespace {
       TL.setKWLoc(DS.getTypeSpecTypeLoc());
       TL.setKWLoc(DS.getTypeSpecTypeLoc());
       TL.setParensRange(DS.getTypeofParensRange());
       TL.setParensRange(DS.getTypeofParensRange());
       assert(DS.getRepAsType());
       assert(DS.getRepAsType());
-      TypeSourceInfo *TInfo = 0;
+      TypeSourceInfo *TInfo = nullptr;
       Sema::GetTypeFromParser(DS.getRepAsType(), &TInfo);
       Sema::GetTypeFromParser(DS.getRepAsType(), &TInfo);
       TL.setUnderlyingTInfo(TInfo);
       TL.setUnderlyingTInfo(TInfo);
     }
     }
@@ -3586,7 +3587,7 @@ namespace {
       ElaboratedTypeKeyword Keyword
       ElaboratedTypeKeyword Keyword
         = TypeWithKeyword::getKeywordForTypeSpec(DS.getTypeSpecType());
         = TypeWithKeyword::getKeywordForTypeSpec(DS.getTypeSpecType());
       if (DS.getTypeSpecType() == TST_typename) {
       if (DS.getTypeSpecType() == TST_typename) {
-        TypeSourceInfo *TInfo = 0;
+        TypeSourceInfo *TInfo = nullptr;
         Sema::GetTypeFromParser(DS.getRepAsType(), &TInfo);
         Sema::GetTypeFromParser(DS.getRepAsType(), &TInfo);
         if (TInfo) {
         if (TInfo) {
           TL.copy(TInfo->getTypeLoc().castAs<ElaboratedTypeLoc>());
           TL.copy(TInfo->getTypeLoc().castAs<ElaboratedTypeLoc>());
@@ -3602,7 +3603,7 @@ namespace {
     }
     }
     void VisitDependentNameTypeLoc(DependentNameTypeLoc TL) {
     void VisitDependentNameTypeLoc(DependentNameTypeLoc TL) {
       assert(DS.getTypeSpecType() == TST_typename);
       assert(DS.getTypeSpecType() == TST_typename);
-      TypeSourceInfo *TInfo = 0;
+      TypeSourceInfo *TInfo = nullptr;
       Sema::GetTypeFromParser(DS.getRepAsType(), &TInfo);
       Sema::GetTypeFromParser(DS.getRepAsType(), &TInfo);
       assert(TInfo);
       assert(TInfo);
       TL.copy(TInfo->getTypeLoc().castAs<DependentNameTypeLoc>());
       TL.copy(TInfo->getTypeLoc().castAs<DependentNameTypeLoc>());
@@ -3610,7 +3611,7 @@ namespace {
     void VisitDependentTemplateSpecializationTypeLoc(
     void VisitDependentTemplateSpecializationTypeLoc(
                                  DependentTemplateSpecializationTypeLoc TL) {
                                  DependentTemplateSpecializationTypeLoc TL) {
       assert(DS.getTypeSpecType() == TST_typename);
       assert(DS.getTypeSpecType() == TST_typename);
-      TypeSourceInfo *TInfo = 0;
+      TypeSourceInfo *TInfo = nullptr;
       Sema::GetTypeFromParser(DS.getRepAsType(), &TInfo);
       Sema::GetTypeFromParser(DS.getRepAsType(), &TInfo);
       assert(TInfo);
       assert(TInfo);
       TL.copy(
       TL.copy(
@@ -3626,7 +3627,7 @@ namespace {
         TL.setKWLoc(DS.getTypeSpecTypeLoc());
         TL.setKWLoc(DS.getTypeSpecTypeLoc());
         TL.setParensRange(DS.getTypeofParensRange());
         TL.setParensRange(DS.getTypeofParensRange());
 
 
-        TypeSourceInfo *TInfo = 0;
+        TypeSourceInfo *TInfo = nullptr;
         Sema::GetTypeFromParser(DS.getRepAsType(), &TInfo);
         Sema::GetTypeFromParser(DS.getRepAsType(), &TInfo);
         assert(TInfo);
         assert(TInfo);
         TL.getValueLoc().initializeFullCopy(TInfo->getTypeLoc());
         TL.getValueLoc().initializeFullCopy(TInfo->getTypeLoc());
@@ -3864,7 +3865,8 @@ void LocInfoType::getAsStringInternal(std::string &Str,
 TypeResult Sema::ActOnTypeName(Scope *S, Declarator &D) {
 TypeResult Sema::ActOnTypeName(Scope *S, Declarator &D) {
   // C99 6.7.6: Type names have no identifier.  This is already validated by
   // C99 6.7.6: Type names have no identifier.  This is already validated by
   // the parser.
   // the parser.
-  assert(D.getIdentifier() == 0 && "Type name should have no identifier!");
+  assert(D.getIdentifier() == nullptr &&
+         "Type name should have no identifier!");
 
 
   TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S);
   TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S);
   QualType T = TInfo->getType();
   QualType T = TInfo->getType();
@@ -4269,7 +4271,7 @@ namespace {
         } else {
         } else {
           const Type *DTy = Ty->getUnqualifiedDesugaredType();
           const Type *DTy = Ty->getUnqualifiedDesugaredType();
           if (Ty == DTy) {
           if (Ty == DTy) {
-            Fn = 0;
+            Fn = nullptr;
             return;
             return;
           }
           }
 
 
@@ -4279,7 +4281,7 @@ namespace {
       }
       }
     }
     }
 
 
-    bool isFunctionType() const { return (Fn != 0); }
+    bool isFunctionType() const { return (Fn != nullptr); }
     const FunctionType *get() const { return Fn; }
     const FunctionType *get() const { return Fn; }
 
 
     QualType wrap(Sema &S, const FunctionType *New) {
     QualType wrap(Sema &S, const FunctionType *New) {
@@ -5157,7 +5159,7 @@ bool Sema::RequireCompleteTypeImpl(SourceLocation Loc, QualType T,
   //         "Can't ask whether a dependent type is complete");
   //         "Can't ask whether a dependent type is complete");
 
 
   // If we have a complete type, we're done.
   // If we have a complete type, we're done.
-  NamedDecl *Def = 0;
+  NamedDecl *Def = nullptr;
   if (!T->isIncompleteType(&Def)) {
   if (!T->isIncompleteType(&Def)) {
     // If we know about the definition but it is not visible, complain.
     // If we know about the definition but it is not visible, complain.
     NamedDecl *SuggestedDef = 0;
     NamedDecl *SuggestedDef = 0;
@@ -5451,7 +5453,7 @@ QualType Sema::getElaboratedType(ElaboratedTypeKeyword Keyword,
   else {
   else {
     if (Keyword == ETK_None)
     if (Keyword == ETK_None)
       return T;
       return T;
-    NNS = 0;
+    NNS = nullptr;
   }
   }
   return Context.getElaboratedType(Keyword, NNS, T);
   return Context.getElaboratedType(Keyword, NNS, T);
 }
 }

+ 127 - 124
lib/Sema/TreeTransform.h

@@ -371,7 +371,7 @@ public:
   /// \returns true if an error occurred, false otherwise.
   /// \returns true if an error occurred, false otherwise.
   bool TransformExprs(Expr **Inputs, unsigned NumInputs, bool IsCall,
   bool TransformExprs(Expr **Inputs, unsigned NumInputs, bool IsCall,
                       SmallVectorImpl<Expr *> &Outputs,
                       SmallVectorImpl<Expr *> &Outputs,
-                      bool *ArgChanged = 0);
+                      bool *ArgChanged = nullptr);
 
 
   /// \brief Transform the given declaration, which is referenced from a type
   /// \brief Transform the given declaration, which is referenced from a type
   /// or expression.
   /// or expression.
@@ -433,10 +433,10 @@ public:
   /// By default, transforms all of the types and declarations within the
   /// By default, transforms all of the types and declarations within the
   /// nested-name-specifier. Subclasses may override this function to provide
   /// nested-name-specifier. Subclasses may override this function to provide
   /// alternate behavior.
   /// alternate behavior.
-  NestedNameSpecifierLoc TransformNestedNameSpecifierLoc(
-                                                    NestedNameSpecifierLoc NNS,
-                                          QualType ObjectType = QualType(),
-                                          NamedDecl *FirstQualifierInScope = 0);
+  NestedNameSpecifierLoc
+  TransformNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS,
+                                  QualType ObjectType = QualType(),
+                                  NamedDecl *FirstQualifierInScope = nullptr);
 
 
   /// \brief Transform the given declaration name.
   /// \brief Transform the given declaration name.
   ///
   ///
@@ -467,11 +467,11 @@ public:
   /// By default, transforms the template name by transforming the declarations
   /// By default, transforms the template name by transforming the declarations
   /// and nested-name-specifiers that occur within the template name.
   /// and nested-name-specifiers that occur within the template name.
   /// Subclasses may override this function to provide alternate behavior.
   /// Subclasses may override this function to provide alternate behavior.
-  TemplateName TransformTemplateName(CXXScopeSpec &SS,
-                                     TemplateName Name,
-                                     SourceLocation NameLoc,
-                                     QualType ObjectType = QualType(),
-                                     NamedDecl *FirstQualifierInScope = 0);
+  TemplateName
+  TransformTemplateName(CXXScopeSpec &SS, TemplateName Name,
+                        SourceLocation NameLoc,
+                        QualType ObjectType = QualType(),
+                        NamedDecl *FirstQualifierInScope = nullptr);
 
 
   /// \brief Transform the given template argument.
   /// \brief Transform the given template argument.
   ///
   ///
@@ -848,7 +848,8 @@ public:
     CXXScopeSpec SS;
     CXXScopeSpec SS;
     SS.Adopt(QualifierLoc);
     SS.Adopt(QualifierLoc);
     TemplateName InstName
     TemplateName InstName
-      = getDerived().RebuildTemplateName(SS, *Name, NameLoc, QualType(), 0);
+      = getDerived().RebuildTemplateName(SS, *Name, NameLoc, QualType(),
+                                         nullptr);
 
 
     if (InstName.isNull())
     if (InstName.isNull())
       return QualType();
       return QualType();
@@ -866,7 +867,7 @@ public:
     getDerived().RebuildTemplateSpecializationType(InstName, NameLoc, Args);
     getDerived().RebuildTemplateSpecializationType(InstName, NameLoc, Args);
     if (T.isNull()) return QualType();
     if (T.isNull()) return QualType();
 
 
-    if (Keyword == ETK_None && QualifierLoc.getNestedNameSpecifier() == 0)
+    if (Keyword == ETK_None && QualifierLoc.getNestedNameSpecifier() == nullptr)
       return T;
       return T;
 
 
     return SemaRef.Context.getElaboratedType(Keyword,
     return SemaRef.Context.getElaboratedType(Keyword,
@@ -912,7 +913,7 @@ public:
     if (SemaRef.RequireCompleteDeclContext(SS, DC))
     if (SemaRef.RequireCompleteDeclContext(SS, DC))
       return QualType();
       return QualType();
 
 
-    TagDecl *Tag = 0;
+    TagDecl *Tag = nullptr;
     SemaRef.LookupQualifiedName(Result, DC);
     SemaRef.LookupQualifiedName(Result, DC);
     switch (Result.getResultKind()) {
     switch (Result.getResultKind()) {
       case LookupResult::NotFound:
       case LookupResult::NotFound:
@@ -1079,7 +1080,7 @@ public:
                                       SourceLocation ColonLoc,
                                       SourceLocation ColonLoc,
                                       Stmt *SubStmt) {
                                       Stmt *SubStmt) {
     return getSema().ActOnDefaultStmt(DefaultLoc, ColonLoc, SubStmt,
     return getSema().ActOnDefaultStmt(DefaultLoc, ColonLoc, SubStmt,
-                                      /*CurScope=*/0);
+                                      /*CurScope=*/nullptr);
   }
   }
 
 
   /// \brief Build a new label statement.
   /// \brief Build a new label statement.
@@ -1474,7 +1475,7 @@ public:
                                 SourceLocation StartLoc,
                                 SourceLocation StartLoc,
                                 SourceLocation IdLoc,
                                 SourceLocation IdLoc,
                                 IdentifierInfo *Id) {
                                 IdentifierInfo *Id) {
-    VarDecl *Var = getSema().BuildExceptionDeclaration(0, Declarator,
+    VarDecl *Var = getSema().BuildExceptionDeclaration(nullptr, Declarator,
                                                        StartLoc, IdLoc, Id);
                                                        StartLoc, IdLoc, Id);
     if (Var)
     if (Var)
       getSema().CurContext->addDecl(Var);
       getSema().CurContext->addDecl(Var);
@@ -1624,7 +1625,7 @@ public:
   ExprResult RebuildUnaryOperator(SourceLocation OpLoc,
   ExprResult RebuildUnaryOperator(SourceLocation OpLoc,
                                         UnaryOperatorKind Opc,
                                         UnaryOperatorKind Opc,
                                         Expr *SubExpr) {
                                         Expr *SubExpr) {
-    return getSema().BuildUnaryOp(/*Scope=*/0, OpLoc, Opc, SubExpr);
+    return getSema().BuildUnaryOp(/*Scope=*/nullptr, OpLoc, Opc, SubExpr);
   }
   }
 
 
   /// \brief Build a new builtin offsetof expression.
   /// \brief Build a new builtin offsetof expression.
@@ -1676,7 +1677,7 @@ public:
                                              SourceLocation LBracketLoc,
                                              SourceLocation LBracketLoc,
                                              Expr *RHS,
                                              Expr *RHS,
                                              SourceLocation RBracketLoc) {
                                              SourceLocation RBracketLoc) {
-    return getSema().ActOnArraySubscriptExpr(/*Scope=*/0, LHS,
+    return getSema().ActOnArraySubscriptExpr(/*Scope=*/nullptr, LHS,
                                              LBracketLoc, RHS,
                                              LBracketLoc, RHS,
                                              RBracketLoc);
                                              RBracketLoc);
   }
   }
@@ -1688,8 +1689,8 @@ public:
   ExprResult RebuildCallExpr(Expr *Callee, SourceLocation LParenLoc,
   ExprResult RebuildCallExpr(Expr *Callee, SourceLocation LParenLoc,
                                    MultiExprArg Args,
                                    MultiExprArg Args,
                                    SourceLocation RParenLoc,
                                    SourceLocation RParenLoc,
-                                   Expr *ExecConfig = 0) {
-    return getSema().ActOnCallExpr(/*Scope=*/0, Callee, LParenLoc,
+                                   Expr *ExecConfig = nullptr) {
+    return getSema().ActOnCallExpr(/*Scope=*/nullptr, Callee, LParenLoc,
                                    Args, RParenLoc, ExecConfig);
                                    Args, RParenLoc, ExecConfig);
   }
   }
 
 
@@ -1757,7 +1758,7 @@ public:
   ExprResult RebuildBinaryOperator(SourceLocation OpLoc,
   ExprResult RebuildBinaryOperator(SourceLocation OpLoc,
                                          BinaryOperatorKind Opc,
                                          BinaryOperatorKind Opc,
                                          Expr *LHS, Expr *RHS) {
                                          Expr *LHS, Expr *RHS) {
-    return getSema().BuildBinOp(/*Scope=*/0, OpLoc, Opc, LHS, RHS);
+    return getSema().BuildBinOp(/*Scope=*/nullptr, OpLoc, Opc, LHS, RHS);
   }
   }
 
 
   /// \brief Build a new conditional operator expression.
   /// \brief Build a new conditional operator expression.
@@ -1811,9 +1812,9 @@ public:
     return getSema().BuildMemberReferenceExpr(Base, Base->getType(),
     return getSema().BuildMemberReferenceExpr(Base, Base->getType(),
                                               OpLoc, /*IsArrow*/ false,
                                               OpLoc, /*IsArrow*/ false,
                                               SS, SourceLocation(),
                                               SS, SourceLocation(),
-                                              /*FirstQualifierInScope*/ 0,
+                                              /*FirstQualifierInScope*/ nullptr,
                                               NameInfo,
                                               NameInfo,
-                                              /* TemplateArgs */ 0);
+                                              /* TemplateArgs */ nullptr);
   }
   }
 
 
   /// \brief Build a new initializer list expression.
   /// \brief Build a new initializer list expression.
@@ -2495,7 +2496,7 @@ public:
                    Sema::LookupMemberName);
                    Sema::LookupMemberName);
     ExprResult Result = getSema().LookupMemberExpr(R, Base, IsArrow,
     ExprResult Result = getSema().LookupMemberExpr(R, Base, IsArrow,
                                                          /*FIME:*/IvarLoc,
                                                          /*FIME:*/IvarLoc,
-                                                         SS, 0,
+                                                         SS, nullptr,
                                                          false);
                                                          false);
     if (Result.isInvalid() || Base.isInvalid())
     if (Result.isInvalid() || Base.isInvalid())
       return ExprError();
       return ExprError();
@@ -2506,9 +2507,9 @@ public:
     return getSema().BuildMemberReferenceExpr(Base.get(), Base.get()->getType(),
     return getSema().BuildMemberReferenceExpr(Base.get(), Base.get()->getType(),
                                               /*FIXME:*/IvarLoc, IsArrow,
                                               /*FIXME:*/IvarLoc, IsArrow,
                                               SS, SourceLocation(),
                                               SS, SourceLocation(),
-                                              /*FirstQualifierInScope=*/0,
+                                              /*FirstQualifierInScope=*/nullptr,
                                               R,
                                               R,
-                                              /*TemplateArgs=*/0);
+                                              /*TemplateArgs=*/nullptr);
   }
   }
 
 
   /// \brief Build a new Objective-C property reference expression.
   /// \brief Build a new Objective-C property reference expression.
@@ -2525,7 +2526,7 @@ public:
     bool IsArrow = false;
     bool IsArrow = false;
     ExprResult Result = getSema().LookupMemberExpr(R, Base, IsArrow,
     ExprResult Result = getSema().LookupMemberExpr(R, Base, IsArrow,
                                                          /*FIME:*/PropertyLoc,
                                                          /*FIME:*/PropertyLoc,
-                                                         SS, 0, false);
+                                                         SS, nullptr, false);
     if (Result.isInvalid() || Base.isInvalid())
     if (Result.isInvalid() || Base.isInvalid())
       return ExprError();
       return ExprError();
 
 
@@ -2535,9 +2536,8 @@ public:
     return getSema().BuildMemberReferenceExpr(Base.get(), Base.get()->getType(),
     return getSema().BuildMemberReferenceExpr(Base.get(), Base.get()->getType(),
                                               /*FIXME:*/PropertyLoc, IsArrow,
                                               /*FIXME:*/PropertyLoc, IsArrow,
                                               SS, SourceLocation(),
                                               SS, SourceLocation(),
-                                              /*FirstQualifierInScope=*/0,
-                                              R,
-                                              /*TemplateArgs=*/0);
+                                              /*FirstQualifierInScope=*/nullptr,
+                                              R, /*TemplateArgs=*/nullptr);
   }
   }
 
 
   /// \brief Build a new Objective-C property reference expression.
   /// \brief Build a new Objective-C property reference expression.
@@ -2569,7 +2569,7 @@ public:
                    Sema::LookupMemberName);
                    Sema::LookupMemberName);
     ExprResult Result = getSema().LookupMemberExpr(R, Base, IsArrow,
     ExprResult Result = getSema().LookupMemberExpr(R, Base, IsArrow,
                                                          OpLoc,
                                                          OpLoc,
-                                                         SS, 0, false);
+                                                         SS, nullptr, false);
     if (Result.isInvalid() || Base.isInvalid())
     if (Result.isInvalid() || Base.isInvalid())
       return ExprError();
       return ExprError();
 
 
@@ -2579,9 +2579,9 @@ public:
     return getSema().BuildMemberReferenceExpr(Base.get(), Base.get()->getType(),
     return getSema().BuildMemberReferenceExpr(Base.get(), Base.get()->getType(),
                                               OpLoc, IsArrow,
                                               OpLoc, IsArrow,
                                               SS, SourceLocation(),
                                               SS, SourceLocation(),
-                                              /*FirstQualifierInScope=*/0,
+                                              /*FirstQualifierInScope=*/nullptr,
                                               R,
                                               R,
-                                              /*TemplateArgs=*/0);
+                                              /*TemplateArgs=*/nullptr);
   }
   }
 
 
   /// \brief Build a new shuffle vector expression.
   /// \brief Build a new shuffle vector expression.
@@ -2961,7 +2961,7 @@ TreeTransform<Derived>::TransformNestedNameSpecifierLoc(
 
 
     switch (QNNS->getKind()) {
     switch (QNNS->getKind()) {
     case NestedNameSpecifier::Identifier:
     case NestedNameSpecifier::Identifier:
-      if (SemaRef.BuildCXXNestedNameSpecifier(/*Scope=*/0,
+      if (SemaRef.BuildCXXNestedNameSpecifier(/*Scope=*/nullptr,
                                               *QNNS->getAsIdentifier(),
                                               *QNNS->getAsIdentifier(),
                                               Q.getLocalBeginLoc(),
                                               Q.getLocalBeginLoc(),
                                               Q.getLocalEndLoc(),
                                               Q.getLocalEndLoc(),
@@ -3029,7 +3029,7 @@ TreeTransform<Derived>::TransformNestedNameSpecifierLoc(
     }
     }
 
 
     // The qualifier-in-scope and object type only apply to the leftmost entity.
     // The qualifier-in-scope and object type only apply to the leftmost entity.
-    FirstQualifierInScope = 0;
+    FirstQualifierInScope = nullptr;
     ObjectType = QualType();
     ObjectType = QualType();
   }
   }
 
 
@@ -3078,7 +3078,7 @@ TreeTransform<Derived>
       NewCanTy = SemaRef.Context.getCanonicalType(NewTInfo->getType());
       NewCanTy = SemaRef.Context.getCanonicalType(NewTInfo->getType());
     }
     }
     else {
     else {
-      NewTInfo = 0;
+      NewTInfo = nullptr;
       TemporaryBase Rebase(*this, NameInfo.getLoc(), Name);
       TemporaryBase Rebase(*this, NameInfo.getLoc(), Name);
       QualType NewT = getDerived().TransformType(Name.getCXXNameType());
       QualType NewT = getDerived().TransformType(Name.getCXXNameType());
       if (NewT.isNull())
       if (NewT.isNull())
@@ -3129,7 +3129,7 @@ TreeTransform<Derived>::TransformTemplateName(CXXScopeSpec &SS,
     if (SS.getScopeRep()) {
     if (SS.getScopeRep()) {
       // These apply to the scope specifier, not the template.
       // These apply to the scope specifier, not the template.
       ObjectType = QualType();
       ObjectType = QualType();
-      FirstQualifierInScope = 0;
+      FirstQualifierInScope = nullptr;
     }
     }
 
 
     if (!getDerived().AlwaysRebuild() &&
     if (!getDerived().AlwaysRebuild() &&
@@ -3248,7 +3248,7 @@ bool TreeTransform<Derived>::TransformTemplateArgument(
 
 
   case TemplateArgument::Type: {
   case TemplateArgument::Type: {
     TypeSourceInfo *DI = Input.getTypeSourceInfo();
     TypeSourceInfo *DI = Input.getTypeSourceInfo();
-    if (DI == NULL)
+    if (!DI)
       DI = InventTypeSourceInfo(Input.getArgument().getAsType());
       DI = InventTypeSourceInfo(Input.getArgument().getAsType());
 
 
     DI = getDerived().TransformType(DI);
     DI = getDerived().TransformType(DI);
@@ -3518,7 +3518,7 @@ TypeSourceInfo *TreeTransform<Derived>::TransformType(TypeSourceInfo *DI) {
 
 
   QualType Result = getDerived().TransformType(TLB, TL);
   QualType Result = getDerived().TransformType(TLB, TL);
   if (Result.isNull())
   if (Result.isNull())
-    return 0;
+    return nullptr;
 
 
   return TLB.getTypeSourceInfo(SemaRef.Context, Result);
   return TLB.getTypeSourceInfo(SemaRef.Context, Result);
 }
 }
@@ -3662,7 +3662,7 @@ TypeSourceInfo *TreeTransform<Derived>::TransformTSIInObjectScope(
                                          SpecTL.getTemplateNameLoc(),
                                          SpecTL.getTemplateNameLoc(),
                                          ObjectType, UnqualLookup);
                                          ObjectType, UnqualLookup);
     if (Template.isNull())
     if (Template.isNull())
-      return 0;
+      return nullptr;
 
 
     Result = getDerived().TransformTemplateSpecializationType(TLB, SpecTL,
     Result = getDerived().TransformTemplateSpecializationType(TLB, SpecTL,
                                                               Template);
                                                               Template);
@@ -3676,7 +3676,7 @@ TypeSourceInfo *TreeTransform<Derived>::TransformTSIInObjectScope(
                                          SpecTL.getTemplateNameLoc(),
                                          SpecTL.getTemplateNameLoc(),
                                          ObjectType, UnqualLookup);
                                          ObjectType, UnqualLookup);
     if (Template.isNull())
     if (Template.isNull())
-      return 0;
+      return nullptr;
 
 
     Result = getDerived().TransformDependentTemplateSpecializationType(TLB,
     Result = getDerived().TransformDependentTemplateSpecializationType(TLB,
                                                                        SpecTL,
                                                                        SpecTL,
@@ -3688,7 +3688,7 @@ TypeSourceInfo *TreeTransform<Derived>::TransformTSIInObjectScope(
   }
   }
 
 
   if (Result.isNull())
   if (Result.isNull())
-    return 0;
+    return nullptr;
 
 
   return TLB.getTypeSourceInfo(SemaRef.Context, Result);
   return TLB.getTypeSourceInfo(SemaRef.Context, Result);
 }
 }
@@ -3864,7 +3864,7 @@ TreeTransform<Derived>::TransformMemberPointerType(TypeLocBuilder &TLB,
     return QualType();
     return QualType();
 
 
   TypeSourceInfo* OldClsTInfo = TL.getClassTInfo();
   TypeSourceInfo* OldClsTInfo = TL.getClassTInfo();
-  TypeSourceInfo* NewClsTInfo = 0;
+  TypeSourceInfo *NewClsTInfo = nullptr;
   if (OldClsTInfo) {
   if (OldClsTInfo) {
     NewClsTInfo = getDerived().TransformType(OldClsTInfo);
     NewClsTInfo = getDerived().TransformType(OldClsTInfo);
     if (!NewClsTInfo)
     if (!NewClsTInfo)
@@ -3971,7 +3971,7 @@ QualType TreeTransform<Derived>::TransformIncompleteArrayType(
   IncompleteArrayTypeLoc NewTL = TLB.push<IncompleteArrayTypeLoc>(Result);
   IncompleteArrayTypeLoc NewTL = TLB.push<IncompleteArrayTypeLoc>(Result);
   NewTL.setLBracketLoc(TL.getLBracketLoc());
   NewTL.setLBracketLoc(TL.getLBracketLoc());
   NewTL.setRBracketLoc(TL.getRBracketLoc());
   NewTL.setRBracketLoc(TL.getRBracketLoc());
-  NewTL.setSizeExpr(0);
+  NewTL.setSizeExpr(nullptr);
 
 
   return Result;
   return Result;
 }
 }
@@ -4159,7 +4159,7 @@ ParmVarDecl *TreeTransform<Derived>::TransformFunctionTypeParam(
     ParmVarDecl *OldParm, int indexAdjustment, Optional<unsigned> NumExpansions,
     ParmVarDecl *OldParm, int indexAdjustment, Optional<unsigned> NumExpansions,
     bool ExpectParameterPack) {
     bool ExpectParameterPack) {
   TypeSourceInfo *OldDI = OldParm->getTypeSourceInfo();
   TypeSourceInfo *OldDI = OldParm->getTypeSourceInfo();
-  TypeSourceInfo *NewDI = 0;
+  TypeSourceInfo *NewDI = nullptr;
 
 
   if (NumExpansions && isa<PackExpansionType>(OldDI->getType())) {
   if (NumExpansions && isa<PackExpansionType>(OldDI->getType())) {
     // If we're substituting into a pack expansion type and we know the
     // If we're substituting into a pack expansion type and we know the
@@ -4174,14 +4174,14 @@ ParmVarDecl *TreeTransform<Derived>::TransformFunctionTypeParam(
     QualType Result = getDerived().TransformType(TLB,
     QualType Result = getDerived().TransformType(TLB,
                                                OldExpansionTL.getPatternLoc());
                                                OldExpansionTL.getPatternLoc());
     if (Result.isNull())
     if (Result.isNull())
-      return 0;
+      return nullptr;
 
 
     Result = RebuildPackExpansionType(Result,
     Result = RebuildPackExpansionType(Result,
                                 OldExpansionTL.getPatternLoc().getSourceRange(),
                                 OldExpansionTL.getPatternLoc().getSourceRange(),
                                       OldExpansionTL.getEllipsisLoc(),
                                       OldExpansionTL.getEllipsisLoc(),
                                       NumExpansions);
                                       NumExpansions);
     if (Result.isNull())
     if (Result.isNull())
-      return 0;
+      return nullptr;
 
 
     PackExpansionTypeLoc NewExpansionTL
     PackExpansionTypeLoc NewExpansionTL
       = TLB.push<PackExpansionTypeLoc>(Result);
       = TLB.push<PackExpansionTypeLoc>(Result);
@@ -4190,7 +4190,7 @@ ParmVarDecl *TreeTransform<Derived>::TransformFunctionTypeParam(
   } else
   } else
     NewDI = getDerived().TransformType(OldDI);
     NewDI = getDerived().TransformType(OldDI);
   if (!NewDI)
   if (!NewDI)
-    return 0;
+    return nullptr;
 
 
   if (NewDI == OldDI && indexAdjustment == 0)
   if (NewDI == OldDI && indexAdjustment == 0)
     return OldParm;
     return OldParm;
@@ -4203,7 +4203,7 @@ ParmVarDecl *TreeTransform<Derived>::TransformFunctionTypeParam(
                                              NewDI->getType(),
                                              NewDI->getType(),
                                              NewDI,
                                              NewDI,
                                              OldParm->getStorageClass(),
                                              OldParm->getStorageClass(),
-                                             /* DefArg */ NULL);
+                                             /* DefArg */ nullptr);
   newParm->setScopeInfo(OldParm->getFunctionScopeDepth(),
   newParm->setScopeInfo(OldParm->getFunctionScopeDepth(),
                         OldParm->getFunctionScopeIndex() + indexAdjustment);
                         OldParm->getFunctionScopeIndex() + indexAdjustment);
   return newParm;
   return newParm;
@@ -4223,7 +4223,7 @@ bool TreeTransform<Derived>::
       assert(OldParm->getFunctionScopeIndex() == i);
       assert(OldParm->getFunctionScopeIndex() == i);
 
 
       Optional<unsigned> NumExpansions;
       Optional<unsigned> NumExpansions;
-      ParmVarDecl *NewParm = 0;
+      ParmVarDecl *NewParm = nullptr;
       if (OldParm->isParameterPack()) {
       if (OldParm->isParameterPack()) {
         // We have a function parameter pack that may need to be expanded.
         // We have a function parameter pack that may need to be expanded.
         SmallVector<UnexpandedParameterPack, 2> Unexpanded;
         SmallVector<UnexpandedParameterPack, 2> Unexpanded;
@@ -4352,7 +4352,7 @@ bool TreeTransform<Derived>::
 
 
           OutParamTypes.push_back(NewType);
           OutParamTypes.push_back(NewType);
           if (PVars)
           if (PVars)
-            PVars->push_back(0);
+            PVars->push_back(nullptr);
         }
         }
 
 
         // We're done with the pack expansion.
         // We're done with the pack expansion.
@@ -4369,7 +4369,7 @@ bool TreeTransform<Derived>::
 
 
         OutParamTypes.push_back(NewType);
         OutParamTypes.push_back(NewType);
         if (PVars)
         if (PVars)
-          PVars->push_back(0);
+          PVars->push_back(nullptr);
       }
       }
 
 
       // We'll substitute the parameter now without expanding the pack
       // We'll substitute the parameter now without expanding the pack
@@ -4391,7 +4391,7 @@ bool TreeTransform<Derived>::
 
 
     OutParamTypes.push_back(NewType);
     OutParamTypes.push_back(NewType);
     if (PVars)
     if (PVars)
-      PVars->push_back(0);
+      PVars->push_back(nullptr);
   }
   }
 
 
 #ifndef NDEBUG
 #ifndef NDEBUG
@@ -4409,7 +4409,7 @@ template<typename Derived>
 QualType
 QualType
 TreeTransform<Derived>::TransformFunctionProtoType(TypeLocBuilder &TLB,
 TreeTransform<Derived>::TransformFunctionProtoType(TypeLocBuilder &TLB,
                                                    FunctionProtoTypeLoc TL) {
                                                    FunctionProtoTypeLoc TL) {
-  return getDerived().TransformFunctionProtoType(TLB, TL, 0, 0);
+  return getDerived().TransformFunctionProtoType(TLB, TL, nullptr, 0);
 }
 }
 
 
 template<typename Derived>
 template<typename Derived>
@@ -4617,8 +4617,8 @@ QualType TreeTransform<Derived>::TransformDecltypeType(TypeLocBuilder &TLB,
   const DecltypeType *T = TL.getTypePtr();
   const DecltypeType *T = TL.getTypePtr();
 
 
   // decltype expressions are not potentially evaluated contexts
   // decltype expressions are not potentially evaluated contexts
-  EnterExpressionEvaluationContext Unevaluated(SemaRef, Sema::Unevaluated, 0,
-                                               /*IsDecltype=*/ true);
+  EnterExpressionEvaluationContext Unevaluated(SemaRef, Sema::Unevaluated,
+                                               nullptr, /*IsDecltype=*/ true);
 
 
   ExprResult E = getDerived().TransformExpr(T->getUnderlyingExpr());
   ExprResult E = getDerived().TransformExpr(T->getUnderlyingExpr());
   if (E.isInvalid())
   if (E.isInvalid())
@@ -5444,7 +5444,7 @@ StmtResult
 TreeTransform<Derived>::TransformIfStmt(IfStmt *S) {
 TreeTransform<Derived>::TransformIfStmt(IfStmt *S) {
   // Transform the condition
   // Transform the condition
   ExprResult Cond;
   ExprResult Cond;
-  VarDecl *ConditionVar = 0;
+  VarDecl *ConditionVar = nullptr;
   if (S->getConditionVariable()) {
   if (S->getConditionVariable()) {
     ConditionVar
     ConditionVar
       = cast_or_null<VarDecl>(
       = cast_or_null<VarDecl>(
@@ -5461,7 +5461,7 @@ TreeTransform<Derived>::TransformIfStmt(IfStmt *S) {
 
 
     // Convert the condition to a boolean value.
     // Convert the condition to a boolean value.
     if (S->getCond()) {
     if (S->getCond()) {
-      ExprResult CondE = getSema().ActOnBooleanCondition(0, S->getIfLoc(),
+      ExprResult CondE = getSema().ActOnBooleanCondition(nullptr, S->getIfLoc(),
                                                          Cond.get());
                                                          Cond.get());
       if (CondE.isInvalid())
       if (CondE.isInvalid())
         return StmtError();
         return StmtError();
@@ -5501,7 +5501,7 @@ StmtResult
 TreeTransform<Derived>::TransformSwitchStmt(SwitchStmt *S) {
 TreeTransform<Derived>::TransformSwitchStmt(SwitchStmt *S) {
   // Transform the condition.
   // Transform the condition.
   ExprResult Cond;
   ExprResult Cond;
-  VarDecl *ConditionVar = 0;
+  VarDecl *ConditionVar = nullptr;
   if (S->getConditionVariable()) {
   if (S->getConditionVariable()) {
     ConditionVar
     ConditionVar
       = cast_or_null<VarDecl>(
       = cast_or_null<VarDecl>(
@@ -5539,7 +5539,7 @@ StmtResult
 TreeTransform<Derived>::TransformWhileStmt(WhileStmt *S) {
 TreeTransform<Derived>::TransformWhileStmt(WhileStmt *S) {
   // Transform the condition
   // Transform the condition
   ExprResult Cond;
   ExprResult Cond;
-  VarDecl *ConditionVar = 0;
+  VarDecl *ConditionVar = nullptr;
   if (S->getConditionVariable()) {
   if (S->getConditionVariable()) {
     ConditionVar
     ConditionVar
       = cast_or_null<VarDecl>(
       = cast_or_null<VarDecl>(
@@ -5556,7 +5556,8 @@ TreeTransform<Derived>::TransformWhileStmt(WhileStmt *S) {
 
 
     if (S->getCond()) {
     if (S->getCond()) {
       // Convert the condition to a boolean value.
       // Convert the condition to a boolean value.
-      ExprResult CondE = getSema().ActOnBooleanCondition(0, S->getWhileLoc(),
+      ExprResult CondE = getSema().ActOnBooleanCondition(nullptr,
+                                                         S->getWhileLoc(),
                                                          Cond.get());
                                                          Cond.get());
       if (CondE.isInvalid())
       if (CondE.isInvalid())
         return StmtError();
         return StmtError();
@@ -5616,7 +5617,7 @@ TreeTransform<Derived>::TransformForStmt(ForStmt *S) {
 
 
   // Transform the condition
   // Transform the condition
   ExprResult Cond;
   ExprResult Cond;
-  VarDecl *ConditionVar = 0;
+  VarDecl *ConditionVar = nullptr;
   if (S->getConditionVariable()) {
   if (S->getConditionVariable()) {
     ConditionVar
     ConditionVar
       = cast_or_null<VarDecl>(
       = cast_or_null<VarDecl>(
@@ -5633,7 +5634,8 @@ TreeTransform<Derived>::TransformForStmt(ForStmt *S) {
 
 
     if (S->getCond()) {
     if (S->getCond()) {
       // Convert the condition to a boolean value.
       // Convert the condition to a boolean value.
-      ExprResult CondE = getSema().ActOnBooleanCondition(0, S->getForLoc(),
+      ExprResult CondE = getSema().ActOnBooleanCondition(nullptr,
+                                                         S->getForLoc(),
                                                          Cond.get());
                                                          Cond.get());
       if (CondE.isInvalid())
       if (CondE.isInvalid())
         return StmtError();
         return StmtError();
@@ -5888,9 +5890,9 @@ template<typename Derived>
 StmtResult
 StmtResult
 TreeTransform<Derived>::TransformObjCAtCatchStmt(ObjCAtCatchStmt *S) {
 TreeTransform<Derived>::TransformObjCAtCatchStmt(ObjCAtCatchStmt *S) {
   // Transform the @catch parameter, if there is one.
   // Transform the @catch parameter, if there is one.
-  VarDecl *Var = 0;
+  VarDecl *Var = nullptr;
   if (VarDecl *FromVar = S->getCatchParamDecl()) {
   if (VarDecl *FromVar = S->getCatchParamDecl()) {
-    TypeSourceInfo *TSInfo = 0;
+    TypeSourceInfo *TSInfo = nullptr;
     if (FromVar->getTypeSourceInfo()) {
     if (FromVar->getTypeSourceInfo()) {
       TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
       TSInfo = getDerived().TransformType(FromVar->getTypeSourceInfo());
       if (!TSInfo)
       if (!TSInfo)
@@ -6041,7 +6043,7 @@ TreeTransform<Derived>::TransformObjCForCollectionStmt(
 template <typename Derived>
 template <typename Derived>
 StmtResult TreeTransform<Derived>::TransformCXXCatchStmt(CXXCatchStmt *S) {
 StmtResult TreeTransform<Derived>::TransformCXXCatchStmt(CXXCatchStmt *S) {
   // Transform the exception declaration, if any.
   // Transform the exception declaration, if any.
-  VarDecl *Var = 0;
+  VarDecl *Var = nullptr;
   if (VarDecl *ExceptionDecl = S->getExceptionDecl()) {
   if (VarDecl *ExceptionDecl = S->getExceptionDecl()) {
     TypeSourceInfo *T =
     TypeSourceInfo *T =
         getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
         getDerived().TransformType(ExceptionDecl->getTypeSourceInfo());
@@ -6194,7 +6196,7 @@ TreeTransform<Derived>::TransformMSDependentExistsStmt(
   CXXScopeSpec SS;
   CXXScopeSpec SS;
   SS.Adopt(QualifierLoc);
   SS.Adopt(QualifierLoc);
   bool Dependent = false;
   bool Dependent = false;
-  switch (getSema().CheckMicrosoftIfExistsSymbol(/*S=*/0, SS, NameInfo)) {
+  switch (getSema().CheckMicrosoftIfExistsSymbol(/*S=*/nullptr, SS, NameInfo)) {
   case Sema::IER_Exists:
   case Sema::IER_Exists:
     if (S->isIfExists())
     if (S->isIfExists())
       break;
       break;
@@ -6349,7 +6351,7 @@ template<typename Derived>
 StmtResult
 StmtResult
 TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *D) {
 TreeTransform<Derived>::TransformOMPParallelDirective(OMPParallelDirective *D) {
   DeclarationNameInfo DirName;
   DeclarationNameInfo DirName;
-  getDerived().getSema().StartOpenMPDSABlock(OMPD_parallel, DirName, 0);
+  getDerived().getSema().StartOpenMPDSABlock(OMPD_parallel, DirName, nullptr);
   StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
   StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
   getDerived().getSema().EndOpenMPDSABlock(Res.get());
   getDerived().getSema().EndOpenMPDSABlock(Res.get());
   return Res;
   return Res;
@@ -6359,7 +6361,7 @@ template<typename Derived>
 StmtResult
 StmtResult
 TreeTransform<Derived>::TransformOMPSimdDirective(OMPSimdDirective *D) {
 TreeTransform<Derived>::TransformOMPSimdDirective(OMPSimdDirective *D) {
   DeclarationNameInfo DirName;
   DeclarationNameInfo DirName;
-  getDerived().getSema().StartOpenMPDSABlock(OMPD_simd, DirName, 0);
+  getDerived().getSema().StartOpenMPDSABlock(OMPD_simd, DirName, nullptr);
   StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
   StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
   getDerived().getSema().EndOpenMPDSABlock(Res.get());
   getDerived().getSema().EndOpenMPDSABlock(Res.get());
   return Res;
   return Res;
@@ -6370,7 +6372,7 @@ OMPClause *
 TreeTransform<Derived>::TransformOMPIfClause(OMPIfClause *C) {
 TreeTransform<Derived>::TransformOMPIfClause(OMPIfClause *C) {
   ExprResult Cond = getDerived().TransformExpr(C->getCondition());
   ExprResult Cond = getDerived().TransformExpr(C->getCondition());
   if (Cond.isInvalid())
   if (Cond.isInvalid())
-    return 0;
+    return nullptr;
   return getDerived().RebuildOMPIfClause(Cond.take(), C->getLocStart(),
   return getDerived().RebuildOMPIfClause(Cond.take(), C->getLocStart(),
                                          C->getLParenLoc(), C->getLocEnd());
                                          C->getLParenLoc(), C->getLocEnd());
 }
 }
@@ -6380,7 +6382,7 @@ OMPClause *
 TreeTransform<Derived>::TransformOMPNumThreadsClause(OMPNumThreadsClause *C) {
 TreeTransform<Derived>::TransformOMPNumThreadsClause(OMPNumThreadsClause *C) {
   ExprResult NumThreads = getDerived().TransformExpr(C->getNumThreads());
   ExprResult NumThreads = getDerived().TransformExpr(C->getNumThreads());
   if (NumThreads.isInvalid())
   if (NumThreads.isInvalid())
-    return 0;
+    return nullptr;
   return getDerived().RebuildOMPNumThreadsClause(NumThreads.take(),
   return getDerived().RebuildOMPNumThreadsClause(NumThreads.take(),
                                                  C->getLocStart(),
                                                  C->getLocStart(),
                                                  C->getLParenLoc(),
                                                  C->getLParenLoc(),
@@ -6392,7 +6394,7 @@ OMPClause *
 TreeTransform<Derived>::TransformOMPSafelenClause(OMPSafelenClause *C) {
 TreeTransform<Derived>::TransformOMPSafelenClause(OMPSafelenClause *C) {
   ExprResult E = getDerived().TransformExpr(C->getSafelen());
   ExprResult E = getDerived().TransformExpr(C->getSafelen());
   if (E.isInvalid())
   if (E.isInvalid())
-    return 0;
+    return nullptr;
   return getDerived().RebuildOMPSafelenClause(
   return getDerived().RebuildOMPSafelenClause(
       E.take(), C->getLocStart(), C->getLParenLoc(), C->getLocEnd());
       E.take(), C->getLocStart(), C->getLParenLoc(), C->getLocEnd());
 }
 }
@@ -6425,7 +6427,7 @@ TreeTransform<Derived>::TransformOMPPrivateClause(OMPPrivateClause *C) {
   for (auto *VE : C->varlists()) {
   for (auto *VE : C->varlists()) {
     ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
     ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
     if (EVar.isInvalid())
     if (EVar.isInvalid())
-      return 0;
+      return nullptr;
     Vars.push_back(EVar.take());
     Vars.push_back(EVar.take());
   }
   }
   return getDerived().RebuildOMPPrivateClause(Vars,
   return getDerived().RebuildOMPPrivateClause(Vars,
@@ -6443,7 +6445,7 @@ TreeTransform<Derived>::TransformOMPFirstprivateClause(
   for (auto *VE : C->varlists()) {
   for (auto *VE : C->varlists()) {
     ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
     ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
     if (EVar.isInvalid())
     if (EVar.isInvalid())
-      return 0;
+      return nullptr;
     Vars.push_back(EVar.take());
     Vars.push_back(EVar.take());
   }
   }
   return getDerived().RebuildOMPFirstprivateClause(Vars,
   return getDerived().RebuildOMPFirstprivateClause(Vars,
@@ -6460,7 +6462,7 @@ TreeTransform<Derived>::TransformOMPSharedClause(OMPSharedClause *C) {
   for (auto *VE : C->varlists()) {
   for (auto *VE : C->varlists()) {
     ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
     ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
     if (EVar.isInvalid())
     if (EVar.isInvalid())
-      return 0;
+      return nullptr;
     Vars.push_back(EVar.take());
     Vars.push_back(EVar.take());
   }
   }
   return getDerived().RebuildOMPSharedClause(Vars,
   return getDerived().RebuildOMPSharedClause(Vars,
@@ -6477,12 +6479,12 @@ TreeTransform<Derived>::TransformOMPLinearClause(OMPLinearClause *C) {
   for (auto *VE : C->varlists()) {
   for (auto *VE : C->varlists()) {
     ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
     ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
     if (EVar.isInvalid())
     if (EVar.isInvalid())
-      return 0;
+      return nullptr;
     Vars.push_back(EVar.take());
     Vars.push_back(EVar.take());
   }
   }
   ExprResult Step = getDerived().TransformExpr(C->getStep());
   ExprResult Step = getDerived().TransformExpr(C->getStep());
   if (Step.isInvalid())
   if (Step.isInvalid())
-    return 0;
+    return nullptr;
   return getDerived().RebuildOMPLinearClause(
   return getDerived().RebuildOMPLinearClause(
       Vars, Step.take(), C->getLocStart(), C->getLParenLoc(), C->getColonLoc(),
       Vars, Step.take(), C->getLocStart(), C->getLParenLoc(), C->getColonLoc(),
       C->getLocEnd());
       C->getLocEnd());
@@ -6496,7 +6498,7 @@ TreeTransform<Derived>::TransformOMPCopyinClause(OMPCopyinClause *C) {
   for (auto *VE : C->varlists()) {
   for (auto *VE : C->varlists()) {
     ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
     ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
     if (EVar.isInvalid())
     if (EVar.isInvalid())
-      return 0;
+      return nullptr;
     Vars.push_back(EVar.take());
     Vars.push_back(EVar.take());
   }
   }
   return getDerived().RebuildOMPCopyinClause(Vars,
   return getDerived().RebuildOMPCopyinClause(Vars,
@@ -6551,7 +6553,7 @@ TreeTransform<Derived>::TransformDeclRefExpr(DeclRefExpr *E) {
     return SemaRef.Owned(E);
     return SemaRef.Owned(E);
   }
   }
 
 
-  TemplateArgumentListInfo TransArgs, *TemplateArgs = 0;
+  TemplateArgumentListInfo TransArgs, *TemplateArgs = nullptr;
   if (E->hasExplicitTemplateArgs()) {
   if (E->hasExplicitTemplateArgs()) {
     TemplateArgs = &TransArgs;
     TemplateArgs = &TransArgs;
     TransArgs.setLAngleLoc(E->getLAngleLoc());
     TransArgs.setLAngleLoc(E->getLAngleLoc());
@@ -6622,7 +6624,7 @@ TreeTransform<Derived>::TransformGenericSelectionExpr(GenericSelectionExpr *E) {
         return ExprError();
         return ExprError();
       AssocTypes.push_back(AssocType);
       AssocTypes.push_back(AssocType);
     } else {
     } else {
-      AssocTypes.push_back(0);
+      AssocTypes.push_back(nullptr);
     }
     }
 
 
     ExprResult AssocExpr = getDerived().TransformExpr(E->getAssocExpr(i));
     ExprResult AssocExpr = getDerived().TransformExpr(E->getAssocExpr(i));
@@ -6934,7 +6936,7 @@ TreeTransform<Derived>::TransformMemberExpr(MemberExpr *E) {
   // first-qualifier-in-scope here, just in case we had a dependent
   // first-qualifier-in-scope here, just in case we had a dependent
   // base (and therefore couldn't do the check) and a
   // base (and therefore couldn't do the check) and a
   // nested-name-qualifier (and therefore could do the lookup).
   // nested-name-qualifier (and therefore could do the lookup).
-  NamedDecl *FirstQualifierInScope = 0;
+  NamedDecl *FirstQualifierInScope = nullptr;
 
 
   return getDerived().RebuildMemberExpr(Base.get(), FakeOperatorLoc,
   return getDerived().RebuildMemberExpr(Base.get(), FakeOperatorLoc,
                                         E->isArrow(),
                                         E->isArrow(),
@@ -6944,7 +6946,7 @@ TreeTransform<Derived>::TransformMemberExpr(MemberExpr *E) {
                                         Member,
                                         Member,
                                         FoundDecl,
                                         FoundDecl,
                                         (E->hasExplicitTemplateArgs()
                                         (E->hasExplicitTemplateArgs()
-                                           ? &TransArgs : 0),
+                                           ? &TransArgs : nullptr),
                                         FirstQualifierInScope);
                                         FirstQualifierInScope);
 }
 }
 
 
@@ -6999,7 +7001,7 @@ TransformBinaryConditionalOperator(BinaryConditionalOperator *e) {
 
 
   return getDerived().RebuildConditionalOperator(commonExpr.take(),
   return getDerived().RebuildConditionalOperator(commonExpr.take(),
                                                  e->getQuestionLoc(),
                                                  e->getQuestionLoc(),
-                                                 0,
+                                                 nullptr,
                                                  e->getColonLoc(),
                                                  e->getColonLoc(),
                                                  rhs.get());
                                                  rhs.get());
 }
 }
@@ -7714,7 +7716,7 @@ TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) {
     return ExprError();
     return ExprError();
 
 
   // Transform new operator and delete operator.
   // Transform new operator and delete operator.
-  FunctionDecl *OperatorNew = 0;
+  FunctionDecl *OperatorNew = nullptr;
   if (E->getOperatorNew()) {
   if (E->getOperatorNew()) {
     OperatorNew = cast_or_null<FunctionDecl>(
     OperatorNew = cast_or_null<FunctionDecl>(
                                  getDerived().TransformDecl(E->getLocStart(),
                                  getDerived().TransformDecl(E->getLocStart(),
@@ -7723,7 +7725,7 @@ TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) {
       return ExprError();
       return ExprError();
   }
   }
 
 
-  FunctionDecl *OperatorDelete = 0;
+  FunctionDecl *OperatorDelete = nullptr;
   if (E->getOperatorDelete()) {
   if (E->getOperatorDelete()) {
     OperatorDelete = cast_or_null<FunctionDecl>(
     OperatorDelete = cast_or_null<FunctionDecl>(
                                    getDerived().TransformDecl(E->getLocStart(),
                                    getDerived().TransformDecl(E->getLocStart(),
@@ -7808,7 +7810,7 @@ TreeTransform<Derived>::TransformCXXDeleteExpr(CXXDeleteExpr *E) {
     return ExprError();
     return ExprError();
 
 
   // Transform the delete operator, if known.
   // Transform the delete operator, if known.
-  FunctionDecl *OperatorDelete = 0;
+  FunctionDecl *OperatorDelete = nullptr;
   if (E->getOperatorDelete()) {
   if (E->getOperatorDelete()) {
     OperatorDelete = cast_or_null<FunctionDecl>(
     OperatorDelete = cast_or_null<FunctionDecl>(
                                    getDerived().TransformDecl(E->getLocStart(),
                                    getDerived().TransformDecl(E->getLocStart(),
@@ -7854,7 +7856,7 @@ TreeTransform<Derived>::TransformCXXPseudoDestructorExpr(
 
 
   ParsedType ObjectTypePtr;
   ParsedType ObjectTypePtr;
   bool MayBePseudoDestructor = false;
   bool MayBePseudoDestructor = false;
-  Base = SemaRef.ActOnStartCXXMemberReference(0, Base.get(),
+  Base = SemaRef.ActOnStartCXXMemberReference(nullptr, Base.get(),
                                               E->getOperatorLoc(),
                                               E->getOperatorLoc(),
                                         E->isArrow()? tok::arrow : tok::period,
                                         E->isArrow()? tok::arrow : tok::period,
                                               ObjectTypePtr,
                                               ObjectTypePtr,
@@ -7877,7 +7879,7 @@ TreeTransform<Derived>::TransformCXXPseudoDestructorExpr(
   if (E->getDestroyedTypeInfo()) {
   if (E->getDestroyedTypeInfo()) {
     TypeSourceInfo *DestroyedTypeInfo
     TypeSourceInfo *DestroyedTypeInfo
       = getDerived().TransformTypeInObjectScope(E->getDestroyedTypeInfo(),
       = getDerived().TransformTypeInObjectScope(E->getDestroyedTypeInfo(),
-                                                ObjectType, 0, SS);
+                                                ObjectType, nullptr, SS);
     if (!DestroyedTypeInfo)
     if (!DestroyedTypeInfo)
       return ExprError();
       return ExprError();
     Destroyed = DestroyedTypeInfo;
     Destroyed = DestroyedTypeInfo;
@@ -7891,7 +7893,7 @@ TreeTransform<Derived>::TransformCXXPseudoDestructorExpr(
     ParsedType T = SemaRef.getDestructorName(E->getTildeLoc(),
     ParsedType T = SemaRef.getDestructorName(E->getTildeLoc(),
                                               *E->getDestroyedTypeIdentifier(),
                                               *E->getDestroyedTypeIdentifier(),
                                                 E->getDestroyedTypeLoc(),
                                                 E->getDestroyedTypeLoc(),
-                                                /*Scope=*/0,
+                                                /*Scope=*/nullptr,
                                                 SS, ObjectTypePtr,
                                                 SS, ObjectTypePtr,
                                                 false);
                                                 false);
     if (!T)
     if (!T)
@@ -7902,11 +7904,11 @@ TreeTransform<Derived>::TransformCXXPseudoDestructorExpr(
                                                  E->getDestroyedTypeLoc());
                                                  E->getDestroyedTypeLoc());
   }
   }
 
 
-  TypeSourceInfo *ScopeTypeInfo = 0;
+  TypeSourceInfo *ScopeTypeInfo = nullptr;
   if (E->getScopeTypeInfo()) {
   if (E->getScopeTypeInfo()) {
     CXXScopeSpec EmptySS;
     CXXScopeSpec EmptySS;
     ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
     ScopeTypeInfo = getDerived().TransformTypeInObjectScope(
-                      E->getScopeTypeInfo(), ObjectType, 0, EmptySS);
+                      E->getScopeTypeInfo(), ObjectType, nullptr, EmptySS);
     if (!ScopeTypeInfo)
     if (!ScopeTypeInfo)
       return ExprError();
       return ExprError();
   }
   }
@@ -8225,10 +8227,10 @@ TreeTransform<Derived>::TransformDependentScopeDeclRefExpr(
       return SemaRef.Owned(E);
       return SemaRef.Owned(E);
 
 
     return getDerived().RebuildDependentScopeDeclRefExpr(QualifierLoc,
     return getDerived().RebuildDependentScopeDeclRefExpr(QualifierLoc,
-                                                         TemplateKWLoc,
-                                                         NameInfo,
-                                                         /*TemplateArgs*/ 0,
-                                                         IsAddressOfOperand);
+                                                        TemplateKWLoc,
+                                                        NameInfo,
+                                                        /*TemplateArgs*/nullptr,
+                                                        IsAddressOfOperand);
   }
   }
 
 
   TemplateArgumentListInfo TransArgs(E->getLAngleLoc(), E->getRAngleLoc());
   TemplateArgumentListInfo TransArgs(E->getLAngleLoc(), E->getRAngleLoc());
@@ -8403,8 +8405,8 @@ TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) {
   TypeSourceInfo *OldCallOpTSI = E->getCallOperator()->getTypeSourceInfo();
   TypeSourceInfo *OldCallOpTSI = E->getCallOperator()->getTypeSourceInfo();
   FunctionProtoTypeLoc OldCallOpFPTL = 
   FunctionProtoTypeLoc OldCallOpFPTL = 
       OldCallOpTSI->getTypeLoc().getAs<FunctionProtoTypeLoc>();
       OldCallOpTSI->getTypeLoc().getAs<FunctionProtoTypeLoc>();
-  TypeSourceInfo *NewCallOpTSI = 0;
-  
+  TypeSourceInfo *NewCallOpTSI = nullptr;
+
   const bool CallOpWasAlreadyTransformed = 
   const bool CallOpWasAlreadyTransformed = 
       getDerived().AlreadyTransformed(OldCallOpTSI->getType()); 
       getDerived().AlreadyTransformed(OldCallOpTSI->getType()); 
   
   
@@ -8420,7 +8422,7 @@ TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) {
     TypeLocBuilder NewCallOpTLBuilder;
     TypeLocBuilder NewCallOpTLBuilder;
     QualType NewCallOpType = TransformFunctionProtoType(NewCallOpTLBuilder, 
     QualType NewCallOpType = TransformFunctionProtoType(NewCallOpTLBuilder, 
                                                         OldCallOpFPTL, 
                                                         OldCallOpFPTL, 
-                                                        0, 0);
+                                                        nullptr, 0);
     NewCallOpTSI = NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context,
     NewCallOpTSI = NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context,
                                                         NewCallOpType);
                                                         NewCallOpType);
   }
   }
@@ -8618,7 +8620,7 @@ TreeTransform<Derived>::TransformLambdaScope(LambdaExpr *E,
   getSema().PushExpressionEvaluationContext(Sema::PotentiallyEvaluated);
   getSema().PushExpressionEvaluationContext(Sema::PotentiallyEvaluated);
 
 
   if (Invalid) {
   if (Invalid) {
-    getSema().ActOnLambdaError(E->getLocStart(), /*CurScope=*/0,
+    getSema().ActOnLambdaError(E->getLocStart(), /*CurScope=*/nullptr,
                                /*IsInstantiation=*/true);
                                /*IsInstantiation=*/true);
     return ExprError();
     return ExprError();
   }
   }
@@ -8626,13 +8628,14 @@ TreeTransform<Derived>::TransformLambdaScope(LambdaExpr *E,
   // Instantiate the body of the lambda expression.
   // Instantiate the body of the lambda expression.
   StmtResult Body = getDerived().TransformStmt(E->getBody());
   StmtResult Body = getDerived().TransformStmt(E->getBody());
   if (Body.isInvalid()) {
   if (Body.isInvalid()) {
-    getSema().ActOnLambdaError(E->getLocStart(), /*CurScope=*/0,
+    getSema().ActOnLambdaError(E->getLocStart(), /*CurScope=*/nullptr,
                                /*IsInstantiation=*/true);
                                /*IsInstantiation=*/true);
     return ExprError();
     return ExprError();
   }
   }
 
 
   return getSema().ActOnLambdaExpr(E->getLocStart(), Body.take(),
   return getSema().ActOnLambdaExpr(E->getLocStart(), Body.take(),
-                                   /*CurScope=*/0, /*IsInstantiation=*/true);
+                                   /*CurScope=*/nullptr,
+                                   /*IsInstantiation=*/true);
 }
 }
 
 
 template<typename Derived>
 template<typename Derived>
@@ -8667,7 +8670,7 @@ ExprResult
 TreeTransform<Derived>::TransformCXXDependentScopeMemberExpr(
 TreeTransform<Derived>::TransformCXXDependentScopeMemberExpr(
                                              CXXDependentScopeMemberExpr *E) {
                                              CXXDependentScopeMemberExpr *E) {
   // Transform the base of the expression.
   // Transform the base of the expression.
-  ExprResult Base((Expr*) 0);
+  ExprResult Base((Expr*) nullptr);
   Expr *OldBase;
   Expr *OldBase;
   QualType BaseType;
   QualType BaseType;
   QualType ObjectType;
   QualType ObjectType;
@@ -8680,7 +8683,7 @@ TreeTransform<Derived>::TransformCXXDependentScopeMemberExpr(
     // Start the member reference and compute the object's type.
     // Start the member reference and compute the object's type.
     ParsedType ObjectTy;
     ParsedType ObjectTy;
     bool MayBePseudoDestructor = false;
     bool MayBePseudoDestructor = false;
-    Base = SemaRef.ActOnStartCXXMemberReference(0, Base.get(),
+    Base = SemaRef.ActOnStartCXXMemberReference(nullptr, Base.get(),
                                                 E->getOperatorLoc(),
                                                 E->getOperatorLoc(),
                                       E->isArrow()? tok::arrow : tok::period,
                                       E->isArrow()? tok::arrow : tok::period,
                                                 ObjectTy,
                                                 ObjectTy,
@@ -8691,7 +8694,7 @@ TreeTransform<Derived>::TransformCXXDependentScopeMemberExpr(
     ObjectType = ObjectTy.get();
     ObjectType = ObjectTy.get();
     BaseType = ((Expr*) Base.get())->getType();
     BaseType = ((Expr*) Base.get())->getType();
   } else {
   } else {
-    OldBase = 0;
+    OldBase = nullptr;
     BaseType = getDerived().TransformType(E->getBaseType());
     BaseType = getDerived().TransformType(E->getBaseType());
     ObjectType = BaseType->getAs<PointerType>()->getPointeeType();
     ObjectType = BaseType->getAs<PointerType>()->getPointeeType();
   }
   }
@@ -8743,7 +8746,7 @@ TreeTransform<Derived>::TransformCXXDependentScopeMemberExpr(
                                                        TemplateKWLoc,
                                                        TemplateKWLoc,
                                                        FirstQualifierInScope,
                                                        FirstQualifierInScope,
                                                        NameInfo,
                                                        NameInfo,
-                                                       /*TemplateArgs*/ 0);
+                                                       /*TemplateArgs*/nullptr);
   }
   }
 
 
   TemplateArgumentListInfo TransArgs(E->getLAngleLoc(), E->getRAngleLoc());
   TemplateArgumentListInfo TransArgs(E->getLAngleLoc(), E->getRAngleLoc());
@@ -8767,7 +8770,7 @@ template<typename Derived>
 ExprResult
 ExprResult
 TreeTransform<Derived>::TransformUnresolvedMemberExpr(UnresolvedMemberExpr *Old) {
 TreeTransform<Derived>::TransformUnresolvedMemberExpr(UnresolvedMemberExpr *Old) {
   // Transform the base of the expression.
   // Transform the base of the expression.
-  ExprResult Base((Expr*) 0);
+  ExprResult Base((Expr*) nullptr);
   QualType BaseType;
   QualType BaseType;
   if (!Old->isImplicitAccess()) {
   if (!Old->isImplicitAccess()) {
     Base = getDerived().TransformExpr(Old->getBase());
     Base = getDerived().TransformExpr(Old->getBase());
@@ -8851,7 +8854,7 @@ TreeTransform<Derived>::TransformUnresolvedMemberExpr(UnresolvedMemberExpr *Old)
   // first-qualifier-in-scope here, just in case we had a dependent
   // first-qualifier-in-scope here, just in case we had a dependent
   // base (and therefore couldn't do the check) and a
   // base (and therefore couldn't do the check) and a
   // nested-name-qualifier (and therefore could do the lookup).
   // nested-name-qualifier (and therefore could do the lookup).
-  NamedDecl *FirstQualifierInScope = 0;
+  NamedDecl *FirstQualifierInScope = nullptr;
 
 
   return getDerived().RebuildUnresolvedMemberExpr(Base.get(),
   return getDerived().RebuildUnresolvedMemberExpr(Base.get(),
                                                   BaseType,
                                                   BaseType,
@@ -8862,7 +8865,7 @@ TreeTransform<Derived>::TransformUnresolvedMemberExpr(UnresolvedMemberExpr *Old)
                                                   FirstQualifierInScope,
                                                   FirstQualifierInScope,
                                                   R,
                                                   R,
                                               (Old->hasExplicitTemplateArgs()
                                               (Old->hasExplicitTemplateArgs()
-                                                  ? &TransArgs : 0));
+                                                  ? &TransArgs : nullptr));
 }
 }
 
 
 template<typename Derived>
 template<typename Derived>
@@ -9396,7 +9399,7 @@ ExprResult
 TreeTransform<Derived>::TransformBlockExpr(BlockExpr *E) {
 TreeTransform<Derived>::TransformBlockExpr(BlockExpr *E) {
   BlockDecl *oldBlock = E->getBlockDecl();
   BlockDecl *oldBlock = E->getBlockDecl();
 
 
-  SemaRef.ActOnBlockStart(E->getCaretLocation(), /*Scope=*/0);
+  SemaRef.ActOnBlockStart(E->getCaretLocation(), /*Scope=*/nullptr);
   BlockScopeInfo *blockScope = SemaRef.getCurBlock();
   BlockScopeInfo *blockScope = SemaRef.getCurBlock();
 
 
   blockScope->TheDecl->setIsVariadic(oldBlock->isVariadic());
   blockScope->TheDecl->setIsVariadic(oldBlock->isVariadic());
@@ -9410,8 +9413,8 @@ TreeTransform<Derived>::TransformBlockExpr(BlockExpr *E) {
   if (getDerived().TransformFunctionTypeParams(E->getCaretLocation(),
   if (getDerived().TransformFunctionTypeParams(E->getCaretLocation(),
                                                oldBlock->param_begin(),
                                                oldBlock->param_begin(),
                                                oldBlock->param_size(),
                                                oldBlock->param_size(),
-                                               0, paramTypes, &params)) {
-    getSema().ActOnBlockError(E->getCaretLocation(), /*Scope=*/0);
+                                               nullptr, paramTypes, &params)) {
+    getSema().ActOnBlockError(E->getCaretLocation(), /*Scope=*/nullptr);
     return ExprError();
     return ExprError();
   }
   }
 
 
@@ -9436,7 +9439,7 @@ TreeTransform<Derived>::TransformBlockExpr(BlockExpr *E) {
   // Transform the body
   // Transform the body
   StmtResult body = getDerived().TransformStmt(E->getBody());
   StmtResult body = getDerived().TransformStmt(E->getBody());
   if (body.isInvalid()) {
   if (body.isInvalid()) {
-    getSema().ActOnBlockError(E->getCaretLocation(), /*Scope=*/0);
+    getSema().ActOnBlockError(E->getCaretLocation(), /*Scope=*/nullptr);
     return ExprError();
     return ExprError();
   }
   }
 
 
@@ -9462,7 +9465,7 @@ TreeTransform<Derived>::TransformBlockExpr(BlockExpr *E) {
 #endif
 #endif
 
 
   return SemaRef.ActOnBlockStmtExpr(E->getCaretLocation(), body.get(),
   return SemaRef.ActOnBlockStmtExpr(E->getCaretLocation(), body.get(),
-                                    /*Scope=*/0);
+                                    /*Scope=*/nullptr);
 }
 }
 
 
 template<typename Derived>
 template<typename Derived>
@@ -9569,7 +9572,7 @@ TreeTransform<Derived>::RebuildConstantArrayType(QualType ElementType,
                                                  const llvm::APInt &Size,
                                                  const llvm::APInt &Size,
                                                  unsigned IndexTypeQuals,
                                                  unsigned IndexTypeQuals,
                                                  SourceRange BracketsRange) {
                                                  SourceRange BracketsRange) {
-  return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, 0,
+  return getDerived().RebuildArrayType(ElementType, SizeMod, &Size, nullptr,
                                         IndexTypeQuals, BracketsRange);
                                         IndexTypeQuals, BracketsRange);
 }
 }
 
 
@@ -9579,7 +9582,7 @@ TreeTransform<Derived>::RebuildIncompleteArrayType(QualType ElementType,
                                           ArrayType::ArraySizeModifier SizeMod,
                                           ArrayType::ArraySizeModifier SizeMod,
                                                  unsigned IndexTypeQuals,
                                                  unsigned IndexTypeQuals,
                                                    SourceRange BracketsRange) {
                                                    SourceRange BracketsRange) {
-  return getDerived().RebuildArrayType(ElementType, SizeMod, 0, 0,
+  return getDerived().RebuildArrayType(ElementType, SizeMod, nullptr, nullptr,
                                        IndexTypeQuals, BracketsRange);
                                        IndexTypeQuals, BracketsRange);
 }
 }
 
 
@@ -9590,7 +9593,7 @@ TreeTransform<Derived>::RebuildVariableArrayType(QualType ElementType,
                                                  Expr *SizeExpr,
                                                  Expr *SizeExpr,
                                                  unsigned IndexTypeQuals,
                                                  unsigned IndexTypeQuals,
                                                  SourceRange BracketsRange) {
                                                  SourceRange BracketsRange) {
-  return getDerived().RebuildArrayType(ElementType, SizeMod, 0,
+  return getDerived().RebuildArrayType(ElementType, SizeMod, nullptr,
                                        SizeExpr,
                                        SizeExpr,
                                        IndexTypeQuals, BracketsRange);
                                        IndexTypeQuals, BracketsRange);
 }
 }
@@ -9602,7 +9605,7 @@ TreeTransform<Derived>::RebuildDependentSizedArrayType(QualType ElementType,
                                                        Expr *SizeExpr,
                                                        Expr *SizeExpr,
                                                        unsigned IndexTypeQuals,
                                                        unsigned IndexTypeQuals,
                                                    SourceRange BracketsRange) {
                                                    SourceRange BracketsRange) {
-  return getDerived().RebuildArrayType(ElementType, SizeMod, 0,
+  return getDerived().RebuildArrayType(ElementType, SizeMod, nullptr,
                                        SizeExpr,
                                        SizeExpr,
                                        IndexTypeQuals, BracketsRange);
                                        IndexTypeQuals, BracketsRange);
 }
 }
@@ -9734,7 +9737,7 @@ TreeTransform<Derived>::RebuildTemplateName(CXXScopeSpec &SS,
   TemplateName.setIdentifier(&Name, NameLoc);
   TemplateName.setIdentifier(&Name, NameLoc);
   Sema::TemplateTy Template;
   Sema::TemplateTy Template;
   SourceLocation TemplateKWLoc; // FIXME: retrieve it from caller.
   SourceLocation TemplateKWLoc; // FIXME: retrieve it from caller.
-  getSema().ActOnDependentTemplateName(/*Scope=*/0,
+  getSema().ActOnDependentTemplateName(/*Scope=*/nullptr,
                                        SS, TemplateKWLoc, TemplateName,
                                        SS, TemplateKWLoc, TemplateName,
                                        ParsedType::make(ObjectType),
                                        ParsedType::make(ObjectType),
                                        /*EnteringContext=*/false,
                                        /*EnteringContext=*/false,
@@ -9754,7 +9757,7 @@ TreeTransform<Derived>::RebuildTemplateName(CXXScopeSpec &SS,
   Name.setOperatorFunctionId(NameLoc, Operator, SymbolLocations);
   Name.setOperatorFunctionId(NameLoc, Operator, SymbolLocations);
   SourceLocation TemplateKWLoc; // FIXME: retrieve it from caller.
   SourceLocation TemplateKWLoc; // FIXME: retrieve it from caller.
   Sema::TemplateTy Template;
   Sema::TemplateTy Template;
-  getSema().ActOnDependentTemplateName(/*Scope=*/0,
+  getSema().ActOnDependentTemplateName(/*Scope=*/nullptr,
                                        SS, TemplateKWLoc, Name,
                                        SS, TemplateKWLoc, Name,
                                        ParsedType::make(ObjectType),
                                        ParsedType::make(ObjectType),
                                        /*EnteringContext=*/false,
                                        /*EnteringContext=*/false,
@@ -9781,8 +9784,8 @@ TreeTransform<Derived>::RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op,
                                                        Second, OpLoc);
                                                        Second, OpLoc);
   } else if (Op == OO_Arrow) {
   } else if (Op == OO_Arrow) {
     // -> is never a builtin operation.
     // -> is never a builtin operation.
-    return SemaRef.BuildOverloadedArrowExpr(0, First, OpLoc);
-  } else if (Second == 0 || isPostIncDec) {
+    return SemaRef.BuildOverloadedArrowExpr(nullptr, First, OpLoc);
+  } else if (Second == nullptr || isPostIncDec) {
     if (!First->getType()->isOverloadableType()) {
     if (!First->getType()->isOverloadableType()) {
       // The argument is not of overloadable type, so try to create a
       // The argument is not of overloadable type, so try to create a
       // built-in unary operation.
       // built-in unary operation.
@@ -9824,7 +9827,7 @@ TreeTransform<Derived>::RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op,
 
 
   // Add any functions found via argument-dependent lookup.
   // Add any functions found via argument-dependent lookup.
   Expr *Args[2] = { First, Second };
   Expr *Args[2] = { First, Second };
-  unsigned NumArgs = 1 + (Second != 0);
+  unsigned NumArgs = 1 + (Second != nullptr);
 
 
   // Create the overloaded operator invocation for unary operators.
   // Create the overloaded operator invocation for unary operators.
   if (NumArgs == 1 || isPostIncDec) {
   if (NumArgs == 1 || isPostIncDec) {
@@ -9902,9 +9905,9 @@ TreeTransform<Derived>::RebuildCXXPseudoDestructorExpr(Expr *Base,
   return getSema().BuildMemberReferenceExpr(Base, BaseType,
   return getSema().BuildMemberReferenceExpr(Base, BaseType,
                                             OperatorLoc, isArrow,
                                             OperatorLoc, isArrow,
                                             SS, TemplateKWLoc,
                                             SS, TemplateKWLoc,
-                                            /*FIXME: FirstQualifier*/ 0,
+                                            /*FIXME: FirstQualifier*/ nullptr,
                                             NameInfo,
                                             NameInfo,
-                                            /*TemplateArgs*/ 0);
+                                            /*TemplateArgs*/ nullptr);
 }
 }
 
 
 template<typename Derived>
 template<typename Derived>
@@ -9925,7 +9928,7 @@ TreeTransform<Derived>::TransformCapturedStmt(CapturedStmt *S) {
       Params.push_back(std::make_pair(StringRef(), QualType()));
       Params.push_back(std::make_pair(StringRef(), QualType()));
     }
     }
   }
   }
-  getSema().ActOnCapturedRegionStart(Loc, /*CurScope*/0,
+  getSema().ActOnCapturedRegionStart(Loc, /*CurScope*/nullptr,
                                      S->getCapturedRegionKind(), Params);
                                      S->getCapturedRegionKind(), Params);
   StmtResult Body = getDerived().TransformStmt(S->getCapturedStmt());
   StmtResult Body = getDerived().TransformStmt(S->getCapturedStmt());
 
 

+ 1 - 1
lib/Sema/TypeLocBuilder.cpp

@@ -62,7 +62,7 @@ void TypeLocBuilder::grow(size_t NewCapacity) {
 
 
 TypeLoc TypeLocBuilder::pushImpl(QualType T, size_t LocalSize, unsigned LocalAlignment) {
 TypeLoc TypeLocBuilder::pushImpl(QualType T, size_t LocalSize, unsigned LocalAlignment) {
 #ifndef NDEBUG
 #ifndef NDEBUG
-  QualType TLast = TypeLoc(T, 0).getNextTypeLoc().getType();
+  QualType TLast = TypeLoc(T, nullptr).getNextTypeLoc().getType();
   assert(TLast == LastTy &&
   assert(TLast == LastTy &&
          "mismatch between last type and new type's inner type");
          "mismatch between last type and new type's inner type");
   LastTy = T;
   LastTy = T;

+ 1 - 1
lib/Sema/TypeLocBuilder.h

@@ -94,7 +94,7 @@ class TypeLocBuilder {
   /// Pushes space for a new TypeLoc of the given type.  Invalidates
   /// Pushes space for a new TypeLoc of the given type.  Invalidates
   /// any TypeLocs previously retrieved from this builder.
   /// any TypeLocs previously retrieved from this builder.
   template <class TyLocType> TyLocType push(QualType T) {
   template <class TyLocType> TyLocType push(QualType T) {
-    TyLocType Loc = TypeLoc(T, 0).castAs<TyLocType>();
+    TyLocType Loc = TypeLoc(T, nullptr).castAs<TyLocType>();
     size_t LocalSize = Loc.getLocalDataSize();
     size_t LocalSize = Loc.getLocalDataSize();
     unsigned LocalAlign = Loc.getLocalDataAlignment();
     unsigned LocalAlign = Loc.getLocalDataAlignment();
     return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();
     return pushImpl(T, LocalSize, LocalAlign).castAs<TyLocType>();

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.