260a261,266
> if (CheckEquivalentExceptionSpec(
> Old->getType()->getAsFunctionProtoType(), Old->getLocation(),
> New->getType()->getAsFunctionProtoType(), New->getLocation())) {
> Invalid = true;
> }
>
484c490
< Class->setBases(Bases, NumGoodBases);
---
> Class->setBases(Context, Bases, NumGoodBases);
648a655
> const CXXScopeSpec &SS,
649a657
> TypeTy *TemplateTypeTy,
680,685c688,694
< // Look for a member, first.
< FieldDecl *Member = 0;
< DeclContext::lookup_result Result
< = ClassDecl->lookup(Context, MemberOrBase);
< if (Result.first != Result.second)
< Member = dyn_cast<FieldDecl>(*Result.first);
---
> if (!SS.getScopeRep() && !TemplateTypeTy) {
> // Look for a member, first.
> FieldDecl *Member = 0;
> DeclContext::lookup_result Result
> = ClassDecl->lookup(MemberOrBase);
> if (Result.first != Result.second)
> Member = dyn_cast<FieldDecl>(*Result.first);
687c696
< // FIXME: Handle members of an anonymous union.
---
> // FIXME: Handle members of an anonymous union.
689,691c698,702
< if (Member) {
< // FIXME: Perform direct initialization of the member.
< return new CXXBaseOrMemberInitializer(Member, (Expr **)Args, NumArgs);
---
> if (Member) {
> // FIXME: Perform direct initialization of the member.
> return new CXXBaseOrMemberInitializer(Member, (Expr **)Args, NumArgs,
> IdLoc);
> }
693d703
<
695c705,706
< TypeTy *BaseTy = getTypeName(*MemberOrBase, IdLoc, S, 0/*SS*/);
---
> TypeTy *BaseTy = TemplateTypeTy ? TemplateTypeTy
> : getTypeName(*MemberOrBase, IdLoc, S, &SS);
701c712
< if (!BaseType->isRecordType())
---
> if (!BaseType->isRecordType() && !BaseType->isDependentType())
751a763,771
> // C++ [base.class.init]p2:
> // Unless the mem-initializer-id names a nonstatic data membeer of the
> // constructor's class ot a direst or virtual base of that class, the
> // mem-initializer is ill-formed.
> if (!DirectBaseSpec && !VirtualBaseSpec)
> return Diag(IdLoc, diag::err_not_direct_base_or_virtual)
> << BaseType << ClassDecl->getNameAsCString()
> << SourceRange(IdLoc, RParenLoc);
>
753c773,774
< return new CXXBaseOrMemberInitializer(BaseType, (Expr **)Args, NumArgs);
---
> return new CXXBaseOrMemberInitializer(BaseType, (Expr **)Args, NumArgs,
> IdLoc);
768a790,825
> llvm::DenseMap<void*, CXXBaseOrMemberInitializer *>Members;
> bool err = false;
> for (unsigned i = 0; i < NumMemInits; i++) {
> CXXBaseOrMemberInitializer *Member =
> static_cast<CXXBaseOrMemberInitializer*>(MemInits[i]);
> void *KeyToMember = Member->getBaseOrMember();
> // For fields injected into the class via declaration of an anonymous union,
> // use its anonymous union class declaration as the unique key.
> if (FieldDecl *Field = Member->getMember())
> if (Field->getDeclContext()->isRecord() &&
> cast<RecordDecl>(Field->getDeclContext())->isAnonymousStructOrUnion())
> KeyToMember = static_cast<void *>(Field->getDeclContext());
> CXXBaseOrMemberInitializer *&PrevMember = Members[KeyToMember];
> if (!PrevMember) {
> PrevMember = Member;
> continue;
> }
> if (FieldDecl *Field = Member->getMember())
> Diag(Member->getSourceLocation(),
> diag::error_multiple_mem_initialization)
> << Field->getNameAsString();
> else {
> Type *BaseClass = Member->getBaseClass();
> assert(BaseClass && "ActOnMemInitializers - neither field or base");
> Diag(Member->getSourceLocation(),
> diag::error_multiple_base_initialization)
> << BaseClass->getDesugaredType(true);
> }
> Diag(PrevMember->getSourceLocation(), diag::note_previous_initializer)
> << 0;
> err = true;
> }
> if (!err)
> Constructor->setBaseOrMemberInitializers(Context,
> reinterpret_cast<CXXBaseOrMemberInitializer **>(MemInits),
> NumMemInits);
824,825c881
< for (RecordDecl::decl_iterator i = RD->decls_begin(Context),
< e = RD->decls_end(Context);
---
> for (RecordDecl::decl_iterator i = RD->decls_begin(), e = RD->decls_end();
922,923c978,979
< for (CXXRecordDecl::decl_iterator I = DC->decls_begin(SemaRef.Context),
< E = DC->decls_end(SemaRef.Context); I != E; ++I)
---
> for (CXXRecordDecl::decl_iterator I = DC->decls_begin(),
> E = DC->decls_end(); I != E; ++I)
999,1000c1055,1056
< for (RecordDecl::field_iterator i = RD->field_begin(Context),
< e = RD->field_end(Context); i != e; ++i) {
---
> for (RecordDecl::field_iterator i = RD->field_begin(), e = RD->field_end();
> i != e; ++i) {
1057c1113
< ClassDecl->addDecl(Context, DefaultCon);
---
> ClassDecl->addDecl(DefaultCon);
1089,1090c1145,1146
< for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context);
< HasConstCopyConstructor && Field != ClassDecl->field_end(Context);
---
> for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin();
> HasConstCopyConstructor && Field != ClassDecl->field_end();
1134c1190
< ClassDecl->addDecl(Context, CopyConstructor);
---
> ClassDecl->addDecl(CopyConstructor);
1168,1169c1224,1225
< for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context);
< HasConstCopyAssignment && Field != ClassDecl->field_end(Context);
---
> for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin();
> HasConstCopyAssignment && Field != ClassDecl->field_end();
1213c1269
< ClassDecl->addDecl(Context, CopyAssignment);
---
> ClassDecl->addDecl(CopyAssignment);
1232c1288
< ClassDecl->addDecl(Context, Destructor);
---
> ClassDecl->addDecl(Destructor);
1775c1831
< Ctx->addDecl(Context, UDir);
---
> Ctx->addDecl(UDir);
1876c1932
< CurContext->addDecl(Context, AliasDecl);
---
> CurContext->addDecl(AliasDecl);
1894,1895c1950,1951
< for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin();
< Base != ClassDecl->bases_end(); ++Base) {
---
> for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(),
> E = ClassDecl->bases_end(); Base != E; ++Base) {
1912,1914c1968,1969
< for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context);
< Field != ClassDecl->field_end(Context);
< ++Field) {
---
> for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(),
> E = ClassDecl->field_end(); Field != E; ++Field) {
1967,1968c2022,2023
< for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin();
< Base != ClassDecl->bases_end(); ++Base) {
---
> for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(),
> E = ClassDecl->bases_end(); Base != E; ++Base) {
1981,1983c2036,2037
< for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context);
< Field != ClassDecl->field_end(Context);
< ++Field) {
---
> for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(),
> E = ClassDecl->field_end(); Field != E; ++Field) {
2013d2066
< assert(ClassDecl && "DefineImplicitOverloadedAssign - invalid constructor");
2021,2022c2074,2075
< for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin();
< Base != ClassDecl->bases_end(); ++Base) {
---
> for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(),
> E = ClassDecl->bases_end(); Base != E; ++Base) {
2029,2031c2082,2083
< for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context);
< Field != ClassDecl->field_end(Context);
< ++Field) {
---
> for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(),
> E = ClassDecl->field_end(); Field != E; ++Field) {
2116,2118c2168,2170
< for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context);
< Field != ClassDecl->field_end(Context);
< ++Field) {
---
> for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(),
> FieldEnd = ClassDecl->field_end();
> Field != FieldEnd; ++Field) {
2143c2195
< void Sema::MarcDestructorReferenced(SourceLocation Loc, QualType DeclInitType)
---
> void Sema::MarkDestructorReferenced(SourceLocation Loc, QualType DeclInitType)
2221c2273
< MarcDestructorReferenced(VDecl->getLocation(), DeclInitType);
---
> MarkDestructorReferenced(VDecl->getLocation(), DeclInitType);
2285c2337
< for (llvm::tie(Con, ConEnd) = ClassDecl->lookup(Context, ConstructorName);
---
> for (llvm::tie(Con, ConEnd) = ClassDecl->lookup(ConstructorName);
2895c2947
< CurContext->addDecl(Context, D);
---
> CurContext->addDecl(D);
3009c3061
< CurContext->addDecl(Context, ExDecl);
---
> CurContext->addDecl(ExDecl);
3043c3095
< CurContext->addDecl(Context, Decl);
---
> CurContext->addDecl(Decl);
> if (CheckEquivalentExceptionSpec(
> Old->getType()->getAsFunctionProtoType(), Old->getLocation(),
> New->getType()->getAsFunctionProtoType(), New->getLocation())) {
> Invalid = true;
> }
>
484c490
< Class->setBases(Bases, NumGoodBases);
---
> Class->setBases(Context, Bases, NumGoodBases);
648a655
> const CXXScopeSpec &SS,
649a657
> TypeTy *TemplateTypeTy,
680,685c688,694
< // Look for a member, first.
< FieldDecl *Member = 0;
< DeclContext::lookup_result Result
< = ClassDecl->lookup(Context, MemberOrBase);
< if (Result.first != Result.second)
< Member = dyn_cast<FieldDecl>(*Result.first);
---
> if (!SS.getScopeRep() && !TemplateTypeTy) {
> // Look for a member, first.
> FieldDecl *Member = 0;
> DeclContext::lookup_result Result
> = ClassDecl->lookup(MemberOrBase);
> if (Result.first != Result.second)
> Member = dyn_cast<FieldDecl>(*Result.first);
687c696
< // FIXME: Handle members of an anonymous union.
---
> // FIXME: Handle members of an anonymous union.
689,691c698,702
< if (Member) {
< // FIXME: Perform direct initialization of the member.
< return new CXXBaseOrMemberInitializer(Member, (Expr **)Args, NumArgs);
---
> if (Member) {
> // FIXME: Perform direct initialization of the member.
> return new CXXBaseOrMemberInitializer(Member, (Expr **)Args, NumArgs,
> IdLoc);
> }
693d703
<
695c705,706
< TypeTy *BaseTy = getTypeName(*MemberOrBase, IdLoc, S, 0/*SS*/);
---
> TypeTy *BaseTy = TemplateTypeTy ? TemplateTypeTy
> : getTypeName(*MemberOrBase, IdLoc, S, &SS);
701c712
< if (!BaseType->isRecordType())
---
> if (!BaseType->isRecordType() && !BaseType->isDependentType())
751a763,771
> // C++ [base.class.init]p2:
> // Unless the mem-initializer-id names a nonstatic data membeer of the
> // constructor's class ot a direst or virtual base of that class, the
> // mem-initializer is ill-formed.
> if (!DirectBaseSpec && !VirtualBaseSpec)
> return Diag(IdLoc, diag::err_not_direct_base_or_virtual)
> << BaseType << ClassDecl->getNameAsCString()
> << SourceRange(IdLoc, RParenLoc);
>
753c773,774
< return new CXXBaseOrMemberInitializer(BaseType, (Expr **)Args, NumArgs);
---
> return new CXXBaseOrMemberInitializer(BaseType, (Expr **)Args, NumArgs,
> IdLoc);
768a790,825
> llvm::DenseMap<void*, CXXBaseOrMemberInitializer *>Members;
> bool err = false;
> for (unsigned i = 0; i < NumMemInits; i++) {
> CXXBaseOrMemberInitializer *Member =
> static_cast<CXXBaseOrMemberInitializer*>(MemInits[i]);
> void *KeyToMember = Member->getBaseOrMember();
> // For fields injected into the class via declaration of an anonymous union,
> // use its anonymous union class declaration as the unique key.
> if (FieldDecl *Field = Member->getMember())
> if (Field->getDeclContext()->isRecord() &&
> cast<RecordDecl>(Field->getDeclContext())->isAnonymousStructOrUnion())
> KeyToMember = static_cast<void *>(Field->getDeclContext());
> CXXBaseOrMemberInitializer *&PrevMember = Members[KeyToMember];
> if (!PrevMember) {
> PrevMember = Member;
> continue;
> }
> if (FieldDecl *Field = Member->getMember())
> Diag(Member->getSourceLocation(),
> diag::error_multiple_mem_initialization)
> << Field->getNameAsString();
> else {
> Type *BaseClass = Member->getBaseClass();
> assert(BaseClass && "ActOnMemInitializers - neither field or base");
> Diag(Member->getSourceLocation(),
> diag::error_multiple_base_initialization)
> << BaseClass->getDesugaredType(true);
> }
> Diag(PrevMember->getSourceLocation(), diag::note_previous_initializer)
> << 0;
> err = true;
> }
> if (!err)
> Constructor->setBaseOrMemberInitializers(Context,
> reinterpret_cast<CXXBaseOrMemberInitializer **>(MemInits),
> NumMemInits);
824,825c881
< for (RecordDecl::decl_iterator i = RD->decls_begin(Context),
< e = RD->decls_end(Context);
---
> for (RecordDecl::decl_iterator i = RD->decls_begin(), e = RD->decls_end();
922,923c978,979
< for (CXXRecordDecl::decl_iterator I = DC->decls_begin(SemaRef.Context),
< E = DC->decls_end(SemaRef.Context); I != E; ++I)
---
> for (CXXRecordDecl::decl_iterator I = DC->decls_begin(),
> E = DC->decls_end(); I != E; ++I)
999,1000c1055,1056
< for (RecordDecl::field_iterator i = RD->field_begin(Context),
< e = RD->field_end(Context); i != e; ++i) {
---
> for (RecordDecl::field_iterator i = RD->field_begin(), e = RD->field_end();
> i != e; ++i) {
1057c1113
< ClassDecl->addDecl(Context, DefaultCon);
---
> ClassDecl->addDecl(DefaultCon);
1089,1090c1145,1146
< for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context);
< HasConstCopyConstructor && Field != ClassDecl->field_end(Context);
---
> for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin();
> HasConstCopyConstructor && Field != ClassDecl->field_end();
1134c1190
< ClassDecl->addDecl(Context, CopyConstructor);
---
> ClassDecl->addDecl(CopyConstructor);
1168,1169c1224,1225
< for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context);
< HasConstCopyAssignment && Field != ClassDecl->field_end(Context);
---
> for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin();
> HasConstCopyAssignment && Field != ClassDecl->field_end();
1213c1269
< ClassDecl->addDecl(Context, CopyAssignment);
---
> ClassDecl->addDecl(CopyAssignment);
1232c1288
< ClassDecl->addDecl(Context, Destructor);
---
> ClassDecl->addDecl(Destructor);
1775c1831
< Ctx->addDecl(Context, UDir);
---
> Ctx->addDecl(UDir);
1876c1932
< CurContext->addDecl(Context, AliasDecl);
---
> CurContext->addDecl(AliasDecl);
1894,1895c1950,1951
< for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin();
< Base != ClassDecl->bases_end(); ++Base) {
---
> for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(),
> E = ClassDecl->bases_end(); Base != E; ++Base) {
1912,1914c1968,1969
< for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context);
< Field != ClassDecl->field_end(Context);
< ++Field) {
---
> for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(),
> E = ClassDecl->field_end(); Field != E; ++Field) {
1967,1968c2022,2023
< for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin();
< Base != ClassDecl->bases_end(); ++Base) {
---
> for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(),
> E = ClassDecl->bases_end(); Base != E; ++Base) {
1981,1983c2036,2037
< for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context);
< Field != ClassDecl->field_end(Context);
< ++Field) {
---
> for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(),
> E = ClassDecl->field_end(); Field != E; ++Field) {
2013d2066
< assert(ClassDecl && "DefineImplicitOverloadedAssign - invalid constructor");
2021,2022c2074,2075
< for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin();
< Base != ClassDecl->bases_end(); ++Base) {
---
> for (CXXRecordDecl::base_class_iterator Base = ClassDecl->bases_begin(),
> E = ClassDecl->bases_end(); Base != E; ++Base) {
2029,2031c2082,2083
< for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context);
< Field != ClassDecl->field_end(Context);
< ++Field) {
---
> for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(),
> E = ClassDecl->field_end(); Field != E; ++Field) {
2116,2118c2168,2170
< for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context);
< Field != ClassDecl->field_end(Context);
< ++Field) {
---
> for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(),
> FieldEnd = ClassDecl->field_end();
> Field != FieldEnd; ++Field) {
2143c2195
< void Sema::MarcDestructorReferenced(SourceLocation Loc, QualType DeclInitType)
---
> void Sema::MarkDestructorReferenced(SourceLocation Loc, QualType DeclInitType)
2221c2273
< MarcDestructorReferenced(VDecl->getLocation(), DeclInitType);
---
> MarkDestructorReferenced(VDecl->getLocation(), DeclInitType);
2285c2337
< for (llvm::tie(Con, ConEnd) = ClassDecl->lookup(Context, ConstructorName);
---
> for (llvm::tie(Con, ConEnd) = ClassDecl->lookup(ConstructorName);
2895c2947
< CurContext->addDecl(Context, D);
---
> CurContext->addDecl(D);
3009c3061
< CurContext->addDecl(Context, ExDecl);
---
> CurContext->addDecl(ExDecl);
3043c3095
< CurContext->addDecl(Context, Decl);
---
> CurContext->addDecl(Decl);