diff options
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 24 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 59 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 155 | ||||
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 54 | ||||
-rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Sema/SemaExprObjC.cpp | 34 | ||||
-rw-r--r-- | clang/lib/Sema/SemaInherit.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Sema/SemaInit.cpp | 29 | ||||
-rw-r--r-- | clang/lib/Sema/SemaLookup.cpp | 12 | ||||
-rw-r--r-- | clang/lib/Sema/SemaOverload.cpp | 9 | ||||
-rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiate.cpp | 8 | ||||
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 31 | ||||
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiateExpr.cpp | 3 |
15 files changed, 210 insertions, 228 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index a0e125f0fce..1fd569729a3 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -273,7 +273,7 @@ void Sema::PushOnScopeChains(NamedDecl *D, Scope *S) { // Add scoped declarations into their context, so that they can be // found later. Declarations without a context won't be inserted // into any context. - CurContext->addDecl(Context, D); + CurContext->addDecl(D); // C++ [basic.scope]p4: // -- exactly one declaration shall declare a class name or @@ -1123,8 +1123,8 @@ Sema::DeclPtrTy Sema::ParsedFreeStandingDeclSpec(Scope *S, DeclSpec &DS) { bool Sema::InjectAnonymousStructOrUnionMembers(Scope *S, DeclContext *Owner, RecordDecl *AnonRecord) { bool Invalid = false; - for (RecordDecl::field_iterator F = AnonRecord->field_begin(Context), - FEnd = AnonRecord->field_end(Context); + for (RecordDecl::field_iterator F = AnonRecord->field_begin(), + FEnd = AnonRecord->field_end(); F != FEnd; ++F) { if ((*F)->getDeclName()) { NamedDecl *PrevDecl = LookupQualifiedName(Owner, (*F)->getDeclName(), @@ -1147,7 +1147,7 @@ bool Sema::InjectAnonymousStructOrUnionMembers(Scope *S, DeclContext *Owner, // definition, the members of the anonymous union are // considered to have been defined in the scope in which the // anonymous union is declared. - Owner->makeDeclVisibleInContext(Context, *F); + Owner->makeDeclVisibleInContext(*F); S->AddDecl(DeclPtrTy::make(*F)); IdResolver.AddDecl(*F); } @@ -1213,8 +1213,8 @@ Sema::DeclPtrTy Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, // The member-specification of an anonymous union shall only // define non-static data members. [Note: nested types and // functions cannot be declared within an anonymous union. ] - for (DeclContext::decl_iterator Mem = Record->decls_begin(Context), - MemEnd = Record->decls_end(Context); + for (DeclContext::decl_iterator Mem = Record->decls_begin(), + MemEnd = Record->decls_end(); Mem != MemEnd; ++Mem) { if (FieldDecl *FD = dyn_cast<FieldDecl>(*Mem)) { // C++ [class.union]p3: @@ -1302,7 +1302,7 @@ Sema::DeclPtrTy Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, // Add the anonymous struct/union object to the current // context. We'll be referencing this object when we refer to one of // its members. - Owner->addDecl(Context, Anon); + Owner->addDecl(Anon); // Inject the members of the anonymous struct/union into the owning // context and into the identifier resolver chain for name lookup @@ -3756,7 +3756,7 @@ CreateNewDecl: S = getNonFieldDeclScope(S); PushOnScopeChains(New, S); } else { - CurContext->addDecl(Context, New); + CurContext->addDecl(New); } OwnedDecl = true; @@ -3912,7 +3912,7 @@ FieldDecl *Sema::HandleField(Scope *S, RecordDecl *Record, } else if (II) { PushOnScopeChains(NewFD, S); } else - Record->addDecl(Context, NewFD); + Record->addDecl(NewFD); return NewFD; } @@ -4234,7 +4234,7 @@ void Sema::ActOnFields(Scope* S, // Add ivar's to class's DeclContext. for (unsigned i = 0, e = RecFields.size(); i != e; ++i) { ClsFields[i]->setLexicalDeclContext(ID); - ID->addDecl(Context, ClsFields[i]); + ID->addDecl(ClsFields[i]); } // Must enforce the rule that ivars in the base classes may not be // duplicates. @@ -4245,7 +4245,7 @@ void Sema::ActOnFields(Scope* S, if (IdentifierInfo *II = Ivar->getIdentifier()) { ObjCIvarDecl* prevIvar = - ID->getSuperClass()->lookupInstanceVariable(Context, II); + ID->getSuperClass()->lookupInstanceVariable(II); if (prevIvar) { Diag(Ivar->getLocation(), diag::err_duplicate_member) << II; Diag(prevIvar->getLocation(), diag::note_previous_declaration); @@ -4544,7 +4544,7 @@ Sema::DeclPtrTy Sema::ActOnFileScopeAsmDecl(SourceLocation Loc, FileScopeAsmDecl *New = FileScopeAsmDecl::Create(Context, CurContext, Loc, AsmString); - CurContext->addDecl(Context, New); + CurContext->addDecl(New); return DeclPtrTy::make(New); } diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index c5274f68015..2b71df72245 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -1326,8 +1326,8 @@ static void HandleTransparentUnionAttr(Decl *d, const AttributeList &Attr, return; } - RecordDecl::field_iterator Field = RD->field_begin(S.Context), - FieldEnd = RD->field_end(S.Context); + RecordDecl::field_iterator Field = RD->field_begin(), + FieldEnd = RD->field_end(); if (Field == FieldEnd) { S.Diag(Attr.getLoc(), diag::warn_transparent_union_attribute_zero_fields); return; diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 1172d3e01b5..f7c0ada6df2 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -680,7 +680,7 @@ Sema::ActOnMemInitializer(DeclPtrTy ConstructorD, // Look for a member, first. FieldDecl *Member = 0; DeclContext::lookup_result Result - = ClassDecl->lookup(Context, MemberOrBase); + = ClassDecl->lookup(MemberOrBase); if (Result.first != Result.second) Member = dyn_cast<FieldDecl>(*Result.first); @@ -847,8 +847,7 @@ namespace { MethodSetTy OverriddenMethods; size_t MethodsSize = Methods.size(); - 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(); i != e; ++i) { // Traverse the record, looking for methods. if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(*i)) { @@ -945,8 +944,8 @@ namespace { bool VisitDeclContext(const DeclContext *DC) { bool Invalid = false; - 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) Invalid |= Visit(*I); return Invalid; @@ -1022,8 +1021,8 @@ void Sema::ActOnFinishCXXMemberSpecification(Scope* S, SourceLocation RLoc, AbstractClassUsageDiagnoser(*this, RD); if (RD->hasTrivialConstructor() || RD->hasTrivialDestructor()) { - 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) { // All the nonstatic data members must have trivial constructors. QualType FTy = i->getType(); while (const ArrayType *AT = Context.getAsArrayType(FTy)) @@ -1080,7 +1079,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) { /*isImplicitlyDeclared=*/true); DefaultCon->setAccess(AS_public); DefaultCon->setImplicit(); - ClassDecl->addDecl(Context, DefaultCon); + ClassDecl->addDecl(DefaultCon); } if (!ClassDecl->hasUserDeclaredCopyConstructor()) { @@ -1112,8 +1111,8 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) { // class type M (or array thereof), each such class type // has a copy constructor whose first parameter is of type // const M& or const volatile M&. - 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(); ++Field) { QualType FieldType = (*Field)->getType(); if (const ArrayType *Array = Context.getAsArrayType(FieldType)) @@ -1157,7 +1156,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) { /*IdentifierInfo=*/0, ArgType, VarDecl::None, 0); CopyConstructor->setParams(Context, &FromParam, 1); - ClassDecl->addDecl(Context, CopyConstructor); + ClassDecl->addDecl(CopyConstructor); } if (!ClassDecl->hasUserDeclaredCopyAssignment()) { @@ -1191,8 +1190,8 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) { // type M (or array thereof), each such class type has a copy // assignment operator whose parameter is of type const M&, // const volatile M& or M. - 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(); ++Field) { QualType FieldType = (*Field)->getType(); if (const ArrayType *Array = Context.getAsArrayType(FieldType)) @@ -1236,7 +1235,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) { // Don't call addedAssignmentOperator. There is no way to distinguish an // implicit from an explicit assignment operator. - ClassDecl->addDecl(Context, CopyAssignment); + ClassDecl->addDecl(CopyAssignment); } if (!ClassDecl->hasUserDeclaredDestructor()) { @@ -1255,7 +1254,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) { /*isImplicitlyDeclared=*/true); Destructor->setAccess(AS_public); Destructor->setImplicit(); - ClassDecl->addDecl(Context, Destructor); + ClassDecl->addDecl(Destructor); } } @@ -1798,7 +1797,7 @@ void Sema::PushUsingDirective(Scope *S, UsingDirectiveDecl *UDir) { // or translation unit scope. We add UsingDirectiveDecls, into // it's lookup structure. if (DeclContext *Ctx = static_cast<DeclContext*>(S->getEntity())) - Ctx->addDecl(Context, UDir); + Ctx->addDecl(UDir); else // Otherwise it is block-sope. using-directives will affect lookup // only to the end of scope. @@ -1899,7 +1898,7 @@ Sema::DeclPtrTy Sema::ActOnNamespaceAliasDef(Scope *S, (NestedNameSpecifier *)SS.getScopeRep(), IdentLoc, R); - CurContext->addDecl(Context, AliasDecl); + CurContext->addDecl(AliasDecl); return DeclPtrTy::make(AliasDecl); } @@ -1935,8 +1934,8 @@ void Sema::DefineImplicitDefaultConstructor(SourceLocation CurrentLocation, } } } - for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context); - Field != ClassDecl->field_end(Context); + for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(); + Field != ClassDecl->field_end(); ++Field) { QualType FieldType = Context.getCanonicalType((*Field)->getType()); if (const ArrayType *Array = Context.getAsArrayType(FieldType)) @@ -2004,8 +2003,8 @@ void Sema::DefineImplicitDestructor(SourceLocation CurrentLocation, } } - for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context); - Field != ClassDecl->field_end(Context); + for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(); + Field != ClassDecl->field_end(); ++Field) { QualType FieldType = Context.getCanonicalType((*Field)->getType()); if (const ArrayType *Array = Context.getAsArrayType(FieldType)) @@ -2052,8 +2051,8 @@ void Sema::DefineImplicitOverloadedAssign(SourceLocation CurrentLocation, getAssignOperatorMethod(MethodDecl->getParamDecl(0), BaseClassDecl)) MarkDeclarationReferenced(CurrentLocation, BaseAssignOpMethod); } - for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(Context); - Field != ClassDecl->field_end(Context); + for (CXXRecordDecl::field_iterator Field = ClassDecl->field_begin(); + Field != ClassDecl->field_end(); ++Field) { QualType FieldType = Context.getCanonicalType((*Field)->getType()); if (const ArrayType *Array = Context.getAsArrayType(FieldType)) @@ -2139,9 +2138,9 @@ void Sema::DefineImplicitCopyConstructor(SourceLocation CurrentLocation, BaseClassDecl->getCopyConstructor(Context, TypeQuals)) MarkDeclarationReferenced(CurrentLocation, BaseCopyCtor); } - 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) { QualType FieldType = Context.getCanonicalType((*Field)->getType()); if (const ArrayType *Array = Context.getAsArrayType(FieldType)) FieldType = Array->getElementType(); @@ -2308,7 +2307,7 @@ Sema::PerformInitializationByConstructor(QualType ClassType, = Context.DeclarationNames.getCXXConstructorName( Context.getCanonicalType(ClassType.getUnqualifiedType())); DeclContext::lookup_const_iterator Con, ConEnd; - for (llvm::tie(Con, ConEnd) = ClassDecl->lookup(Context, ConstructorName); + for (llvm::tie(Con, ConEnd) = ClassDecl->lookup(ConstructorName); Con != ConEnd; ++Con) { CXXConstructorDecl *Constructor = cast<CXXConstructorDecl>(*Con); if ((Kind == IK_Direct) || @@ -2918,7 +2917,7 @@ Sema::DeclPtrTy Sema::ActOnStartLinkageSpecification(Scope *S, LinkageSpecDecl *D = LinkageSpecDecl::Create(Context, CurContext, LangLoc, Language, LBraceLoc.isValid()); - CurContext->addDecl(Context, D); + CurContext->addDecl(D); PushDeclContext(S, D); return DeclPtrTy::make(D); } @@ -3032,7 +3031,7 @@ Sema::DeclPtrTy Sema::ActOnExceptionDeclarator(Scope *S, Declarator &D) { if (II) PushOnScopeChains(ExDecl, S); else - CurContext->addDecl(Context, ExDecl); + CurContext->addDecl(ExDecl); ProcessDeclAttributes(S, ExDecl, D); return DeclPtrTy::make(ExDecl); @@ -3066,7 +3065,7 @@ Sema::DeclPtrTy Sema::ActOnStaticAssertDeclaration(SourceLocation AssertLoc, Decl *Decl = StaticAssertDecl::Create(Context, CurContext, AssertLoc, AssertExpr, AssertMessage); - CurContext->addDecl(Context, Decl); + CurContext->addDecl(Decl); return DeclPtrTy::make(Decl); } diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 9013726e1ae..5cf48d6da0c 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -379,12 +379,12 @@ void Sema::ComparePropertiesInBaseAndSuper(ObjCInterfaceDecl *IDecl) { if (!SDecl) return; // FIXME: O(N^2) - for (ObjCInterfaceDecl::prop_iterator S = SDecl->prop_begin(Context), - E = SDecl->prop_end(Context); S != E; ++S) { + for (ObjCInterfaceDecl::prop_iterator S = SDecl->prop_begin(), + E = SDecl->prop_end(); S != E; ++S) { ObjCPropertyDecl *SuperPDecl = (*S); // Does property in super class has declaration in current class? - for (ObjCInterfaceDecl::prop_iterator I = IDecl->prop_begin(Context), - E = IDecl->prop_end(Context); I != E; ++I) { + for (ObjCInterfaceDecl::prop_iterator I = IDecl->prop_begin(), + E = IDecl->prop_end(); I != E; ++I) { ObjCPropertyDecl *PDecl = (*I); if (SuperPDecl->getIdentifier() == PDecl->getIdentifier()) DiagnosePropertyMismatch(PDecl, SuperPDecl, @@ -404,13 +404,12 @@ Sema::MergeOneProtocolPropertiesIntoClass(Decl *CDecl, // Category ObjCCategoryDecl *CatDecl = static_cast<ObjCCategoryDecl*>(CDecl); assert (CatDecl && "MergeOneProtocolPropertiesIntoClass"); - for (ObjCProtocolDecl::prop_iterator P = PDecl->prop_begin(Context), - E = PDecl->prop_end(Context); P != E; ++P) { + for (ObjCProtocolDecl::prop_iterator P = PDecl->prop_begin(), + E = PDecl->prop_end(); P != E; ++P) { ObjCPropertyDecl *Pr = (*P); ObjCCategoryDecl::prop_iterator CP, CE; // Is this property already in category's list of properties? - for (CP = CatDecl->prop_begin(Context), CE = CatDecl->prop_end(Context); - CP != CE; ++CP) + for (CP = CatDecl->prop_begin(), CE = CatDecl->prop_end(); CP != CE; ++CP) if ((*CP)->getIdentifier() == Pr->getIdentifier()) break; if (CP != CE) @@ -419,13 +418,12 @@ Sema::MergeOneProtocolPropertiesIntoClass(Decl *CDecl, } return; } - for (ObjCProtocolDecl::prop_iterator P = PDecl->prop_begin(Context), - E = PDecl->prop_end(Context); P != E; ++P) { + for (ObjCProtocolDecl::prop_iterator P = PDecl->prop_begin(), + E = PDecl->prop_end(); P != E; ++P) { ObjCPropertyDecl *Pr = (*P); ObjCInterfaceDecl::prop_iterator CP, CE; // Is this property already in class's list of properties? - for (CP = IDecl->prop_begin(Context), CE = IDecl->prop_end(Context); - CP != CE; ++CP) + for (CP = IDecl->prop_begin(), CE = IDecl->prop_end(); CP != CE; ++CP) if ((*CP)->getIdentifier() == Pr->getIdentifier()) break; if (CP != CE) @@ -495,16 +493,16 @@ void Sema::DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT, return; // Possibly due to previous error llvm::DenseMap<Selector, const ObjCMethodDecl*> MethodMap; - for (ObjCInterfaceDecl::method_iterator i = ID->meth_begin(Context), - e = ID->meth_end(Context); i != e; ++i) { + for (ObjCInterfaceDecl::method_iterator i = ID->meth_begin(), + e = ID->meth_end(); i != e; ++i) { ObjCMethodDecl *MD = *i; MethodMap[MD->getSelector()] = MD; } if (MethodMap.empty()) return; - for (ObjCCategoryDecl::method_iterator i = CAT->meth_begin(Context), - e = CAT->meth_end(Context); i != e; ++i) { + for (ObjCCategoryDecl::method_iterator i = CAT->meth_begin(), + e = CAT->meth_end(); i != e; ++i) { ObjCMethodDecl *Method = *i; const ObjCMethodDecl *&PrevMethod = MethodMap[Method->getSelector()]; if (PrevMethod && !MatchTwoMethodDeclarations(Method, PrevMethod)) { @@ -539,7 +537,7 @@ Sema::ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc, ObjCForwardProtocolDecl *PDecl = ObjCForwardProtocolDecl::Create(Context, CurContext, AtProtocolLoc, &Protocols[0], Protocols.size()); - CurContext->addDecl(Context, PDecl); + CurContext->addDecl(PDecl); CheckObjCDeclScope(PDecl); return DeclPtrTy::make(PDecl); } @@ -555,7 +553,7 @@ ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc, ObjCCategoryDecl *CDecl = ObjCCategoryDecl::Create(Context, CurContext, AtInterfaceLoc, CategoryName); // FIXME: PushOnScopeChains? - CurContext->addDecl(Context, CDecl); + CurContext->addDecl(CDecl); ObjCInterfaceDecl *IDecl = getObjCInterfaceDecl(ClassName); /// Check that class of this category is already completely declared. @@ -609,7 +607,7 @@ Sema::DeclPtrTy Sema::ActOnStartCategoryImplementation( Diag(ClassLoc, diag::err_undef_interface) << ClassName; // FIXME: PushOnScopeChains? - CurContext->addDecl(Context, CDecl); + CurContext->addDecl(CDecl); /// TODO: Check that CatName, category name, is not used in another // implementation. @@ -808,7 +806,7 @@ bool Sema::isPropertyReadonly(ObjCPropertyDecl *PDecl, return false; // Even if property is ready only, if interface has a user defined setter, // it is not considered read only. - if (IDecl->getInstanceMethod(Context, PDecl->getSetterName())) + if (IDecl->getInstanceMethod(PDecl->getSetterName())) return false; // Main class has the property as 'readonly'. Must search @@ -818,10 +816,10 @@ bool Sema::isPropertyReadonly(ObjCPropertyDecl *PDecl, Category; Category = Category->getNextClassCategory()) { // Even if property is ready only, if a category has a user defined setter, // it is not considered read only. - if (Category->getInstanceMethod(Context, PDecl->getSetterName())) + if (Category->getInstanceMethod(PDecl->getSetterName())) return false; ObjCPropertyDecl *P = - Category->FindPropertyDeclaration(Context, PDecl->getIdentifier()); + Category->FindPropertyDeclaration(PDecl->getIdentifier()); if (P && !P->isReadOnly()) return false; } @@ -831,19 +829,19 @@ bool Sema::isPropertyReadonly(ObjCPropertyDecl *PDecl, if (ObjCMethodDecl *OMD = dyn_cast<ObjCMethodDecl>(CurContext)) { if (ObjCImplementationDecl *IMD = dyn_cast<ObjCImplementationDecl>(OMD->getDeclContext())) { - if (IMD->getInstanceMethod(Context, PDecl->getSetterName())) + if (IMD->getInstanceMethod(PDecl->getSetterName())) return false; } else if (ObjCCategoryImplDecl *CIMD = dyn_cast<ObjCCategoryImplDecl>(OMD->getDeclContext())) { - if (CIMD->getInstanceMethod(Context, PDecl->getSetterName())) + if (CIMD->getInstanceMethod(PDecl->getSetterName())) return false; } } // Lastly, look through the implementation (if one is in scope). if (ObjCImplementationDecl *ImpDecl = LookupObjCImplementation(IDecl->getIdentifier())) - if (ImpDecl->getInstanceMethod(Context, PDecl->getSetterName())) + if (ImpDecl->getInstanceMethod(PDecl->getSetterName())) return false; // If all fails, look at the super class. if (ObjCInterfaceDecl *SIDecl = IDecl->getSuperClass()) @@ -890,31 +888,30 @@ void Sema::CheckProtocolMethodDefs(SourceLocation ImpLoc, // check unimplemented instance methods. if (!NSIDecl) - for (ObjCProtocolDecl::instmeth_iterator I = PDecl->instmeth_begin(Context), - E = PDecl->instmeth_end(Context); I != E; ++I) { + for (ObjCProtocolDecl::instmeth_iterator I = PDecl->instmeth_begin(), + E = PDecl->instmeth_end(); I != E; ++I) { ObjCMethodDecl *method = *I; if (method->getImplementationControl() != ObjCMethodDecl::Optional && !method->isSynthesized() && !InsMap.count(method->getSelector()) && (!Super || - !Super->lookupInstanceMethod(Context, method->getSelector()))) { + !Super->lookupInstanceMethod(method->getSelector()))) { // Ugly, but necessary. Method declared in protcol might have // have been synthesized due to a property declared in the class which // uses the protocol. ObjCMethodDecl *MethodInClass = - IDecl->lookupInstanceMethod(Context, method->getSelector()); + IDecl->lookupInstanceMethod(method->getSelector()); if (!MethodInClass || !MethodInClass->isSynthesized()) WarnUndefinedMethod(ImpLoc, method, IncompleteImpl); } } // check unimplemented class methods for (ObjCProtocolDecl::classmeth_iterator - I = PDecl->classmeth_begin(Context), - E = PDecl->classmeth_end(Context); + I = PDecl->classmeth_begin(), E = PDecl->classmeth_end(); I != E; ++I) { ObjCMethodDecl *method = *I; if (method->getImplementationControl() != ObjCMethodDecl::Optional && !ClsMap.count(method->getSelector()) && - (!Super || !Super->lookupClassMethod(Context, method->getSelector()))) + (!Super || !Super->lookupClassMethod(method->getSelector()))) WarnUndefinedMethod(ImpLoc, method, IncompleteImpl); } // Check on this protocols's referenced protocols, recursively. @@ -937,8 +934,8 @@ void Sema::MatchAllMethodDeclarations(const llvm::DenseSet<Selector> &InsMap, { // Check and see if instance methods in class interface have been // implemented in the implementation class. If so, their types match. - for (ObjCInterfaceDecl::instmeth_iterator I = CDecl->instmeth_begin(Context), - E = CDecl->instmeth_end(Context); I != E; ++I) { + for (ObjCInterfaceDecl::instmeth_iterator I = CDecl->instmeth_begin(), + E = CDecl->instmeth_end(); I != E; ++I) { if (InsMapSeen.count((*I)->getSelector())) continue; InsMapSeen.insert((*I)->getSelector()); @@ -950,9 +947,9 @@ void Sema::MatchAllMethodDeclarations(const llvm::DenseSet<Selector> &InsMap, } else { ObjCMethodDecl *ImpMethodDecl = - IMPDecl->getInstanceMethod(Context, (*I)->getSelector()); + IMPDecl->getInstanceMethod((*I)->getSelector()); ObjCMethodDecl *IntfMethodDecl = - CDecl->getInstanceMethod(Context, (*I)->getSelector()); + CDecl->getInstanceMethod((*I)->getSelector()); assert(IntfMethodDecl && "IntfMethodDecl is null in ImplMethodsVsClassMethods"); // ImpMethodDecl may be null as in a @dynamic property. @@ -964,9 +961,7 @@ void Sema::MatchAllMethodDeclarations(const llvm::DenseSet<Selector> &InsMap, // Check and see if class methods in class interface have been // implemented in the implementation class. If so, their types match. for (ObjCInterfaceDecl::classmeth_iterator - I = CDecl->classmeth_begin(Context), - E = CDecl->classmeth_end(Context); - I != E; ++I) { + I = CDecl->classmeth_begin(), E = CDecl->classmeth_end(); I != E; ++I) { if (ClsMapSeen.count((*I)->getSelector())) continue; ClsMapSeen.insert((*I)->getSelector()); @@ -975,10 +970,10 @@ void Sema::MatchAllMethodDeclarations(const llvm::DenseSet<Selector> &InsMap, WarnUndefinedMethod(IMPDecl->getLocation(), *I, IncompleteImpl); } else { - ObjCMethodDecl *ImpMethodDecl = - IMPDecl->getClassMethod(Context, (*I)->getSelector()); + ObjCMethodDecl *ImpMethodDecl = + IMPDecl->getClassMethod((*I)->getSelector()); ObjCMethodDecl *IntfMethodDecl = - CDecl->getClassMethod(Context, (*I)->getSelector()); + CDecl->getClassMethod((*I)->getSelector()); WarnConflictingTypedMethods(ImpMethodDecl, IntfMethodDecl); } } @@ -1003,24 +998,23 @@ void Sema::ImplMethodsVsClassMethods(ObjCImplDecl* IMPDecl, // Check and see if instance methods in class interface have been // implemented in the implementation class. for (ObjCImplementationDecl::instmeth_iterator - I = IMPDecl->instmeth_begin(Context), - E = IMPDecl->instmeth_end(Context); I != E; ++I) + I = IMPDecl->instmeth_begin(), E = IMPDecl->instmeth_end(); I!=E; ++I) InsMap.insert((*I)->getSelector()); // Check and see if properties declared in the interface have either 1) // an implementation or 2) there is a @synthesize/@dynamic implementation // of the property in the @implementation. if (isa<ObjCInterfaceDecl>(CDecl)) - for (ObjCContainerDecl::prop_iterator P = CDecl->prop_begin(Context), - E = CDecl->prop_end(Context); P != E; ++P) { + for (ObjCContainerDecl::prop_iterator P = CDecl->prop_begin(), + E = CDecl->prop_end(); P != E; ++P) { ObjCPropertyDecl *Prop = (*P); if (Prop->isInvalidDecl()) continue; ObjCPropertyImplDecl *PI = 0; // Is there a matching propery synthesize/dynamic? for (ObjCImplDecl::propimpl_iterator - I = IMPDecl->propimpl_begin(Context), - EI = IMPDecl->propimpl_end(Context); I != EI; ++I) + I = IMPDecl->propimpl_begin(), + EI = IMPDecl->propimpl_end(); I != EI; ++I) if ((*I)->getPropertyDecl() == Prop) { PI = (*I); break; @@ -1046,8 +1040,8 @@ void Sema::ImplMethodsVsClassMethods(ObjCImplDecl* IMPDecl, llvm::DenseSet<Selector> ClsMap; for (ObjCImplementationDecl::classmeth_iterator - I = IMPDecl->classmeth_begin(Context), - E = IMPDecl->classmeth_end(Context); I != E; ++I) + I = IMPDecl->classmeth_begin(), + E = IMPDecl->classmeth_end(); I != E; ++I) ClsMap.insert((*I)->getSelector()); // Check for type conflict of methods declared in a class/protocol and @@ -1134,7 +1128,7 @@ Sema::ActOnForwardClassDeclaration(SourceLocation AtClassLoc, ObjCClassDecl *CDecl = ObjCClassDecl::Create(Context, CurContext, AtClassLoc, &Interfaces[0], Interfaces.size()); - CurContext->addDecl(Context, CDecl); + CurContext->addDecl(CDecl); CheckObjCDeclScope(CDecl); return DeclPtrTy::make(CDecl); } @@ -1348,8 +1342,8 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property, ObjCContainerDecl *CD) { ObjCMethodDecl *GetterMethod, *SetterMethod; - GetterMethod = CD->getInstanceMethod(Context, property->getGetterName()); - SetterMethod = CD->getInstanceMethod(Context, property->getSetterName()); + GetterMethod = CD->getInstanceMethod(property->getGetterName()); + SetterMethod = CD->getInstanceMethod(property->getSetterName()); DiagnosePropertyAccessorMismatch(property, GetterMethod, property->getLocation()); @@ -1384,7 +1378,7 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property, ObjCPropertyDecl::Optional) ? ObjCMethodDecl::Optional : ObjCMethodDecl::Required); - CD->addDecl(Context, GetterMethod); + CD->addDecl(GetterMethod); } else // A user declared getter will be synthesize when @synthesize of // the property with the same name is seen in the @implementation @@ -1415,7 +1409,7 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property, VarDecl::None, 0); SetterMethod->setMethodParams(Context, &Argument, 1); - CD->addDecl(Context, SetterMethod); + CD->addDecl(SetterMethod); } else // A user declared setter will be synthesize when @synthesize of // the property with the same name is seen in the @implementation @@ -1481,7 +1475,7 @@ void Sema::ActOnAtEnd(SourceLocation AtEndLoc, DeclPtrTy classDecl, << Method->getDeclName(); Diag(PrevMethod->getLocation(), diag::note_previous_declaration); } else { - DC->addDecl(Context, Method); + DC->addDecl(Method); InsMap[Method->getSelector()] = Method; /// The following allows us to typecheck messages to "id". AddInstanceMethodToGlobalPool(Method); @@ -1498,7 +1492,7 @@ void Sema::ActOnAtEnd(SourceLocation AtEndLoc, DeclPtrTy classDecl, << Method->getDeclName(); Diag(PrevMethod->getLocation(), diag::note_previous_declaration); } else { - DC->addDecl(Context, Method); + DC->addDecl(Method); ClsMap[Method->getSelector()] = Method; /// The following allows us to typecheck messages to "Class". AddFactoryMethodToGlobalPool(Method); @@ -1524,8 +1518,8 @@ void Sema::ActOnAtEnd(SourceLocation AtEndLoc, DeclPtrTy classDecl, // ProcessPropertyDecl is responsible for diagnosing conflicts with any // user-defined setter/getter. It also synthesizes setter/getter methods // and adds them to the DeclContext and global method pools. - for (ObjCContainerDecl::prop_iterator I = CDecl->prop_begin(Context), - E = CDecl->prop_end(Context); + for (ObjCContainerDecl::prop_iterator I = CDecl->prop_begin(), + E = CDecl->prop_end(); I != E; ++I) ProcessPropertyDecl(*I, CDecl); CDecl->setAtEndLoc(AtEndLoc); @@ -1683,11 +1677,11 @@ Sema::DeclPtrTy Sema::ActOnMethodDeclaration( if (ObjCImplementationDecl *ImpDecl = dyn_cast<ObjCImplementationDecl>(ClassDecl)) { if (MethodType == tok::minus) { - PrevMethod = ImpDecl->getInstanceMethod(Context, Sel); - ImpDecl->addInstanceMethod(Context, ObjCMethod); + PrevMethod = ImpDecl->getInstanceMethod(Sel); + ImpDecl->addInstanceMethod(ObjCMethod); } else { - PrevMethod = ImpDecl->getClassMethod(Context, Sel); - ImpDecl->addClassMethod(Context, ObjCMethod); + PrevMethod = ImpDecl->getClassMethod(Sel); + ImpDecl->addClassMethod(ObjCMethod); } if (AttrList) Diag(EndLoc, diag::warn_attribute_method_def); @@ -1695,11 +1689,11 @@ Sema::DeclPtrTy Sema::ActOnMethodDeclaration( else if (ObjCCategoryImplDecl *CatImpDecl = dyn_cast<ObjCCategoryImplDecl>(ClassDecl)) { if (MethodType == tok::minus) { - PrevMethod = CatImpDecl->getInstanceMethod(Context, Sel); - CatImpDecl->addInstanceMethod(Context, ObjCMethod); + PrevMethod = CatImpDecl->getInstanceMethod(Sel); + CatImpDecl->addInstanceMethod(ObjCMethod); } else { - PrevMethod = CatImpDecl->getClassMethod(Context, Sel); - CatImpDecl->addClassMethod(Context, ObjCMethod); + PrevMethod = CatImpDecl->getClassMethod(Sel); + CatImpDecl->addClassMethod(ObjCMethod); } if (AttrList) Diag(EndLoc, diag::warn_attribute_method_def); @@ -1823,8 +1817,7 @@ Sema::DeclPtrTy Sema::ActOnProperty(Scope *S, SourceLocation AtLoc, ObjCPropertyDecl *PIDecl = 0; IdentifierInfo *PropertyId = FD.D.getIdentifier(); for (ObjCInterfaceDecl::prop_iterator - I = CCPrimary->prop_begin(Context), - E = CCPrimary->prop_end(Context); + I = CCPrimary->prop_begin(), E = CCPrimary->prop_end(); I != E; ++I) if ((*I)->getIdentifier() == PropertyId) { PIDecl = *I; @@ -1870,7 +1863,7 @@ Sema::DeclPtrTy Sema::ActOnProperty(Scope *S, SourceLocation AtLoc, ObjCPropertyDecl *PDecl = ObjCPropertyDecl::Create(Context, DC, FD.D.getIdentifierLoc(), FD.D.getIdentifier(), T); - DC->addDecl(Context, PDecl); + DC->addDecl(PDecl); if (T->isArrayType() || T->isFunctionType()) { Diag(AtLoc, diag::err_property_type) << T; @@ -1951,7 +1944,7 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc, "ActOnPropertyImplDecl - @implementation without @interface"); // Look for this property declaration in the @implementation's @interface - property = IDecl->FindPropertyDeclaration(Context, PropertyId); + property = IDecl->FindPropertyDeclaration(PropertyId); if (!property) { Diag(PropertyLoc, diag::error_bad_property_decl) << IDecl->getDeclName(); return DeclPtrTy(); @@ -1975,7 +1968,7 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc, if (!Category) return DeclPtrTy(); // Look for this property declaration in @implementation's category - property = Category->FindPropertyDeclaration(Context, PropertyId); + property = Category->FindPropertyDeclaration(PropertyId); if (!property) { Diag(PropertyLoc, diag::error_bad_category_property_decl) << Category->getDeclName(); @@ -1994,7 +1987,7 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc, QualType PropType = Context.getCanonicalType(property->getType()); // Check that this is a previously declared 'ivar' in 'IDecl' interface ObjCInterfaceDecl *ClassDeclared; - Ivar = IDecl->lookupInstanceVariable(Context, PropertyIvar, ClassDeclared); + Ivar = IDecl->lookupInstanceVariable(PropertyIvar, ClassDeclared); if (!Ivar) { DeclContext *EnclosingContext = cast_or_null<DeclContext>(IDecl); assert(EnclosingContext && @@ -2004,7 +1997,7 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc, ObjCIvarDecl::Public, (Expr *)0); Ivar->setLexicalDeclContext(IDecl); - IDecl->addDecl(Context, Ivar); + IDecl->addDecl(Ivar); property->setPropertyIvarDecl(Ivar); if (!getLangOptions().ObjCNonFragileABI) Diag(PropertyLoc, diag::error_missing_property_ivar_decl) << PropertyId; @@ -2071,7 +2064,7 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc, if (IC) { if (Synthesize) if (ObjCPropertyImplDecl *PPIDecl = - IC->FindPropertyImplIvarDecl(Context, PropertyIvar)) { + IC->FindPropertyImplIvarDecl(PropertyIvar)) { Diag(PropertyLoc, diag::error_duplicate_ivar_use) << PropertyId << PPIDecl->getPropertyDecl()->getIdentifier() << PropertyIvar; @@ -2079,17 +2072,17 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc, } if (ObjCPropertyImplDecl *PPIDecl - = IC->FindPropertyImplDecl(Context, PropertyId)) { + = IC->FindPropertyImplDecl(PropertyId)) { Diag(PropertyLoc, diag::error_property_implemented) << PropertyId; Diag(PPIDecl->getLocation(), diag::note_previous_declaration); return DeclPtrTy(); } - IC->addPropertyImplementation(Context, PIDecl); + IC->addPropertyImplementation(PIDecl); } else { if (Synthesize) if (ObjCPropertyImplDecl *PPIDecl = - CatImplClass->FindPropertyImplIvarDecl(Context, PropertyIvar)) { + CatImplClass->FindPropertyImplIvarDecl(PropertyIvar)) { Diag(PropertyLoc, diag::error_duplicate_ivar_use) << PropertyId << PPIDecl->getPropertyDecl()->getIdentifier() << PropertyIvar; @@ -2097,12 +2090,12 @@ Sema::DeclPtrTy Sema::ActOnPropertyImplDecl(SourceLocation AtLoc, } if (ObjCPropertyImplDecl *PPIDecl = - CatImplClass->FindPropertyImplDecl(Context, PropertyId)) { + CatImplClass->FindPropertyImplDecl(PropertyId)) { Diag(PropertyLoc, diag::error_property_implemented) << PropertyId; Diag(PPIDecl->getLocation(), diag::note_previous_declaration); return DeclPtrTy(); } - CatImplClass->addPropertyImplementation(Context, PIDecl); + CatImplClass->addPropertyImplementation(PIDecl); } return DeclPtrTy::make(PIDecl); @@ -2154,7 +2147,7 @@ void Sema::ActOnDefs(Scope *S, DeclPtrTy TagD, SourceLocation DeclStart, if (getLangOptions().CPlusPlus) PushOnScopeChains(cast<FieldDecl>(FD), S); else if (RecordDecl *Record = dyn_cast<RecordDecl>(TagD.getAs<Decl>())) - Record->addDecl(Context, FD); + Record->addDecl(FD); } } diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 2102bed03b5..28617bbfeac 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -58,8 +58,7 @@ bool Sema::DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc) { if (ObjCImplementationDecl *Impl = dyn_cast<ObjCImplementationDecl>(MD->getParent())) { - MD = Impl->getClassInterface()->getMethod(Context, - MD->getSelector(), + MD = Impl->getClassInterface()->getMethod(MD->getSelector(), MD->isInstanceMethod()); isSilenced |= MD && MD->getAttr<DeprecatedAttr>(); } @@ -673,8 +672,8 @@ static Decl *getObjectForAnonymousRecordDecl(ASTContext &Context, // operation rather than a slow walk through DeclContext's vector (which // itself will be eliminated). DeclGroups might make this even better. DeclContext *Ctx = Record->getDeclContext(); - for (DeclContext::decl_iterator D = Ctx->decls_begin(Context), - DEnd = Ctx->decls_end(Context); + for (DeclContext::decl_iterator D = Ctx->decls_begin(), + DEnd = Ctx->decls_end(); D != DEnd; ++D) { if (*D == Record) { // The object for the anonymous struct/union directly @@ -877,8 +876,7 @@ Sema::ActOnDeclarationNameExpr(Scope *S, SourceLocation Loc, if (D == 0 || D->isDefinedOutsideFunctionOrMethod()) { ObjCInterfaceDecl *IFace = getCurMethodDecl()->getClassInterface(); ObjCInterfaceDecl *ClassDeclared; - if (ObjCIvarDecl *IV = IFace->lookupInstanceVariable(Context, II, - ClassDeclared)) { + if (ObjCIvarDecl *IV = IFace->lookupInstanceVariable(II, ClassDeclared)) { // Check if referencing a field with __attribute__((deprecated)). if (DiagnoseUseOfDecl(IV, Loc)) return ExprError(); @@ -915,8 +913,7 @@ Sema::ActOnDeclarationNameExpr(Scope *S, SourceLocation Loc, // We should warn if a local variable hides an ivar. ObjCInterfaceDecl *IFace = getCurMethodDecl()->getClassInterface(); ObjCInterfaceDecl *ClassDeclared; - if (ObjCIvarDecl *IV = IFace->lookupInstanceVariable(Context, II, - ClassDeclared)) { + if (ObjCIvarDecl *IV = IFace->lookupInstanceVariable(II, ClassDeclared)) { if (IV->getAccessControl() != ObjCIvarDecl::Private || IFace == ClassDeclared) Diag(Loc, diag::warn_ivar_use_hidden) << IV->getDeclName(); @@ -1989,9 +1986,9 @@ static Decl *FindGetterNameDeclFromProtocolList(const ObjCProtocolDecl*PDecl, const Selector &Sel, ASTContext &Context) { - if (ObjCPropertyDecl *PD = PDecl->FindPropertyDeclaration(Context, &Member)) + if (ObjCPropertyDecl *PD = PDecl->FindPropertyDeclaration(&Member)) return PD; - if (ObjCMethodDecl *OMD = PDecl->getInstanceMethod(Context, Sel)) + if (ObjCMethodDecl *OMD = PDecl->getInstanceMethod(Sel)) return OMD; for (ObjCProtocolDecl::protocol_iterator I = PDecl->protocol_begin(), @@ -2011,12 +2008,12 @@ static Decl *FindGetterNameDecl(const ObjCObjectPointerType *QIdTy, Decl *GDecl = 0; for (ObjCObjectPointerType::qual_iterator I = QIdTy->qual_begin(), E = QIdTy->qual_end(); I != E; ++I) { - if (ObjCPropertyDecl *PD = (*I)->FindPropertyDeclaration(Context, &Member)) { + if (ObjCPropertyDecl *PD = (*I)->FindPropertyDeclaration(&Member)) { GDecl = PD; break; } // Also must look for a getter name which uses property syntax. - if (ObjCMethodDecl *OMD = (*I)->getInstanceMethod(Context, Sel)) { + if (ObjCMethodDecl *OMD = (*I)->getInstanceMethod(Sel)) { GDecl = OMD; break; } @@ -2042,7 +2039,7 @@ ObjCMethodDecl *Sema::FindMethodInNestedImplementations( ObjCMethodDecl *Method = 0; if (ObjCImplementationDecl *ImpDecl = LookupObjCImplementation(IFace->getIdentifier())) - Method = ImpDecl->getInstanceMethod(Context, Sel); + Method = ImpDecl->getInstanceMethod(Sel); if (!Method && IFace->getSuperClass()) return FindMethodInNestedImplementations(IFace->getSuperClass(), Sel); @@ -2201,8 +2198,7 @@ Sema::ActOnMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, // (*Obj).ivar. if (const ObjCInterfaceType *IFTy = BaseType->getAsObjCInterfaceType()) { ObjCInterfaceDecl *ClassDeclared; - if (ObjCIvarDecl *IV = IFTy->getDecl()->lookupInstanceVariable(Context, - &Member, + if (ObjCIvarDecl *IV = IFTy->getDecl()->lookupInstanceVariable(&Member, ClassDeclared)) { // If the decl being referenced had an error, return an error for this // sub-expr without emitting another error, in order to avoid cascading @@ -2262,14 +2258,13 @@ Sema::ActOnMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, ObjCInterfaceDecl *IFace = IFTy->getDecl(); // Search for a declared property first. - if (ObjCPropertyDecl *PD = IFace->FindPropertyDeclaration(Context, - &Member)) { + if (ObjCPropertyDecl *PD = IFace->FindPropertyDeclaration(&Member)) { // Check whether we can reference this property. if (DiagnoseUseOfDecl(PD, MemberLoc)) return ExprError(); QualType ResTy = PD->getType(); Selector Sel = PP.getSelectorTable().getNullarySelector(&Member); - ObjCMethodDecl *Getter = IFace->lookupInstanceMethod(Context, Sel); + ObjCMethodDecl *Getter = IFace->lookupInstanceMethod(Sel); if (DiagnosePropertyAccessorMismatch(PD, Getter, MemberLoc)) ResTy = Getter->getResultType(); return Owned(new (Context) ObjCPropertyRefExpr(PD, ResTy, @@ -2279,8 +2274,7 @@ Sema::ActOnMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, // Check protocols on qualified interfaces. for (ObjCInterfaceType::qual_iterator I = IFTy->qual_begin(), E = IFTy->qual_end(); I != E; ++I) - if (ObjCPropertyDecl *PD = (*I)->FindPropertyDeclaration(Context, - &Member)) { + if (ObjCPropertyDecl *PD = (*I)->FindPropertyDeclaration(&Member)) { // Check whether we can reference this property. if (DiagnoseUseOfDecl(PD, MemberLoc)) return ExprError(); @@ -2296,7 +2290,7 @@ Sema::ActOnMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, // shared with the code in ActOnInstanceMessage. Selector Sel = PP.getSelectorTable().getNullarySelector(&Member); - ObjCMethodDecl *Getter = IFace->lookupInstanceMethod(Context, Sel); + ObjCMethodDecl *Getter = IFace->lookupInstanceMethod(Sel); // If this reference is in an @implementation, check for 'private' methods. if (!Getter) @@ -2306,7 +2300,7 @@ Sema::ActOnMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, if (!Getter) { for (unsigned i = 0; i < ObjCCategoryImpls.size() && !Getter; i++) { if (ObjCCategoryImpls[i]->getClassInterface() == IFace) - Getter = ObjCCategoryImpls[i]->getInstanceMethod(Context, Sel); + Getter = ObjCCategoryImpls[i]->getInstanceMethod(Sel); } } if (Getter) { @@ -2319,7 +2313,7 @@ Sema::ActOnMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, Selector SetterSel = SelectorTable::constructSetterName(PP.getIdentifierTable(), PP.getSelectorTable(), &Member); - ObjCMethodDecl *Setter = IFace->lookupInstanceMethod(Context, SetterSel); + ObjCMethodDecl *Setter = IFace->lookupInstanceMethod(SetterSel); if (!Setter) { // If this reference is in an @implementation, also check for 'private' // methods. @@ -2329,7 +2323,7 @@ Sema::ActOnMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, if (!Setter) { for (unsigned i = 0; i < ObjCCategoryImpls.size() && !Setter; i++) { if (ObjCCategoryImpls[i]->getClassInterface() == IFace) - Setter = ObjCCategoryImpls[i]->getInstanceMethod(Context, SetterSel); + Setter = ObjCCategoryImpls[i]->getInstanceMethod(SetterSel); } } @@ -2390,7 +2384,7 @@ Sema::ActOnMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, ObjCInterfaceDecl *IFace = MD->getClassInterface(); ObjCMethodDecl *Getter; // FIXME: need to also look locally in the implementation. - if ((Getter = IFace->lookupClassMethod(Context, Sel))) { + if ((Getter = IFace->lookupClassMethod(Sel))) { // Check the use of this method. if (DiagnoseUseOfDecl(Getter, MemberLoc)) return ExprError(); @@ -2400,7 +2394,7 @@ Sema::ActOnMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, Selector SetterSel = SelectorTable::constructSetterName(PP.getIdentifierTable(), PP.getSelectorTable(), &Member); - ObjCMethodDecl *Setter = IFace->lookupClassMethod(Context, SetterSel); + ObjCMethodDecl *Setter = IFace->lookupClassMethod(SetterSel); if (!Setter) { // If this reference is in an @implementation, also check for 'private' // methods. @@ -2410,7 +2404,7 @@ Sema::ActOnMemberReferenceExpr(Scope *S, ExprArg Base, SourceLocation OpLoc, if (!Setter) { for (unsigned i = 0; i < ObjCCategoryImpls.size() && !Setter; i++) { if (ObjCCategoryImpls[i]->getClassInterface() == IFace) - Setter = ObjCCategoryImpls[i]->getClassMethod(Context, SetterSel); + Setter = ObjCCategoryImpls[i]->getClassMethod(SetterSel); } } @@ -2860,7 +2854,7 @@ bool Sema::CheckCastTypes(SourceRange TyR, QualType castType, Expr *&castExpr) { // GCC cast to union extension RecordDecl *RD = castType->getAsRecordType()->getDecl(); RecordDecl::field_iterator Field, FieldEnd; - for (Field = RD->field_begin(Context), FieldEnd = RD->field_end(Context); + for (Field = RD->field_begin(), FieldEnd = RD->field_end(); Field != FieldEnd; ++Field) { if (Context.getCanonicalType(Field->getType()).getUnqualifiedType() == Context.getCanonicalType(castExpr->getType()).getUnqualifiedType()) { @@ -3496,8 +3490,8 @@ Sema::CheckTransparentUnionArgumentConstraints(QualType ArgType, Expr *&rExpr) { RecordDecl *UD = UT->getDecl(); FieldDecl *InitField = 0; // It's compatible if the expression matches any of the fields. - for (RecordDecl::field_iterator it = UD->field_begin(Context), - itend = UD->field_end(Context); + for (RecordDecl::field_iterator it = UD->field_begin(), + itend = UD->field_end(); it != itend; ++it) { if (it->getType()->isPointerType()) { // If the transparent union contains a pointer type, we allow: diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 0efd8ff7754..7afa5941dad 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -552,7 +552,7 @@ bool Sema::FindAllocationOverload(SourceLocation StartLoc, SourceRange Range, bool AllowMissing, FunctionDecl *&Operator) { DeclContext::lookup_iterator Alloc, AllocEnd; - llvm::tie(Alloc, AllocEnd) = Ctx->lookup(Context, Name); + llvm::tie(Alloc, AllocEnd) = Ctx->lookup(Name); if (Alloc == AllocEnd) { if (AllowMissing) return false; @@ -657,7 +657,7 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name, // Check if this function is already declared. { DeclContext::lookup_iterator Alloc, AllocEnd; - for (llvm::tie(Alloc, AllocEnd) = GlobalCtx->lookup(Context, Name); + for (llvm::tie(Alloc, AllocEnd) = GlobalCtx->lookup(Name); Alloc != AllocEnd; ++Alloc) { // FIXME: Do we need to check for default arguments here? FunctionDecl *Func = cast<FunctionDecl>(*Alloc); @@ -680,7 +680,7 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name, // FIXME: Also add this declaration to the IdentifierResolver, but // make sure it is at the end of the chain to coincide with the // global scope. - ((DeclContext *)TUScope->getEntity())->addDecl(Context, Alloc); + ((DeclContext *)TUScope->getEntity())->addDecl(Alloc); } /// ActOnCXXDelete - Parsed a C++ 'delete' expression (C++ 5.3.5), as in: diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp index f1869f90371..7bb6b44c39c 100644 --- a/clang/lib/Sema/SemaExprObjC.cpp +++ b/clang/lib/Sema/SemaExprObjC.cpp @@ -243,13 +243,13 @@ ObjCMethodDecl *Sema::LookupPrivateClassMethod(Selector Sel, while (ClassDecl && !Method) { if (ObjCImplementationDecl *ImpDecl = LookupObjCImplementation(ClassDecl->getIdentifier())) - Method = ImpDecl->getClassMethod(Context, Sel); + Method = ImpDecl->getClassMethod(Sel); // Look through local category implementations associated with the class. if (!Method) { for (unsigned i = 0; i < ObjCCategoryImpls.size() && !Method; i++) { if (ObjCCategoryImpls[i]->getClassInterface() == ClassDecl) - Method = ObjCCategoryImpls[i]->getClassMethod(Context, Sel); + Method = ObjCCategoryImpls[i]->getClassMethod(Sel); } } @@ -257,7 +257,7 @@ ObjCMethodDecl *Sema::LookupPrivateClassMethod(Selector Sel, // But only in the root. This matches gcc's behaviour and what the // runtime expects. if (!Method && !ClassDecl->getSuperClass()) { - Method = ClassDecl->lookupInstanceMethod(Context, Sel); + Method = ClassDecl->lookupInstanceMethod(Sel); // Look through local category implementations associated // with the root class. if (!Method) @@ -276,13 +276,13 @@ ObjCMethodDecl *Sema::LookupPrivateInstanceMethod(Selector Sel, // If we have implementations in scope, check "private" methods. if (ObjCImplementationDecl *ImpDecl = LookupObjCImplementation(ClassDecl->getIdentifier())) - Method = ImpDecl->getInstanceMethod(Context, Sel); + Method = ImpDecl->getInstanceMethod(Sel); // Look through local category implementations associated with the class. if (!Method) { for (unsigned i = 0; i < ObjCCategoryImpls.size() && !Method; i++) { if (ObjCCategoryImpls[i]->getClassInterface() == ClassDecl) - Method = ObjCCategoryImpls[i]->getInstanceMethod(Context, Sel); + Method = ObjCCategoryImpls[i]->getInstanceMethod(Sel); } } ClassDecl = ClassDecl->getSuperClass(); @@ -301,7 +301,7 @@ Action::OwningExprResult Sema::ActOnClassPropertyRefExpr( // Search for a declared property first. Selector Sel = PP.getSelectorTable().getNullarySelector(&propertyName); - ObjCMethodDecl *Getter = IFace->lookupClassMethod(Context, Sel); + ObjCMethodDecl *Getter = IFace->lookupClassMethod(Sel); // If this reference is in an @implementation, check for 'private' methods. if (!Getter) @@ -309,7 +309,7 @@ Action::OwningExprResult Sema::ActOnClassPropertyRefExpr( if (ObjCInterfaceDecl *ClassDecl = CurMeth->getClassInterface()) if (ObjCImplementationDecl *ImpDecl = LookupObjCImplementation(ClassDecl->getIdentifier())) - Getter = ImpDecl->getClassMethod(Context, Sel); + Getter = ImpDecl->getClassMethod(Sel); if (Getter) { // FIXME: refactor/share with ActOnMemberReference(). @@ -323,7 +323,7 @@ Action::OwningExprResult Sema::ActOnClassPropertyRefExpr( SelectorTable::constructSetterName(PP.getIdentifierTable(), PP.getSelectorTable(), &propertyName); - ObjCMethodDecl *Setter = IFace->lookupClassMethod(Context, SetterSel); + ObjCMethodDecl *Setter = IFace->lookupClassMethod(SetterSel); if (!Setter) { // If this reference is in an @implementation, also check for 'private' // methods. @@ -331,13 +331,13 @@ Action::OwningExprResult Sema::ActOnClassPropertyRefExpr( if (ObjCInterfaceDecl *ClassDecl = CurMeth->getClassInterface()) if (ObjCImplementationDecl *ImpDecl = LookupObjCImplementation(ClassDecl->getIdentifier())) - Setter = ImpDecl->getClassMethod(Context, SetterSel); + Setter = ImpDecl->getClassMethod(SetterSel); } // Look through local category implementations associated with the class. if (!Setter) { for (unsigned i = 0; i < ObjCCategoryImpls.size() && !Setter; i++) { if (ObjCCategoryImpls[i]->getClassInterface() == IFace) - Setter = ObjCCategoryImpls[i]->getClassMethod(Context, SetterSel); + Setter = ObjCCategoryImpls[i]->getClassMethod(SetterSel); } } @@ -450,7 +450,7 @@ Sema::ExprResult Sema::ActOnClassMessage( << Method->getDeclName(); } if (!Method) - Method = ClassDecl->lookupClassMethod(Context, Sel); + Method = ClassDecl->lookupClassMethod(Sel); // If we have an implementation in scope, check "private" methods. if (!Method) @@ -507,7 +507,7 @@ Sema::ExprResult Sema::ActOnInstanceMessage(ExprTy *receiver, Selector Sel, // If we have an interface in scope, check 'super' methods. if (ObjCInterfaceDecl *ClassDecl = CurMeth->getClassInterface()) if (ObjCInterfaceDecl *SuperDecl = ClassDecl->getSuperClass()) { - Method = SuperDecl->lookupInstanceMethod(Context, Sel); + Method = SuperDecl->lookupInstanceMethod(Sel); if (!Method) // If we have implementations in scope, check "private" methods. @@ -550,7 +550,7 @@ Sema::ExprResult Sema::ActOnInstanceMessage(ExprTy *receiver, Selector Sel, if (ObjCMethodDecl *CurMeth = getCurMethodDecl()) { if (ObjCInterfaceDecl *ClassDecl = CurMeth->getClassInterface()) { // First check the public methods in the class interface. - Method = ClassDecl->lookupClassMethod(Context, Sel); + Method = ClassDecl->lookupClassMethod(Sel); if (!Method) Method = LookupPrivateClassMethod(Sel, ClassDecl); @@ -596,10 +596,10 @@ Sema::ExprResult Sema::ActOnInstanceMessage(ExprTy *receiver, Selector Sel, for (ObjCObjectPointerType::qual_iterator I = QIdTy->qual_begin(), E = QIdTy->qual_end(); I != E; ++I) { ObjCProtocolDecl *PDecl = *I; - if (PDecl && (Method = PDecl->lookupInstanceMethod(Context, Sel))) + if (PDecl && (Method = PDecl->lookupInstanceMethod(Sel))) break; // Since we aren't supporting "Class<foo>", look for a class method. - if (PDecl && (Method = PDecl->lookupClassMethod(Context, Sel))) + if (PDecl && (Method = PDecl->lookupClassMethod(Sel))) break; } } else if (const ObjCInterfaceType *OCIType = @@ -610,13 +610,13 @@ Sema::ExprResult Sema::ActOnInstanceMessage(ExprTy *receiver, Selector Sel, // FIXME: consider using LookupInstanceMethodInGlobalPool, since it will be // faster than the following method (which can do *many* linear searches). // The idea is to add class info to InstanceMethodPool. - Method = ClassDecl->lookupInstanceMethod(Context, Sel); + Method = ClassDecl->lookupInstanceMethod(Sel); if (!Method) { // Search protocol qualifiers. for (ObjCQualifiedInterfaceType::qual_iterator QI = OCIType->qual_begin(), E = OCIType->qual_end(); QI != E; ++QI) { - if ((Method = (*QI)->lookupInstanceMethod(Context, Sel))) + if ((Method = (*QI)->lookupInstanceMethod(Sel))) break; } } diff --git a/clang/lib/Sema/SemaInherit.cpp b/clang/lib/Sema/SemaInherit.cpp index 28ca5f64ef5..2f914f14a81 100644 --- a/clang/lib/Sema/SemaInherit.cpp +++ b/clang/lib/Sema/SemaInherit.cpp @@ -187,7 +187,7 @@ bool Sema::LookupInBases(CXXRecordDecl *Class, = (Context.getCanonicalType(BaseSpec->getType()) == Criteria.Base); break; case MemberLookupCriteria::LK_NamedMember: - Paths.ScratchPath.Decls = BaseRecord->lookup(Context, Criteria.Name); + Paths.ScratchPath.Decls = BaseRecord->lookup(Criteria.Name); while (Paths.ScratchPath.Decls.first != Paths.ScratchPath.Decls.second) { if (isAcceptableLookupResult(*Paths.ScratchPath.Decls.first, Criteria.NameKind, Criteria.IDNS)) { @@ -199,7 +199,7 @@ bool Sema::LookupInBases(CXXRecordDecl *Class, break; case MemberLookupCriteria::LK_OverriddenMember: Paths.ScratchPath.Decls = - BaseRecord->lookup(Context, Criteria.Method->getDeclName()); + BaseRecord->lookup(Criteria.Method->getDeclName()); while (Paths.ScratchPath.Decls.first != Paths.ScratchPath.Decls.second) { if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(*Paths.ScratchPath.Decls.first)) { diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index 6b812e1968d..ecfdfd7ba0b 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -343,8 +343,8 @@ void InitListChecker::FillInValueInitializations(InitListExpr *ILE) { if (const RecordType *RType = ILE->getType()->getAsRecordType()) { unsigned Init = 0, NumInits = ILE->getNumInits(); for (RecordDecl::field_iterator - Field = RType->getDecl()->field_begin(SemaRef.Context), - FieldEnd = RType->getDecl()->field_end(SemaRef.Context); + Field = RType->getDecl()->field_begin(), + FieldEnd = RType->getDecl()->field_end(); Field != FieldEnd; ++Field) { if (Field->isUnnamedBitfield()) continue; @@ -449,8 +449,8 @@ int InitListChecker::numStructUnionElements(QualType DeclType) { RecordDecl *structDecl = DeclType->getAsRecordType()->getDecl(); int InitializableMembers = 0; for (RecordDecl::field_iterator - Field = structDecl->field_begin(SemaRef.Context), - FieldEnd = structDecl->field_end(SemaRef.Context); + Field = structDecl->field_begin(), + FieldEnd = structDecl->field_end(); Field != FieldEnd; ++Field) { if ((*Field)->getIdentifier() || !(*Field)->isBitField()) ++InitializableMembers; @@ -580,7 +580,7 @@ void InitListChecker::CheckListElementTypes(InitListExpr *IList, } else if (DeclType->isAggregateType()) { if (DeclType->isRecordType()) { RecordDecl *RD = DeclType->getAsRecordType()->getDecl(); - CheckStructUnionTypes(IList, DeclType, RD->field_begin(SemaRef.Context), + CheckStructUnionTypes(IList, DeclType, RD->field_begin(), SubobjectIsDesignatorContext, Index, StructuredList, StructuredIndex, TopLevelObject); @@ -946,7 +946,7 @@ void InitListChecker::CheckStructUnionTypes(InitListExpr *IList, if (DeclType->isUnionType() && IList->getNumInits() == 0) { // Value-initialize the first named member of the union. RecordDecl *RD = DeclType->getAsRecordType()->getDecl(); - for (RecordDecl::field_iterator FieldEnd = RD->field_end(SemaRef.Context); + for (RecordDecl::field_iterator FieldEnd = RD->field_end(); Field != FieldEnd; ++Field) { if (Field->getDeclName()) { StructuredList->setInitializedFieldInUnion(*Field); @@ -961,7 +961,7 @@ void InitListChecker::CheckStructUnionTypes(InitListExpr *IList, // because an error should get printed out elsewhere. It might be // worthwhile to skip over the rest of the initializer, though. RecordDecl *RD = DeclType->getAsRecordType()->getDecl(); - RecordDecl::field_iterator FieldEnd = RD->field_end(SemaRef.Context); + RecordDecl::field_iterator FieldEnd = RD->field_end(); bool InitializedSomething = false; while (Index < IList->getNumInits()) { Expr *Init = IList->getInit(Index); @@ -1090,9 +1090,9 @@ static void ExpandAnonymousFieldDesignator(Sema &SemaRef, // Update FieldIter/FieldIndex; RecordDecl *Record = cast<RecordDecl>(Path.back()->getDeclContext()); - FieldIter = Record->field_begin(SemaRef.Context); + FieldIter = Record->field_begin(); FieldIndex = 0; - for (RecordDecl::field_iterator FEnd = Record->field_end(SemaRef.Context); + for (RecordDecl::field_iterator FEnd = Record->field_end(); FieldIter != FEnd; ++FieldIter) { if (FieldIter->isUnnamedBitfield()) continue; @@ -1217,8 +1217,8 @@ InitListChecker::CheckDesignatedInitializer(InitListExpr *IList, IdentifierInfo *FieldName = D->getFieldName(); unsigned FieldIndex = 0; RecordDecl::field_iterator - Field = RT->getDecl()->field_begin(SemaRef.Context), - FieldEnd = RT->getDecl()->field_end(SemaRef.Context); + Field = RT->getDecl()->field_begin(), + FieldEnd = RT->getDecl()->field_end(); for (; Field != FieldEnd; ++Field) { if (Field->isUnnamedBitfield()) continue; @@ -1235,8 +1235,7 @@ InitListChecker::CheckDesignatedInitializer(InitListExpr *IList, // something that we can't designate (e.g., a member function), // may find nothing, or may find a member of an anonymous // struct/union. - DeclContext::lookup_result Lookup - = RT->getDecl()->lookup(SemaRef.Context, FieldName); + DeclContext::lookup_result Lookup = RT->getDecl()->lookup(FieldName); if (Lookup.first == Lookup.second) { // Name lookup didn't find anything. SemaRef.Diag(D->getFieldLoc(), diag::err_field_designator_unknown) @@ -1565,8 +1564,8 @@ InitListChecker::getStructuredSubobjectInit(InitListExpr *IList, unsigned Index, if (RDecl->isUnion()) NumElements = 1; else - NumElements = std::distance(RDecl->field_begin(SemaRef.Context), - RDecl->field_end(SemaRef.Context)); + NumElements = std::distance(RDecl->field_begin(), + RDecl->field_end()); } if (NumElements < NumInits) diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index b7ab86352de..6f2fc5e0c43 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -65,7 +65,7 @@ void AddNamespaceUsingDirectives(ASTContext &Context, NamespaceSet &Visited) { DeclContext::udir_iterator I, End; - for (llvm::tie(I, End) = NS->getUsingDirectives(Context); I !=End; ++I) { + for (llvm::tie(I, End) = NS->getUsingDirectives(); I !=End; ++I) { UDirs.push_back(*I); std::push_heap(UDirs.begin(), UDirs.end(), UsingDirAncestorCompare()); NamespaceDecl *Nominated = (*I)->getNominatedNamespace(); @@ -609,7 +609,7 @@ CppNamespaceLookup(ASTContext &Context, DeclContext *NS, // Perform qualified name lookup into the LookupCtx. DeclContext::lookup_iterator I, E; - for (llvm::tie(I, E) = NS->lookup(Context, Name); I != E; ++I) + for (llvm::tie(I, E) = NS->lookup(Name); I != E; ++I) if (Sema::isAcceptableLookupResult(*I, NameKind, IDNS)) { Results.push_back(Sema::LookupResult::CreateLookupResult(Context, I, E)); break; @@ -1005,7 +1005,7 @@ Sema::LookupQualifiedName(DeclContext *LookupCtx, DeclarationName Name, // Perform qualified name lookup into the LookupCtx. DeclContext::lookup_iterator I, E; - for (llvm::tie(I, E) = LookupCtx->lookup(Context, Name); I != E; ++I) + for (llvm::tie(I, E) = LookupCtx->lookup(Name); I != E; ++I) if (isAcceptableLookupResult(*I, NameKind, IDNS)) return LookupResult::CreateLookupResult(Context, I, E); @@ -1148,7 +1148,7 @@ Sema::LookupParsedName(Scope *S, const CXXScopeSpec *SS, // (C++0x [temp.dep.type]). unsigned IDNS = getIdentifierNamespacesFromLookupNameKind(NameKind, true); DeclContext::lookup_iterator I, E; - for (llvm::tie(I, E) = Current->lookup(Context, Name); I != E; ++I) + for (llvm::tie(I, E) = Current->lookup(Name); I != E; ++I) if (isAcceptableLookupResult(*I, NameKind, IDNS)) return LookupResult::CreateLookupResult(Context, I, E); } @@ -1656,7 +1656,7 @@ void Sema::ArgumentDependentLookup(DeclarationName Name, // namespaces even if they are not visible during an ordinary // lookup (11.4). DeclContext::lookup_iterator I, E; - for (llvm::tie(I, E) = (*NS)->lookup(Context, Name); I != E; ++I) { + for (llvm::tie(I, E) = (*NS)->lookup(Name); I != E; ++I) { if (FunctionDecl *Func = dyn_cast<FunctionDecl>(*I)) Functions.insert(Func); else if (FunctionTemplateDecl *FunTmpl = dyn_cast<FunctionTemplateDecl>(*I)) @@ -1667,7 +1667,7 @@ void Sema::ArgumentDependentLookup(DeclarationName Name, if (GlobalScope) { DeclContext::lookup_iterator I, E; for (llvm::tie(I, E) - = Context.getTranslationUnitDecl()->lookup(Context, Name); + = Context.getTranslationUnitDecl()->lookup(Name); I != E; ++I) { if (FunctionDecl *Func = dyn_cast<FunctionDecl>(*I)) Functions.insert(Func); diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index c63f038cd91..f7deb1f26ff 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -1375,7 +1375,7 @@ bool Sema::IsUserDefinedConversion(Expr *From, QualType ToType, Context.getCanonicalType(ToType).getUnqualifiedType()); DeclContext::lookup_iterator Con, ConEnd; for (llvm::tie(Con, ConEnd) - = ToRecordDecl->lookup(Context, ConstructorName); + = ToRecordDecl->lookup(ConstructorName); Con != ConEnd; ++Con) { CXXConstructorDecl *Constructor = cast<CXXConstructorDecl>(*Con); if (Constructor->isConvertingConstructor()) @@ -2516,7 +2516,7 @@ void Sema::AddMemberOperatorCandidates(OverloadedOperatorKind Op, // FIXME: Lookup in base classes, too! if (const RecordType *T1Rec = T1->getAsRecordType()) { DeclContext::lookup_const_iterator Oper, OperEnd; - for (llvm::tie(Oper, OperEnd) = T1Rec->getDecl()->lookup(Context, OpName); + for (llvm::tie(Oper, OperEnd) = T1Rec->getDecl()->lookup(OpName); Oper != OperEnd; ++Oper) AddMethodCandidate(cast<CXXMethodDecl>(*Oper), Args[0], Args+1, NumArgs - 1, CandidateSet, @@ -4290,7 +4290,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Object, OverloadCandidateSet CandidateSet; DeclarationName OpName = Context.DeclarationNames.getCXXOperatorName(OO_Call); DeclContext::lookup_const_iterator Oper, OperEnd; - for (llvm::tie(Oper, OperEnd) = Record->getDecl()->lookup(Context, OpName); + for (llvm::tie(Oper, OperEnd) = Record->getDecl()->lookup(OpName); Oper != OperEnd; ++Oper) AddMethodCandidate(cast<CXXMethodDecl>(*Oper), Object, Args, NumArgs, CandidateSet, /*SuppressUserConversions=*/false); @@ -4494,8 +4494,7 @@ Sema::BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc, DeclContext::lookup_const_iterator Oper, OperEnd; for (llvm::tie(Oper, OperEnd) - = BaseRecord->getDecl()->lookup(Context, OpName); - Oper != OperEnd; ++Oper) + = BaseRecord->getDecl()->lookup(OpName); Oper != OperEnd; ++Oper) AddMethodCandidate(cast<CXXMethodDecl>(*Oper), Base, 0, 0, CandidateSet, /*SuppressUserConversions=*/false); diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index cd985c536c7..e2f6d33827e 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -2498,7 +2498,7 @@ Sema::ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagKind TK, // Add the specialization into its lexical context, so that it can // be seen when iterating through the list of declarations in that // context. However, specializations are not found by name lookup. - CurContext->addDecl(Context, Specialization); + CurContext->addDecl(Specialization); return DeclPtrTy::make(Specialization); } @@ -2654,7 +2654,7 @@ Sema::ActOnExplicitInstantiation(Scope *S, SourceLocation TemplateLoc, ClassTemplate, Converted, 0); Specialization->setLexicalDeclContext(CurContext); - CurContext->addDecl(Context, Specialization); + CurContext->addDecl(Specialization); return DeclPtrTy::make(Specialization); } @@ -2703,7 +2703,7 @@ Sema::ActOnExplicitInstantiation(Scope *S, SourceLocation TemplateLoc, // since explicit instantiations are never found by name lookup, we // just put it into the declaration context directly. Specialization->setLexicalDeclContext(CurContext); - CurContext->addDecl(Context, Specialization); + CurContext->addDecl(Specialization); // C++ [temp.explicit]p3: // A definition of a class template or class member template diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 8af9ca1f635..ff01e41214c 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -859,8 +859,8 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, Invalid = true; llvm::SmallVector<DeclPtrTy, 4> Fields; - for (RecordDecl::decl_iterator Member = Pattern->decls_begin(Context), - MemberEnd = Pattern->decls_end(Context); + for (RecordDecl::decl_iterator Member = Pattern->decls_begin(), + MemberEnd = Pattern->decls_end(); Member != MemberEnd; ++Member) { Decl *NewMember = InstantiateDecl(*Member, Instantiation, TemplateArgs); if (NewMember) { @@ -996,8 +996,8 @@ void Sema::InstantiateClassMembers(SourceLocation PointOfInstantiation, CXXRecordDecl *Instantiation, const TemplateArgumentList &TemplateArgs) { - for (DeclContext::decl_iterator D = Instantiation->decls_begin(Context), - DEnd = Instantiation->decls_end(Context); + for (DeclContext::decl_iterator D = Instantiation->decls_begin(), + DEnd = Instantiation->decls_end(); D != DEnd; ++D) { if (FunctionDecl *Function = dyn_cast<FunctionDecl>(*D)) { if (!Function->getBody()) diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index 8cda4ec836c..97a160e7155 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -98,7 +98,7 @@ Decl *TemplateDeclInstantiator::VisitTypedefDecl(TypedefDecl *D) { if (Invalid) Typedef->setInvalidDecl(); - Owner->addDecl(SemaRef.Context, Typedef); + Owner->addDecl(Typedef); return Typedef; } @@ -124,7 +124,7 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D) { // are not static data members. bool Redeclaration = false; SemaRef.CheckVariableDeclaration(Var, 0, Redeclaration); - Owner->addDecl(SemaRef.Context, Var); + Owner->addDecl(Var); if (D->getInit()) { OwningExprResult Init @@ -188,7 +188,7 @@ Decl *TemplateDeclInstantiator::VisitFieldDecl(FieldDecl *D) { if (Invalid) Field->setInvalidDecl(); - Owner->addDecl(SemaRef.Context, Field); + Owner->addDecl(Field); } return Field; @@ -219,14 +219,14 @@ Decl *TemplateDeclInstantiator::VisitEnumDecl(EnumDecl *D) { /*PrevDecl=*/0); Enum->setInstantiationOfMemberEnum(D); Enum->setAccess(D->getAccess()); - Owner->addDecl(SemaRef.Context, Enum); + Owner->addDecl(Enum); Enum->startDefinition(); llvm::SmallVector<Sema::DeclPtrTy, 4> Enumerators; EnumConstantDecl *LastEnumConst = 0; - for (EnumDecl::enumerator_iterator EC = D->enumerator_begin(SemaRef.Context), - ECEnd = D->enumerator_end(SemaRef.Context); + for (EnumDecl::enumerator_iterator EC = D->enumerator_begin(), + ECEnd = D->enumerator_end(); EC != ECEnd; ++EC) { // The specified value for the enumerator. OwningExprResult Value = SemaRef.Owned((Expr *)0); @@ -257,7 +257,7 @@ Decl *TemplateDeclInstantiator::VisitEnumDecl(EnumDecl *D) { } if (EnumConst) { - Enum->addDecl(SemaRef.Context, EnumConst); + Enum->addDecl(EnumConst); Enumerators.push_back(Sema::DeclPtrTy::make(EnumConst)); LastEnumConst = EnumConst; } @@ -289,7 +289,7 @@ Decl *TemplateDeclInstantiator::VisitCXXRecordDecl(CXXRecordDecl *D) { if (!D->isInjectedClassName()) Record->setInstantiationOfMemberClass(D); - Owner->addDecl(SemaRef.Context, Record); + Owner->addDecl(Record); return Record; } @@ -394,7 +394,7 @@ Decl *TemplateDeclInstantiator::VisitCXXMethodDecl(CXXMethodDecl *D) { /*FIXME:*/OverloadableAttrRequired); if (!Method->isInvalidDecl() || !PrevDecl) - Owner->addDecl(SemaRef.Context, Method); + Owner->addDecl(Method); return Method; } @@ -442,7 +442,7 @@ Decl *TemplateDeclInstantiator::VisitCXXConstructorDecl(CXXConstructorDecl *D) { /*FIXME:*/OverloadableAttrRequired); Record->addedConstructor(SemaRef.Context, Constructor); - Owner->addDecl(SemaRef.Context, Constructor); + Owner->addDecl(Constructor); return Constructor; } @@ -474,7 +474,7 @@ Decl *TemplateDeclInstantiator::VisitCXXDestructorDecl(CXXDestructorDecl *D) { NamedDecl *PrevDecl = 0; SemaRef.CheckFunctionDeclaration(Destructor, PrevDecl, Redeclaration, /*FIXME:*/OverloadableAttrRequired); - Owner->addDecl(SemaRef.Context, Destructor); + Owner->addDecl(Destructor); return Destructor; } @@ -507,7 +507,7 @@ Decl *TemplateDeclInstantiator::VisitCXXConversionDecl(CXXConversionDecl *D) { NamedDecl *PrevDecl = 0; SemaRef.CheckFunctionDeclaration(Conversion, PrevDecl, Redeclaration, /*FIXME:*/OverloadableAttrRequired); - Owner->addDecl(SemaRef.Context, Conversion); + Owner->addDecl(Conversion); return Conversion; } @@ -809,8 +809,7 @@ NamedDecl * Sema::InstantiateCurrentDeclRef(NamedDecl *D) { // find the instantiation of the declaration D. NamedDecl *Result = 0; if (D->getDeclName()) { - DeclContext::lookup_result Found - = ParentDC->lookup(Context, D->getDeclName()); + DeclContext::lookup_result Found = ParentDC->lookup(D->getDeclName()); Result = findInstantiationOf(Context, D, Found.first, Found.second); } else { // Since we don't have a name for the entity we're looking for, @@ -822,8 +821,8 @@ NamedDecl * Sema::InstantiateCurrentDeclRef(NamedDecl *D) { // // FIXME: Find a better way to find these instantiations! Result = findInstantiationOf(Context, D, - ParentDC->decls_begin(Context), - ParentDC->decls_end(Context)); + ParentDC->decls_begin(), + ParentDC->decls_end()); } assert(Result && "Unable to find instantiation of declaration!"); D = Result; diff --git a/clang/lib/Sema/SemaTemplateInstantiateExpr.cpp b/clang/lib/Sema/SemaTemplateInstantiateExpr.cpp index 65a35f92f7c..e1702b52a66 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateExpr.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateExpr.cpp @@ -525,8 +525,7 @@ TemplateExprInstantiator::VisitShuffleVectorExpr(ShuffleVectorExpr *E) { const IdentifierInfo &Name = SemaRef.Context.Idents.get("__builtin_shufflevector"); TranslationUnitDecl *TUDecl = SemaRef.Context.getTranslationUnitDecl(); - DeclContext::lookup_result Lookup - = TUDecl->lookup(SemaRef.Context, DeclarationName(&Name)); + DeclContext::lookup_result Lookup = TUDecl->lookup(DeclarationName(&Name)); assert(Lookup.first != Lookup.second && "No __builtin_shufflevector?"); // Build a reference to the __builtin_shufflevector builtin |