diff options
Diffstat (limited to 'clang/lib/Serialization/ASTReaderDecl.cpp')
-rw-r--r-- | clang/lib/Serialization/ASTReaderDecl.cpp | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index bb87632962e..696a78295cb 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -163,8 +163,8 @@ namespace clang { public: FindExistingResult(ASTReader &Reader) - : Reader(Reader), New(0), Existing(0), AddResult(false) { } - + : Reader(Reader), New(nullptr), Existing(nullptr), AddResult(false) {} + FindExistingResult(ASTReader &Reader, NamedDecl *New, NamedDecl *Existing) : Reader(Reader), New(New), Existing(Existing), AddResult(true) { } @@ -648,7 +648,8 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) { FunctionTemplateSpecializationInfo *FTInfo = FunctionTemplateSpecializationInfo::Create(C, FD, Template, TSK, TemplArgList, - HasTemplateArgumentsAsWritten ? &TemplArgsInfo : 0, + HasTemplateArgumentsAsWritten ? &TemplArgsInfo + : nullptr, POI); FD->TemplateOrSpecialization = FTInfo; @@ -665,7 +666,7 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) { llvm::FoldingSetNodeID ID; FunctionTemplateSpecializationInfo::Profile(ID, TemplArgs.data(), TemplArgs.size(), C); - void *InsertPos = 0; + void *InsertPos = nullptr; FunctionTemplateDecl::Common *CommonPtr = CanonTemplate->getCommonPtr(); CommonPtr->Specializations.FindNodeOrInsertPos(ID, InsertPos); if (InsertPos) @@ -808,8 +809,8 @@ void ASTDeclReader::VisitObjCInterfaceDecl(ObjCInterfaceDecl *ID) { Reader.getContext()); // We will rebuild this list lazily. - ID->setIvarList(0); - + ID->setIvarList(nullptr); + // Note that we have deserialized a definition. Reader.PendingDefinitions.insert(ID); @@ -824,7 +825,7 @@ void ASTDeclReader::VisitObjCIvarDecl(ObjCIvarDecl *IVD) { VisitFieldDecl(IVD); IVD->setAccessControl((ObjCIvarDecl::AccessControl)Record[Idx++]); // This field will be built lazily. - IVD->setNextIvar(0); + IVD->setNextIvar(nullptr); bool synth = Record[Idx++]; IVD->setSynthesize(synth); } @@ -1093,7 +1094,7 @@ void ASTDeclReader::VisitBlockDecl(BlockDecl *BD) { unsigned flags = Record[Idx++]; bool byRef = (flags & 1); bool nested = (flags & 2); - Expr *copyExpr = ((flags & 4) ? Reader.ReadExpr(F) : 0); + Expr *copyExpr = ((flags & 4) ? Reader.ReadExpr(F) : nullptr); captures.push_back(BlockDecl::Capture(decl, byRef, nested, copyExpr)); } @@ -1278,7 +1279,7 @@ void ASTDeclReader::ReadCXXDefinitionData( LambdaCaptureKind Kind = static_cast<LambdaCaptureKind>(Record[Idx++]); switch (Kind) { case LCK_This: - *ToCapture++ = Capture(Loc, IsImplicit, Kind, 0, SourceLocation()); + *ToCapture++ = Capture(Loc, IsImplicit, Kind, nullptr,SourceLocation()); break; case LCK_ByCopy: case LCK_ByRef: @@ -1386,7 +1387,7 @@ void ASTDeclReader::ReadCXXRecordDefinition(CXXRecordDecl *D) { // allocate the appropriate DefinitionData structure. bool IsLambda = Record[Idx++]; if (IsLambda) - DD = new (C) CXXRecordDecl::LambdaDefinitionData(D, 0, false, false, + DD = new (C) CXXRecordDecl::LambdaDefinitionData(D, nullptr, false, false, LCD_None); else DD = new (C) struct CXXRecordDecl::DefinitionData(D); @@ -2144,7 +2145,7 @@ void ASTDeclReader::VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D) { void ASTReader::ReadAttributes(ModuleFile &F, AttrVec &Attrs, const RecordData &Record, unsigned &Idx) { for (unsigned i = 0, e = Record[Idx++]; i != e; ++i) { - Attr *New = 0; + Attr *New = nullptr; attr::Kind Kind = (attr::Kind)Record[Idx++]; SourceRange Range = ReadSourceRange(F, Record, Idx); @@ -2376,9 +2377,10 @@ static DeclContext *getPrimaryContextForMerging(DeclContext *DC) { return RD->getDefinition(); if (EnumDecl *ED = dyn_cast<EnumDecl>(DC)) - return ED->getASTContext().getLangOpts().CPlusPlus? ED->getDefinition() : 0; + return ED->getASTContext().getLangOpts().CPlusPlus? ED->getDefinition() + : nullptr; - return 0; + return nullptr; } ASTDeclReader::FindExistingResult::~FindExistingResult() { @@ -2399,7 +2401,7 @@ ASTDeclReader::FindExistingResult ASTDeclReader::findExisting(NamedDecl *D) { DeclarationName Name = D->getDeclName(); if (!Name) { // Don't bother trying to find unnamed declarations. - FindExistingResult Result(Reader, D, /*Existing=*/0); + FindExistingResult Result(Reader, D, /*Existing=*/nullptr); Result.suppress(); return Result; } @@ -2459,7 +2461,7 @@ ASTDeclReader::FindExistingResult ASTDeclReader::findExisting(NamedDecl *D) { if (Reader.MergedDeclContexts.count(D->getLexicalDeclContext())) Reader.PendingOdrMergeChecks.push_back(D); - return FindExistingResult(Reader, D, /*Existing=*/0); + return FindExistingResult(Reader, D, /*Existing=*/nullptr); } template<typename DeclT> @@ -2577,7 +2579,7 @@ Decl *ASTReader::ReadDeclRecord(DeclID ID) { unsigned Idx = 0; ASTDeclReader Reader(*this, *Loc.F, ID, RawLocation, Record,Idx); - Decl *D = 0; + Decl *D = nullptr; switch ((DeclCode)DeclsCursor.readRecord(Code, Record)) { case DECL_CONTEXT_LEXICAL: case DECL_CONTEXT_VISIBLE: @@ -2759,7 +2761,7 @@ Decl *ASTReader::ReadDeclRecord(DeclID ID) { break; case DECL_CXX_BASE_SPECIFIERS: Error("attempt to read a C++ base-specifier record as a declaration"); - return 0; + return nullptr; case DECL_IMPORT: // Note: last entry of the ImportDecl record is the number of stored source // locations. @@ -2798,7 +2800,7 @@ Decl *ASTReader::ReadDeclRecord(DeclID ID) { LookupDC->setHasExternalVisibleStorage(true); if (ReadDeclContextStorage(*Loc.F, DeclsCursor, Offsets, Loc.F->DeclContextInfos[DC])) - return 0; + return nullptr; } // Now add the pending visible updates for this decl context, if it has any. @@ -3053,7 +3055,7 @@ namespace { unsigned PreviousGeneration) : Reader(Reader), InterfaceID(InterfaceID), Interface(Interface), Deserialized(Deserialized), PreviousGeneration(PreviousGeneration), - Tail(0) + Tail(nullptr) { // Populate the name -> category map with the set of known categories. for (auto *Cat : Interface->known_categories()) { |