diff options
Diffstat (limited to 'lib/Serialization/ASTReaderDecl.cpp')
-rw-r--r-- | lib/Serialization/ASTReaderDecl.cpp | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/lib/Serialization/ASTReaderDecl.cpp b/lib/Serialization/ASTReaderDecl.cpp index 00ebd3ebe8e4..b23c33c55188 100644 --- a/lib/Serialization/ASTReaderDecl.cpp +++ b/lib/Serialization/ASTReaderDecl.cpp @@ -810,14 +810,14 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) { FunctionTemplateSpecializationInfo::Profile(ID, TemplArgs, C); void *InsertPos = nullptr; FunctionTemplateDecl::Common *CommonPtr = CanonTemplate->getCommonPtr(); - CommonPtr->Specializations.FindNodeOrInsertPos(ID, InsertPos); + FunctionTemplateSpecializationInfo *ExistingInfo = + CommonPtr->Specializations.FindNodeOrInsertPos(ID, InsertPos); if (InsertPos) CommonPtr->Specializations.InsertNode(FTInfo, InsertPos); else { assert(Reader.getContext().getLangOpts().Modules && "already deserialized this template specialization"); - // FIXME: This specialization is a redeclaration of one from another - // module. Merge it. + mergeRedeclarable(FD, ExistingInfo->Function, Redecl); } } break; @@ -839,8 +839,8 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) { FD->setDependentTemplateSpecialization(Reader.getContext(), TemplDecls, TemplArgs); - - // FIXME: Merging. + // These are not merged; we don't need to merge redeclarations of dependent + // template friends. break; } } @@ -1045,12 +1045,10 @@ void ASTDeclReader::VisitObjCPropertyDecl(ObjCPropertyDecl *D) { QualType T = Reader.readType(F, Record, Idx); TypeSourceInfo *TSI = GetTypeSourceInfo(Record, Idx); D->setType(T, TSI); - // FIXME: stable encoding D->setPropertyAttributes( (ObjCPropertyDecl::PropertyAttributeKind)Record[Idx++]); D->setPropertyAttributesAsWritten( (ObjCPropertyDecl::PropertyAttributeKind)Record[Idx++]); - // FIXME: stable encoding D->setPropertyImplementation( (ObjCPropertyDecl::PropertyControl)Record[Idx++]); D->setGetterName(Reader.ReadDeclarationName(F,Record, Idx).getObjCSelector()); @@ -1768,9 +1766,6 @@ DeclID ASTDeclReader::VisitTemplateDecl(TemplateDecl *D) { = Reader.ReadTemplateParameterList(F, Record, Idx); D->init(TemplatedDecl, TemplateParams); - // FIXME: If this is a redeclaration of a template from another module, handle - // inheritance of default template arguments. - return PatternID; } @@ -2622,7 +2617,6 @@ static bool isSameEntity(NamedDecl *X, NamedDecl *Y) { return NAX->getNamespace()->Equals(NAY->getNamespace()); } - // FIXME: Many other cases to implement. return false; } @@ -2772,9 +2766,6 @@ ASTDeclReader::FindExistingResult ASTDeclReader::findExisting(NamedDecl *D) { return Result; } - // FIXME: Bail out for non-canonical declarations. We will have performed any - // necessary merging already. - DeclContext *DC = D->getDeclContext()->getRedeclContext(); if (TypedefNameForLinkage) { auto It = Reader.ImportedTypedefNamesForLinkage.find( @@ -3888,7 +3879,7 @@ void ASTDeclReader::UpdateDecl(Decl *D, ModuleFile &ModuleFile, Reader.Context, ReadSourceRange(Record, Idx))); break; - case UPD_DECL_EXPORTED: + case UPD_DECL_EXPORTED: { unsigned SubmoduleID = readSubmoduleID(Record, Idx); auto *Exported = cast<NamedDecl>(D); if (auto *TD = dyn_cast<TagDecl>(Exported)) @@ -3897,18 +3888,28 @@ void ASTDeclReader::UpdateDecl(Decl *D, ModuleFile &ModuleFile, if (Reader.getContext().getLangOpts().ModulesLocalVisibility) { // FIXME: This doesn't send the right notifications if there are // ASTMutationListeners other than an ASTWriter. - Reader.getContext().mergeDefinitionIntoModule(cast<NamedDecl>(D), Owner, - /*NotifyListeners*/false); - Reader.PendingMergedDefinitionsToDeduplicate.insert(cast<NamedDecl>(D)); + Reader.getContext().mergeDefinitionIntoModule( + cast<NamedDecl>(Exported), Owner, + /*NotifyListeners*/ false); + Reader.PendingMergedDefinitionsToDeduplicate.insert( + cast<NamedDecl>(Exported)); } else if (Owner && Owner->NameVisibility != Module::AllVisible) { // If Owner is made visible at some later point, make this declaration // visible too. - Reader.HiddenNamesMap[Owner].push_back(D); + Reader.HiddenNamesMap[Owner].push_back(Exported); } else { // The declaration is now visible. - D->Hidden = false; + Exported->Hidden = false; } break; } + + case UPD_ADDED_ATTR_TO_RECORD: + AttrVec Attrs; + Reader.ReadAttributes(F, Attrs, Record, Idx); + assert(Attrs.size() == 1); + D->addAttr(Attrs[0]); + break; + } } } |